Skip to content

cmake: fix strictDeps#318226

Merged
emilazy merged 3 commits intoNixOS:stagingfrom
paparodeo:cmake-cc-full-path
Jul 27, 2024
Merged

cmake: fix strictDeps#318226
emilazy merged 3 commits intoNixOS:stagingfrom
paparodeo:cmake-cc-full-path

Conversation

@paparodeo
Copy link
Contributor

@paparodeo paparodeo commented Jun 8, 2024

Description of changes

patch cmake (and meson) to use a new NIXPKGS_CMAKE_PREFIX_PATH variable which is like CMAKE_PREFIX_PATH but doesn't provide a search path to find_program

cmake uses CMAKE_PREFIX_PATH to search for libraries, header files, binaries, cmake modules, etc. This is mostly fine except for binaries. We set CMAKE_PREFIX_PATH to the derivation output locations, which results in cmake finding and using binaries which are not set in PATH. when strictDeps is true, nativeBuildInputs is not added to CMAKE_PREFIX_PATH but buildInputs so binaries are first searched for in the buildInputs packages before falling back to PATH.

This change attempts to fix the cmake search path such that cmake will only locate binaries accessible via PATH.

the meson patch is required when it falls back on cmake to find modules, it needs to know about the NIXPKGS_CMAKE_PREFIX_PATH env variable.

the following PRs fix various packages that enable strictDeps but fail to build due to packages missing from nativeBuildInputs

testing

  • 908 builds where cmake in nativeBuildInputs and strictDeps set
  • 54 builds where cmake + meson in nativeBuildInputs
  • random sample of 865 builds where cmake in nativeBuildInputs and strictDeps not set (out of 3480 attributes)

tests were usually run on master with the cmake modifications contained in a new cmake2 package to skip unnecessary rebuilds. packages that required cmake were then built using an override to the modified cmake or manually edited/hacked when overriding was not supported, eg:

# breaks with clang when using strictDeps and unmodified cmake
nix-build -E 'with import ./.{}; castxml.override { stdenv = clangStdenv; cmake = cmake2; }'
# meson build but uses cmake to locate packages
nix-build -E 'with import ./.{}; wf-touch.override { cmake = cmake2; meson = meson2; }'
[...]

packages that require cmake were found using a variation of the following script run from the root of the source tree

example script to get a json list of packages using cmake but not strict deps
nix-instantiate --show-trace --eval --strict --json -A devs - <<EOF
{
  paths ? (import ./pkgs/top-level/release-attrpaths-superset.nix { }).paths,
  pkgs ? (import ./. { }),
}:

