I checked and it was built just fine in 3212a37, and I have been pining nixpkgs to that rev since forever. I tried switching to the commit right after it, which is cc8e3c2 and it would not build.
What strange is that the commit cc8e3c2 doesn’t seem to have anything to do with cmake
Apparently CMAKE_PREFIX_PATH was not set in build command, this is the build log:
Running phase: qtPreHook
@nix { "action": "setPhase", "phase": "qtPreHook" }
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/jwkkw9cvbvxf98ikhphgjgb551nlfpq6-source
source root is source
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF
-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON
-DCMAKE_BUILD_TYPE=Release
-DBUILD_TESTING=OFF
-DCMAKE_INSTALL_LOCALEDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/share/locale
-DCMAKE_INSTALL_LIBEXECDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/libexec
-DCMAKE_INSTALL_LIBDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/lib
-DCMAKE_INSTALL_DOCDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/share/doc/caesium-image-compressor
-DCMAKE_INSTALL_INFODIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/share/info
-DCMAKE_INSTALL_MANDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/share/man
-DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/include
-DCMAKE_INSTALL_INCLUDEDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/include
-DCMAKE_INSTALL_SBINDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/sbin
-DCMAKE_INSTALL_BINDIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/bin
-DCMAKE_INSTALL_NAME_DIR=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1/lib
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW
-DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/strip
-DCMAKE_RANLIB=/nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/ranlib
-DCMAKE_AR=/nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/ar
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/g6sxybp240fa72387faqjjn46xsxsjhn-caesium-image-compressor-2.7.1
-- The CXX compiler identification is GNU 13.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:52 (message):
CMAKE_PREFIX_PATH is not defined. Cannot find Qt dir.
-- Configuring incomplete, errors occurred!
I don’t know where you got the impression from that these two commits follow each other but neither is the other’s parent. There’s 11481 commits between them in fact.
Could you do a first-parent bisect between the two?
Thank you so much for the solution. Though I have a dumb question. How do i make a patch file?
do i just copy the .cmake file to another location, fix it and diff -u ./a/CMakeList.txt ./b/CMakeList.txt > cmake_patch.patch?
I have a feeling like it is not the case at all. Could you please teach me how do i make patch file properly?
Looking at the previously linked CMakeList.txt it seems there is just a check to see if CMAKE_PREFIX_PATH exists but it doesn’t actually do anything with it, as below it seems to just use normal find_package. if this is the case, there is no patch required and in your derivation you can probably just set env.CMAKE_PREFIX_PATH = ""; to satisfy the check and things should build.
i think that we’d still see failures due to bespoke cmake builds trying to use CMAKE_PREFIX_PATH and not realizing it can be a partial path that needs to be concatenated with CMAKE_FIND_ROOT_PATH. eg: the thing that broke in the ros overlay with NIXPKGS_CMAKE_PREFIX_PATH would still be broken.
however, the OP issue might have been solved as it seems that build system just errors out of CMAKE_PREFIX_PATH doesn’t exist.
so i am not sure if we will be able to get cmake to work how we want it, not search CMAKE_PREFIX_PATH when using find_program, and also not break some bespoke cmake build system. but others are welcome to try.
[edit]: tho the fixes could be upstreamed to use CMAKE_FIND_ROOT_PATH but it seems unlikely NIXPKGS_CMAKE_PREFIX_PATH would be welcomed outside of nixpkgs.