Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 142918 - emerge shows incorrect USE flags with PORTAGE_CONFIGROOT
Summary: emerge shows incorrect USE flags with PORTAGE_CONFIGROOT
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 137867 136244
  Show dependency tree
 
Reported: 2006-08-05 13:33 UTC by Richard Fish
Modified: 2006-08-06 21:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
strace output of open config files (emerge-strace-open-confs.txt,5.53 KB, text/plain)
2006-08-05 13:36 UTC, Richard Fish
Details
emerge --info of host (emerge--info-host.txt,2.07 KB, text/plain)
2006-08-05 13:37 UTC, Richard Fish
Details
emerge --info of target (emerge--info-target.txt,2.30 KB, text/plain)
2006-08-05 13:38 UTC, Richard Fish
Details
separate USE flags for / and $ROOT (use.patch,2.50 KB, patch)
2006-08-05 19:37 UTC, Zac Medico
Details | Diff
build output of world update with ROOT and PORTAGE_CONFIGROOT (emerge-world-with-root-and-confroot.txt,20.49 KB, text/plain)
2006-08-05 22:22 UTC, Richard Fish
Details
build output of world update with ROOT, CONFIGROOT, and CHOST (emerge-world-with-root-and-confroot-and-chost.txt,20.18 KB, text/plain)
2006-08-05 22:22 UTC, Richard Fish
Details
build output of package with ROOT and PORTAGE_CONFIGROOT (emerge-pkg-with-root-and-confroot.txt,20.76 KB, text/plain)
2006-08-05 22:24 UTC, Richard Fish
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Fish 2006-08-05 13:33:13 UTC
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.
Comment 1 Richard Fish 2006-08-05 13:36:31 UTC
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".
Comment 2 Richard Fish 2006-08-05 13:37:24 UTC
Created attachment 93541 [details]
emerge --info of host

emerge --info without PORTAGE_CONFIGROOT or ROOT
Comment 3 Richard Fish 2006-08-05 13:38:09 UTC
Created attachment 93542 [details]
emerge --info of target

emerge --info with PORTAGE_CONFIGROOT and ROOT
Comment 4 Zac Medico gentoo-dev 2006-08-05 19:12:02 UTC
(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.
Comment 5 Zac Medico gentoo-dev 2006-08-05 19:37:38 UTC
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.
Comment 6 Richard Fish 2006-08-05 22:22:21 UTC
Created attachment 93570 [details]
build output of world update with ROOT and PORTAGE_CONFIGROOT
Comment 7 Richard Fish 2006-08-05 22:22:59 UTC
Created attachment 93571 [details]
build output of world update with ROOT, CONFIGROOT, and CHOST
Comment 8 Richard Fish 2006-08-05 22:24:17 UTC
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.
Comment 9 Zac Medico gentoo-dev 2006-08-05 23:44:01 UTC
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.
Comment 10 Zac Medico gentoo-dev 2006-08-06 04:18:25 UTC
The USE flags patch (svn r4177) has been released in 2.1.1_pre4-r4.
Comment 11 Richard Fish 2006-08-06 12:07:40 UTC
(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.
Comment 12 Zac Medico gentoo-dev 2006-08-06 14:51:10 UTC
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.
Comment 13 Richard Fish 2006-08-06 21:32:14 UTC
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.