let
  inherit (pkgs) lib;
  inherit (builtins) currentSystem tryEval;

  usesCmake =
    let
      isCmakeOverridable = p: p ? override && lib.hasAttr "cmake" (lib.functionArgs p.override);

      hasCmakeNativeBuildInputs =
        p: p ? nativeBuildInputs && lib.lists.any (x: x == pkgs.cmake) p.nativeBuildInputs;

      usesCmake' =
        p:
        p != null
        && !(p.strictDeps or false)     # reverse logic to get list of only strict deps
        && !(p.meta.broken or false)
        && isCmakeOverridable p         # comment out remove overrideable filter 
        && lib.meta.availableOn p currentSystem
        && hasCmakeNativeBuildInputs p;
    in
    path: (tryEval (usesCmake' (lib.attrByPath path null pkgs))).value;
in
{
  devs = map (f: lib.concatStringsSep "." f) (lib.filter usesCmake paths);
}
EOF

then iterate over the packages (or a sample of) passing in the modified cmake2

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jun 8, 2024
@paparodeo paparodeo marked this pull request as ready for review June 9, 2024 00:50
@paparodeo
Copy link
Contributor Author

cc cmake maintainers: @ttuegel @LnL7 @AndersonTorres

@paparodeo paparodeo changed the title cmake: use full path for c/c++ compilers cmake: use full path for c/c++ compilers (fix strictDeps) Jun 12, 2024
@paparodeo
Copy link
Contributor Author

paparodeo commented Jun 17, 2024

after a little matrix discussion it seems that we shouldn't be using CMAKE_PREFIX_PATH to add the buildInputs path as that ends up adding the bin directory which seems incorrect. so instead just add the include and lib directories to the paths seems better.

diff --git a/pkgs/by-name/cm/cmake/setup-hook.sh b/pkgs/by-name/cm/cmake/setup-hook.sh
index b28ed42b6896..63f42a68f02a 100755
--- a/pkgs/by-name/cm/cmake/setup-hook.sh
+++ b/pkgs/by-name/cm/cmake/setup-hook.sh
@@ -1,5 +1,6 @@
 addCMakeParams() {
-    addToSearchPath CMAKE_PREFIX_PATH $1
+    addToSearchPath CMAKE_INCLUDE_PATH "$1/include"
+    addToSearchPath CMAKE_LIBRARY_PATH "$1/lib"
 }
 
 fixCmakeFiles() {

@paparodeo paparodeo marked this pull request as draft June 17, 2024 08:45
@paparodeo
Copy link
Contributor Author

so it used to just use CMAKE_{INCLUDE,LIBRARY}_PATH but that was changed in e0ff817#diff-a923f95cc35b1a7b2a5853e553cca08989536827d1b7f39942e034c2627db7f7 to use CMAKE_PREFIX_PATH in 2010 but perhaps things have changed enough since then to make it work.

@AndersonTorres
Copy link
Member

so it used to just use CMAKE_{INCLUDE,LIBRARY}_PATH but that was changed in e0ff817#diff-a923f95cc35b1a7b2a5853e553cca08989536827d1b7f39942e034c2627db7f7 to use CMAKE_PREFIX_PATH in 2010 but perhaps things have changed enough since then to make it work.

This is clearly KDE-specific. Should it be "generalized" outside KDE?

@paparodeo
Copy link
Contributor Author

paparodeo commented Jun 17, 2024

with a modified cmake setup-hooks only specifying CMAKE_LIBRARY_PATH and CMAKE_INCLUDE PATH i was getting failures with openexr_3

CMake Warning at cmake/OpenEXRSetup.cmake:272 (find_package):
  By not providing "FindImath.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Imath", but
  CMake did not find one.

  Could not find a package configuration file provided by "Imath" (requested
  version 3.1) with any of the following names:

    ImathConfig.cmake
    imath-config.cmake

and after a bit of trial and error i found that after adding addToSearchPath CMAKE_PREFIX_PATH "$1/lib/cmake" cmake found the module and the build succeeded.

addCMakeParams() {
    addToSearchPath CMAKE_INCLUDE_PATH "$1/include"
    # [edit 4]
    addToSearchPath CMAKE_INCLUDE_PATH "$1"
    addToSearchPath CMAKE_LIBRARY_PATH "$1/lib"
    # [edit 4]
    addToSearchPath CMAKE_LIBRARY_PATH "$1"
    addToSearchPath CMAKE_PREFIX_PATH "$1/lib/cmake"
    # [edit 1]
    addToSearchPath CMAKE_PREFIX_PATH "$1/share/cmake"
    # [edit 3] -- have not hit but looks like cmake would search here given $1
    addToSearchPath CMAKE_PREFIX_PATH "$1/lib"
    # [edit 2]
    addToSearchPath CMAKE_PREFIX_PATH "$1/share"
} 

this configuration also worked for zig / castxml when built with clangStdenv and strictDeps enabled -- actually for all 3 packages only having addToSearchPath CMAKE_PREFIX_PATH "$1/lib/cmake" was sufficient.

will try to build plasma-desktop again and see what happens.

[edit] needed share/cmake as vulkan-loader couldn't find vulkan-headers.
https://github.com/Kitware/CMake/blob/01a111d97f71cd9f5534e2cc36024209c6b34708/Source/cmFindPackageCommand.cxx#L2715
looks like there are a few more paths. lib{32,64,x32} and lib/ARCH whatever ARCH expands to

[edit2] need just share as extra-cmake-modules installs in share/ECM. kdePackages.attica breaks if not set, probably others too.

[edit3] CMAKE_PREFIX_PATH should have $1/lib/cmake, $1/lib/share, $1/lib $1/share

[edit 4] saw failures that required CMAKE_{LIBRARY,INCLUDE}_PATH to also just be set to $1

@paparodeo paparodeo changed the title cmake: use full path for c/c++ compilers (fix strictDeps) cmake: ~use full path for c/c++ compilers~ (fix strictDeps) Jun 18, 2024
@paparodeo paparodeo changed the title cmake: ~use full path for c/c++ compilers~ (fix strictDeps) cmake: wip (fix strictDeps) Jun 18, 2024
@paparodeo
Copy link
Contributor Author

paparodeo commented Jun 18, 2024

was not finding pkgconfig in some cases (plasma5Packages.libksysguard) so switched strategy and just patched out using bin as a prefix if NIXPKGS_CMAKE_DISABLE_BIN_PREFIX is set, and set it when calling cmake as part of the configure. kind of gross but does the trick.

[edit] can fix plasma5Packages.libksysguard with the old (non c++) patch. pkgconfig worked fine but had its own custom FindNL.cmake code which searches for headers / libraries using include and lib which made the paths in CMAKE_INCLUDE_PATH look like path-dev/include/include. so made sure CMAKE_INCLUDE_PATH, etc, needs to contain the bare path-dev as well -- same goes fro CMAKE_LIBRARY_PATH.

@paparodeo
Copy link
Contributor Author

last change removed the cmake patch in favor of modifying addCMakeParams with various paths found mostly via trial and error and looking over the cmake source.

Copy link
Member

@AndersonTorres AndersonTorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nicer!

@SomeoneSerge
Copy link
Contributor

changed ... to use CMAKE_PREFIX_PATH in 2010 but perhaps things have changed enough since then to make it work.

This is mainly used for find_package (*Config.cmake files) and it was big surprise to us in #329452 that it also affects find_program

@AndersonTorres
Copy link
Member

IMO propagation is overused in Qt

A long time ago it was recommended to me "avoid propagated*" in a Python package.

Is there anything documenting these things in a more practical way?

@eclairevoyant
Copy link
Contributor

eclairevoyant commented Jul 30, 2024

Well it was just my opinion 😅 I found it very difficult to reason about dependencies when I was trying to fix strictDeps in Qt a while back, since I didn't know where they were coming from. I don't know of it being documented.

@SomeoneSerge
Copy link
Contributor

SomeoneSerge commented Jul 30, 2024

A long time ago it was recommended to me "avoid propagated*" in a Python package.

Not exactly on-topic, but pythonXPackages now use pyproject.toml-style build-system and dependencies attributes, the latter temporarily mapped into propagatedBuildInputs but will be hopefully later replaced with the retained/python3.withPackages-time composition on the evaluation side, which should reduce # of rebuilds and allow better conflict handling

@kjeremy
Copy link
Contributor

kjeremy commented Sep 25, 2024

We're pretty sure that this breaks nix-ros-overlay: lopsided98/nix-ros-overlay#491

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixpkgs-commit-that-mysteriously-broke-my-cmake-environment/52152/6

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixpkgs-commit-that-mysteriously-broke-my-cmake-environment/52152/7

wolfgangwalther added a commit to wolfgangwalther/nixpkgs that referenced this pull request Nov 23, 2024
@al3xtjames al3xtjames mentioned this pull request Mar 12, 2025
13 tasks
al3xtjames added a commit to al3xtjames/nixpkgs that referenced this pull request Apr 13, 2025
strictDeps works with Clang after NixOS#318226.
@sielicki
Copy link
Contributor

is there a reason this had to define a custom nix envvar, instead of just using the generic CMAKE_SYSTEM_* variables that already exist?

@SomeoneSerge
Copy link
Contributor

@sielicki I think these two messages reflect the knowledge we've had at the moment:

We sought how other projects (cmake, vcpkg, connan) approach this problem but cut the search short and went for paparodeo's patch as interim solution to cross issues. I don't think we were aware of CMAKE_SYSTEM_IGNORE_PREFIX_PATH which seems relevant. A PR removing the patch, while keeping the build-host separation behave correctly, would be welcomed by all parties?

As you bring this up, I'll start listing some side considerations again:

Details
  • our approach to configuring CMake (wlog) is poorly compatible with dev shells,
    • e.g. because we don't separate input configuration from CMAKE_INSTALL_*_PATHs,
    • and because it's cumbersome to teach IDEs about our variables (I'm fine with compile_commands.json, but at some point I had to deal with people insisting on using VScode, and on making it "windows-like", whatever that means),
    • as we're moving towards __structuredAttrs, we're getting less compatible with direnv.
    • I think the way to approach this is by implementing a Vcpkg-like UX: accumulate all dependency configuration and flags (other than *INSTALL*) in a toolchain file instead of in environment variables.
  • mutable source directory leads to /source/build/ references in -g debug flags, breaking source listings

@sielicki
Copy link
Contributor

I think the way to approach this [is to] accumulate all dependency configuration and flags (other than INSTALL) in a toolchain file instead of in environment variables.

Totally agree on this overall idea. Recent cmake releases have a lot of new features to make this easier.

  1. cmake_pkg_config landed in 3.31, which allows cmake to parse .pc files in a way that's totally native to cmake, ie: without relying on any 3rd-party pkg-config binary. You can also invoke this on the command line with cmake --find-package. We need to review the environment variables being used there to make sure the defaults are cross-safe.
  2. CMake dependency providers landed in 3.24. This lets you intercept FetchContent and find_package calls at configure time, fulfilling them however you'd like. We should be able to create a fixed output representing the cache (similar to cargoHash/pnpmHash/etc.) by writing a nix dependency provider. I came across cmake-tipi-provider which gives a good idea of what it would need to look like.
  3. Along the same lines, there's now the cmake-file-api which lets you discover targets in a portable way, again at configure time. We just need a hook that creates a .cmake/api/v1/query/client-nix_cmake_hook/query.json in cmake build directories, and then write something which can walk the result and map it to nixisms. This could let us do a bunch of interesting things: detecting all the targets, detecting test targets, detecting configuration flags, discerning between generated files and project source files for better source filtering, cheaply constructing compile_commands.json for nix derivations without requiring a build to take place, etc.
  4. the whole reason that I was looking at this PR in the first place was that I was thinking about CPS and how it could be implemented in nixpkgs. CMake is now capable of finding packages through cps. I'm not sure how it fits into nixpkgs today, but it's worth thinking about.

We sought how other projects (cmake, vcpkg, connan) approach this problem but cut the search short and went for paparodeo's patch as interim solution to cross issues. I don't think we were aware of CMAKE_SYSTEM_IGNORE_PREFIX_PATH which seems relevant. A PR removing the patch, while keeping the build-host separation behave correctly, would be welcomed by all parties?

I can try to put that together -- just having trouble understanding exactly how these variables are used, and what stands to break.

@paparodeo
Copy link
Contributor Author

is there a reason this had to define a custom nix envvar, instead of just using the generic CMAKE_SYSTEM_* variables that already exist?

yes, because they don't work. IIRC the ignore_xxx_path will also ignore things in PATH which is not what we want.

@sielicki
Copy link
Contributor

yes, because they don't work.

Is there an upstream issue?

It's mentioned elsewhere in the cmake docs, but not on these specific doc pages, that these variables are semicolon separated and not colon-separated like normal search paths. So you need to use addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_* "$@", etc.

Here's a patch I have locally, but I need to test it more to see what breaks:

9f3110649578b2f7c8bff356570e97138c3ffc10
Author:     Nicholas Sielicki <[email protected]>
AuthorDate: Sun Apr 20 23:16:39 2025 -0700
Commit:     Nicholas Sielicki <[email protected]>
CommitDate: Sun Apr 20 23:18:35 2025 -0700

remove a cmake patch

5 files changed, 22 insertions(+), 57 deletions(-)
.../cm/cmake/000-nixpkgs-cmake-prefix-path.diff    | 28 ------------------
pkgs/by-name/cm/cmake/package.nix                  |  3 --
pkgs/by-name/cm/cmake/setup-hook.sh                | 33 ++++++++++++++--------
.../me/meson/000-nixpkgs-cmake-prefix-path.patch   | 12 --------
pkgs/by-name/me/meson/package.nix                  |  3 --

deleted    pkgs/by-name/cm/cmake/000-nixpkgs-cmake-prefix-path.diff
@@ -1,28 +0,0 @@
-diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
-index 8840cdcb..c34b7ee9 100644
---- a/Source/cmFindBase.cxx
-+++ b/Source/cmFindBase.cxx
-@@ -280,6 +280,11 @@ void cmFindBase::FillCMakeEnvironmentPath()
-   // Add CMAKE_*_PATH environment variables
-   std::string var = cmStrCat("CMAKE_", this->CMakePathName, "_PATH");
-   paths.AddEnvPrefixPath("CMAKE_PREFIX_PATH");
-+  if (this->CMakePathName != "PROGRAM") {
-+    // Like CMAKE_PREFIX_PATH except when searching for programs. Programs need
-+    // to be located via PATH
-+    paths.AddEnvPrefixPath("NIXPKGS_CMAKE_PREFIX_PATH");
-+  }
-   paths.AddEnvPath(var);
- 
-   if (this->CMakePathName == "PROGRAM") {
-diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
-index 9b51b1ad..6acc676c 100644
---- a/Source/cmFindPackageCommand.cxx
-+++ b/Source/cmFindPackageCommand.cxx
-@@ -2039,6 +2039,7 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
- 
-   // And now the general CMake environment variables
-   paths.AddEnvPath("CMAKE_PREFIX_PATH");
-+  paths.AddEnvPath("NIXPKGS_CMAKE_PREFIX_PATH");
-   if (this->DebugMode) {
-     debugBuffer = cmStrCat(debugBuffer,
-                            "CMAKE_PREFIX_PATH env variable "
modified   pkgs/by-name/cm/cmake/package.nix
@@ -59,9 +59,6 @@ stdenv.mkDerivation (finalAttrs: {
 
   patches =
     [
-      # Add NIXPKGS_CMAKE_PREFIX_PATH to cmake which is like CMAKE_PREFIX_PATH
-      # except it is not searched for programs
-      ./000-nixpkgs-cmake-prefix-path.diff
       # Don't search in non-Nix locations such as /usr, but do search in our libc.
       ./001-search-path.diff
     ]
modified   pkgs/by-name/cm/cmake/setup-hook.sh
@@ -1,8 +1,11 @@
-addCMakeParams() {
-    # NIXPKGS_CMAKE_PREFIX_PATH is like CMAKE_PREFIX_PATH except cmake
-    # will not search it for programs
-    addToSearchPath NIXPKGS_CMAKE_PREFIX_PATH $1
-}
+addCmakeSystemAppbundlePath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_APPBUNDLE_PATH "$@" ; }
+addCmakeSystemFrameworkPath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_FRAMEWORK_PATH "$@" ; }
+addCmakeSystemIgnorePath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_IGNORE_PATH "$@" ; }
+addCmakeSystemIgnorePrefixPath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_IGNORE_PREFIX_PATH "$@" ; }
+addCmakeSystemIncludePath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_INCLUDE_PATH "$@" ; }
+addCmakeSystemLibraryPath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_LIBRARY_PATH "$@" ; }
+addCmakeSystemPrefixPath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_PREFIX_PATH "$@" ; }
+addCmakeSystemProgramPath() { addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_PROGRAM_PATH "$@" ; }
 
 fixCmakeFiles() {
     # Replace occurences of /usr and /opt by /var/empty.
@@ -147,7 +150,15 @@ if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
     configurePhase=cmakeConfigurePhase
 fi
 
-addEnvHooks "$targetOffset" addCMakeParams
+addEnvHooks "$targetOffset" \
+    addCmakeSystemAppbundlePath \
+    addCmakeSystemFrameworkPath \
+    addCmakeSystemIgnorePath \
+    addCmakeSystemIgnorePrefixPath \
+    addCmakeSystemIncludePath \
+    addCmakeSystemLibraryPath \
+    addCmakeSystemPrefixPath \
+    addCmakeSystemProgramPath
 
 makeCmakeFindLibs() {
     isystem_seen=
@@ -155,22 +166,22 @@ makeCmakeFindLibs() {
     for flag in ${NIX_CFLAGS_COMPILE-} ${NIX_LDFLAGS-}; do
         if test -n "$isystem_seen" && test -d "$flag"; then
             isystem_seen=
-            addToSearchPath CMAKE_INCLUDE_PATH "${flag}"
+            addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_INCLUDE_PATH "${flag}"
         elif test -n "$iframework_seen" && test -d "$flag"; then
             iframework_seen=
-            addToSearchPath CMAKE_FRAMEWORK_PATH "${flag}"
+            addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_FRAMEWORK_PATH "${flag}"
         else
             isystem_seen=
             iframework_seen=
             case $flag in
             -I*)
-                addToSearchPath CMAKE_INCLUDE_PATH "${flag:2}"
+                addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_INCLUDE_PATH "${flag:2}"
                 ;;
             -L*)
-                addToSearchPath CMAKE_LIBRARY_PATH "${flag:2}"
+                addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_LIBRARY_PATH "${flag:2}"
                 ;;
             -F*)
