Wow, what a lengthy email :) On Tue, 1 Dec 2015 22:58:55 +0000 James Le Cuirot <ch...@gentoo.org> wrote: [...] > > I raised one further point with mgorny that he feels could potentially > go into EAPI 7 but I think could remain an implementation detail. In > cases #3 and #4 (basically when ROOT != / and > PORTAGE_CONFIGROOT != /), the toolchain needs to know how to source > headers and libraries from ROOT instead of /.
Use SYSROOT. ROOT has nothing to do with building. This should be defined in PMS though. > gcc and friends support a --sysroot argument. It used to be the case > that this didn't work on a toolchain configured without a sysroot, > possibly creating issues for #4, but I've tested and it now works > regardless. $ gcc --sysroot=/tmp/foo -I/usr/include foo.c /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: this linker was not configured to use sysroots collect2: error: ld returned 1 exit status Two problems here: 1. link fails 2. gcc doesn't warn for -I/usr/include with sysroot (iirc crossdev's gcc do) [...] > CMake supports a CMAKE_SYSROOT argument that you set in the toolchain > file. We currently don't set this but it could easily be added to > cmake-utils.eclass as well as (or instead of?) the similar variables > that we already do set. iirc, CMAKE_SYSROOT is only for your case #4 and behaves more like 'build as if I had chrooted in CMAKE_SYSROOT' and thus doesn't help at all for cross-compilation > The vast majority of configure scripts (using libtool and not ancient) > support a --with-sysroot argument that can easily be detected by > grepping for lt_sysroot. The behaviour of econf is largely defined by > PMS, hence why mgorny thinks this particular detail could go into > EAPI 7, but it only says which arguments must be passed and doesn't > say that the PM can't pass additional ones. I don't wish this force > this stuff upon Paludis and pkgcore unnecessarily. This could help your case #4. Or, e.g., stage building: https://bugs.gentoo.org/show_bug.cgi?id=563034 toolchain's sysroot seems way more reliable though [...] Alexis.