[bug#36477,v3,04/48] gnu: cmake: Fix cross-compilation.
diff mbox series

Message ID 87d0gg2p30.fsf@gnu.org
State New
Headers show
  • Untitled series #1720
Related show

Commit Message

Ludovic Courtès Sept. 4, 2019, 1 p.m. UTC
Mathieu Othacehe <m.othacehe@gmail.com> skribis:

> * gnu/packages/cmake.scm (cmake-minimal-cross): New package.
> * guix/build-system/cmake.scm (default-cmake): Add new target argument and use
> it to select cmake-minimal or cmake-minimal-cross.
> (lower): Pass target to default-cmake.
> ---
>  gnu/packages/cmake.scm      | 8 ++++++++
>  guix/build-system/cmake.scm | 9 ++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
> diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
> index 1d8d829ec5..9bf0273f00 100644
> --- a/gnu/packages/cmake.scm
> +++ b/gnu/packages/cmake.scm
> @@ -207,6 +207,14 @@ and workspaces that can be used in the compiler environment of your choice.")
>      (outputs '("out" "doc"))
>      (properties (alist-delete 'hidden? (package-properties cmake-minimal)))))
> +(define-public cmake-minimal-cross
> +  (package
> +    (inherit cmake-minimal)
> +    (name "cmake-minimal-cross")
> +    (native-search-paths '())
> +    (search-paths
> +     (package-native-search-paths cmake-minimal))))

It seems to be enough to just add ‘search-paths’ to ‘cmake’:
… and it doesn’t trigger a full rebuild.

Please push that to ‘master’ if it works for you!



Mathieu Othacehe Sept. 20, 2019, 2:18 p.m. UTC | #1
Hey Ludo,

> It seems to be enough to just add ‘search-paths’ to ‘cmake’:

I tried to do that but it doesn't work. Let's consider libgit2 which
uses cmake, when cross-compiling, both native-search-paths and
search-paths are set. Both are passed to bag-build in

Then, gnu-build is called from cmake-build and "set-paths" function is
called. "set-path-environment-variable" is called for CMAKE_PREFIX_PATH
which is in search-paths and then called again for CMAKE_PREFIX_PATH in

The later will cause the first setenv to be undone, and we end-up with
only native-inputs in CMAKE_PREFIX_PATH variable.

Whereas, with my patch only search-paths is set, so it can't be "undone"
by native-search-paths. CMAKE_PREFIX_PATH is filled with only "inputs"
which is what is expected.

I hope I'm clear and I'm sorry to reply so late, didn't have any slack
in my day job :(




diff mbox series

diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 7186cf98df..9f517238a0 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -151,6 +151,7 @@ 
      (list (search-path-specification
             (variable "CMAKE_PREFIX_PATH")
             (files '("")))))
+    (search-paths native-search-paths)
     (home-page "https://cmake.org/")
     (synopsis "Cross-platform build system")