1 |
We previously set CMAKE_FIND_ROOT_PATH, but CMAKE_SYSROOT also sets this |
2 |
and more. The latter is needed when cross-compiling Fortran code such as |
3 |
sci-libs/lapack. Without this, it uses the toolchain's default sysroot, |
4 |
adds a -L/usr/${CHOST}/usr/lib flag based on that, reads the libc.so.6 |
5 |
ld script from this directory, does not apply any sysroot to the paths |
6 |
within because the script is outside the sysroot, and finally fails when |
7 |
attempting to link the host's libc.so.6. |
8 |
|
9 |
Signed-off-by: James Le Cuirot <chewi@g.o> |
10 |
--- |
11 |
eclass/cmake.eclass | 2 +- |
12 |
1 file changed, 1 insertion(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass |
15 |
index 2c5620adede5..a2ff80a233b4 100644 |
16 |
--- a/eclass/cmake.eclass |
17 |
+++ b/eclass/cmake.eclass |
18 |
@@ -489,7 +489,7 @@ cmake_src_configure() { |
19 |
# When cross-compiling with a sysroot (e.g. with crossdev's emerge wrappers) |
20 |
# we need to tell cmake to use libs/headers from the sysroot but programs from / only. |
21 |
cat >> "${toolchain_file}" <<- _EOF_ || die |
22 |
- set(CMAKE_FIND_ROOT_PATH "${SYSROOT}") |
23 |
+ set(CMAKE_SYSROOT "${ESYSROOT}") |
24 |
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
25 |
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
26 |
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
27 |
-- |
28 |
2.39.1 |