When running a command such as: ROOT=/mnt/cross/ PORTAGE_CONFIGROOT=/mnt/cross/ emerge -DNuvp world portage uses the make.conf and related configuration files from the host system, instead of the target. ~ > export ROOT=/mnt/carcharias/ ~ > export PORTAGE_CONFIGROOT=$ROOT ~ > emerge -Dvp kde-base/kdelibs | grep kde-base/kdelibs [ebuild N ] kde-base/kdelibs-3.5.4 to /mnt/carcharias/ USE="alsa arts cups fam kdeenablefinal kdehiddenvisibility spell ssl tiff -acl -debug -doc -jpeg2k -kerberos -legacyssl -openexr -xinerama -zeroconf" 15,087 kB Compare the above to: ~ > emerge -DNuvp world | grep kde-base/kdelibs [ebuild U ] kde-base/kdelibs-3.5.4 [3.5.3-r4] USE="acl alsa cups kdeenablefinal kdehiddenvisibility spell ssl -arts -debug -doc -fam -jpeg2k -kerberos -legacyssl -openexr -tiff -xinerama -zeroconf" 15,087 kB [ebuild N ] kde-base/kdelibs-3.5.4 to /mnt/carcharias/ USE="acl alsa cups kdeenablefinal kdehiddenvisibility spell ssl -arts -debug -doc -fam -jpeg2k -kerberos -legacyssl -openexr -tiff -xinerama -zeroconf" 0 kB Notice the changes to the arts and fam use flags for the world update. Moreover, doing a world update with PORTAGE_CONFIGROOT ends up using the KEYWORDS and CFLAGS from the host's make.conf. The strace output shows that /mnt/carcharias/etc/make.conf is indeed opened, but so is /etc/make.conf.
Created attachment 93540 [details] strace output of open config files This was generated by running strace -e open -o strace.out -f emerge -DNuvp world with the PORTAGE_CONFIGROOT and ROOT variables set to /mnt/carcharias, and then running "grep -e /etc/portage -e /etc/make.conf strace.out".
Created attachment 93541 [details] emerge --info of host emerge --info without PORTAGE_CONFIGROOT or ROOT
Created attachment 93542 [details] emerge --info of target emerge --info with PORTAGE_CONFIGROOT and ROOT
(In reply to comment #0) > Moreover, doing a world update with PORTAGE_CONFIGROOT ends up using the > KEYWORDS and CFLAGS from the host's make.conf. Are you sure about that? There is a bug the display code that causes the wrong flags to be displayed. If the display bug is the only problem, the build should proceed with the correct config.
Created attachment 93565 [details, diff] separate USE flags for / and $ROOT This corrects the problem with incorrect USE flags. This problem affects both display and dependency calculation, but nothing else.
Created attachment 93570 [details] build output of world update with ROOT and PORTAGE_CONFIGROOT
Created attachment 93571 [details] build output of world update with ROOT, CONFIGROOT, and CHOST
Created attachment 93572 [details] build output of package with ROOT and PORTAGE_CONFIGROOT (In reply to comment #4) > (In reply to comment #0) > > Moreover, doing a world update with PORTAGE_CONFIGROOT ends up using the > > KEYWORDS and CFLAGS from the host's make.conf. > > Are you sure about that? Yes. Sorry about the 3 new and large attachments, but I think it helps to see the config output as well. The emerge-world-with-root-and-confroot.txt is what happens for emerge -DNuv world, which uses both the wrong compiler and wrong CFLAGS. The wrong compiler can be fixed by giving CHOST as seen in the emerge-world-with-root-and-confroot-and-chost.txt, but this still uses the wrong CFLAGS. The emerge-pkg-with-root-and-confroot.txt shows the emerge -v --pretend sys-libs/db, with both the correct compiler and correct CFLAGS.
Do you use crossdev to build your toolchain? Are you following a guide like http://arcanux.org/guidexml/cross-development.html or something? I haven't actually tried cross compiling anything lately but small tests, such as 'echo $CHOST' in /etc/portage/bashrc seem to show that portage loads the correct config files for me. One thing to be careful of is that environment variables in the calling environment will override the values in make.conf. If the problem that you're experiencing is a portage bug then I would have expected to be reported sooner, considering that there seem to be lots of other people that use it for cross compiling. I'll have to build a cross toolchain to see if I can actually reproduce your problem.
The USE flags patch (svn r4177) has been released in 2.1.1_pre4-r4.
(In reply to comment #9) > Do you use crossdev to build your toolchain? Yeah, I used crossdev. I just followed http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO. If you are reasonably confident that this is something that is specific to my system, then don't spend a lot of time trying to duplicate it. I will try to debug it today and see what I can find.
Please file a new bug if you are able to determine that portage is not setting up the environment correctly. I'm closing this one as fixed for the USE flags issue.
FYI, I was wrong about the environment stuff, just too inexperienced in cross-compiling I guess. I got confused because portage wanted to update or add some packages to my host system as well. In my attachments, sys-libs/db is being merged to /, not /mnt/carcharias. For things actually being merged to my ROOT, the correct CHOST and other settings _are_ being used.