-                addToSearchPath CMAKE_FRAMEWORK_PATH "${flag:2}"
+                addToSearchPathWithCustomDelimiter ";" CMAKE_SYSTEM_FRAMEWORK_PATH "${flag:2}"
                 ;;
             -isystem)
                 isystem_seen=1
deleted    pkgs/by-name/me/meson/000-nixpkgs-cmake-prefix-path.patch
@@ -1,12 +0,0 @@
-diff --git a/mesonbuild/dependencies/data/CMakePathInfo.txt b/mesonbuild/dependencies/data/CMakePathInfo.txt
-index 662ec58..4d5f4e4 100644
---- a/mesonbuild/dependencies/data/CMakePathInfo.txt
-+++ b/mesonbuild/dependencies/data/CMakePathInfo.txt
-@@ -5,6 +5,7 @@ list(APPEND TMP_PATHS_LIST ${CMAKE_PREFIX_PATH})
- list(APPEND TMP_PATHS_LIST ${CMAKE_FRAMEWORK_PATH})
- list(APPEND TMP_PATHS_LIST ${CMAKE_APPBUNDLE_PATH})
- list(APPEND TMP_PATHS_LIST $ENV{CMAKE_PREFIX_PATH})
-+list(APPEND TMP_PATHS_LIST $ENV{NIXPKGS_CMAKE_PREFIX_PATH})
- list(APPEND TMP_PATHS_LIST $ENV{CMAKE_FRAMEWORK_PATH})
- list(APPEND TMP_PATHS_LIST $ENV{CMAKE_APPBUNDLE_PATH})
- list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_PREFIX_PATH})
modified   pkgs/by-name/me/meson/package.nix
@@ -25,9 +25,6 @@ python3.pkgs.buildPythonApplication rec {
   };
 
   patches = [
-    # Nixpkgs cmake uses NIXPKGS_CMAKE_PREFIX_PATH for the search path
-    ./000-nixpkgs-cmake-prefix-path.patch
-
     # In typical distributions, RPATH is only needed for internal libraries so
     # meson removes everything else. With Nix, the locations of libraries
     # are not as predictable, therefore we need to keep them in the RPATH.

@paparodeo
Copy link
Contributor Author

yes, because they don't work.

Is there an upstream issue?

I apologize -- I have no idea what you're trying to do. please test your change and open a new PR. the 80 some comments in this PR log the various methods I tried and why we ended up with the cmake patch. To test the various changes I looked at all the packages which had cmake in the nativeBuildInputs and then built most of them.

looking over your patch I am pretty sure it doesn't work given these are cmake variables you're modifying and not env vars and you're not passing them via -D on the command line to cmake.

I'd ask if you even tried your patch to see if anything works but I don't think that a response belongs in this PR comments and you need to open up a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants