Currently, by the official cross-compiling documentation for Gentoo, cross-compiled packages end up in /usr/CHOST. - There is already a libc (and linux-headers) present there, so it is impossible to build a libc the usual way. This libc is package-managed as part of the host, not the target. Effectively, it is impossible to update it from a binary package after the target is deployed. - If somebody wants a clean start, "rm -rf /usr/CHOST" will also remove toolchain components and crossdev will have to be run again. - It is not possible to keep more than one cross-root for the same platform. All this can be solved if the target system is built into a folder separate from /usr/CHOST. However, to do that, gcc and g++ have to be called with "--sysroot <target_root>". This is required to make the compiler/linker look for header/library files within the target root, instead of /usr/CHOST. Because of the significant number of packages that ignore CFLAGS or LDFLAGS, a compiler wrapper which takes care of --sysroot is very useful. So, my cross-emerge-ng tool does the following: 1. Sets CBUILD, ROOT and PORTAGE_CONFIGROOT (to be used by emerge and ebuilds). 2. Sets CROSS_CHOST. This tells the compiler wrappers which cross-compilers they're supposed to call. (if the wrapper just read CHOST, it would break a package changes CHOST, which is not unexpected) 3. Sets CC and CXX to the compiler wrappers (chost-gcc and chost-g++). Compared to the existing "cross-emerge" tool (which cannot wrap compilers), "cross-emerge-ng" does not do anything else than mentioned above (and which I have found unnecessary). Note that cross-emerge-ng originated as part of the cross-compile overlay+instructions which I maintain ( http://code.google.com/p/ambro-cross-overlay/ ). It is very useful at this point; it is possible to cross-compile a complete @system and many other packages. Reproducible: Always
Created attachment 331622 [details] cross-emerge-ng The cross-emerge-ng tool itself, goes into wrappers/ in crossdev source.
Created attachment 331624 [details] toolchain-wrapper The toolchain wrapper, goes into wrappers/ as well.
Created attachment 331626 [details, diff] crossdev-20120721-cross-emerge-ng.patch Makefile patch to install the new tools.
Steev and I don't get enough email
relying on the env to not change won't help you. cmake and other packages will clear the environment automatically thus nuking CROSS_CHOST.
(In reply to comment #5) > relying on the env to not change won't help you. cmake and other packages > will clear the environment automatically thus nuking CROSS_CHOST. I haven't seen a single package do this. It works for cmake packages all right.
(In reply to comment #6) sorry, i meant scons, not cmake. the point still stands -- relying on the environment is not going to work.
Created attachment 331686 [details] cross-emerge-ng This updated cross-emerge-ng automatically generates wrappers into SYSROOT/etc/crossdev-target with hardcoded CHOST and SYSROOT. Note that I wish that cross-emerge-ng exists a separate tool intended to be used only with standalone SYSROOT (!=/usr/CHOST), instead of adding features to cross-emerge. For example, cross-emerge currently calls emerge with --root-deps=rdeps, which will ignore all build-time dependencies. I should say again that cross-emerge-ng, together with the fixes in my overlay, can successfully build the entire @system and many other packages.
Created attachment 331688 [details] toolchain-wrapper
Created attachment 331690 [details, diff] crossdev-20120913-cross-emerge-ng.patch
Created attachment 331692 [details] cross-emerge-ng Sorry, posted the wrong file previously.
Created attachment 331694 [details] toolchain-wrapper Sorry, posted the wrong file previously.
*** Bug 466128 has been marked as a duplicate of this bug. ***