Bootstrapping Prefix fails on my AMD64 linux box because of gcc-config: Type here what you want to wish me [luck] * Bootstrapping Gentoo prefixed portage installation using * host: x86_64-pc-linux-gnu * prefix: /home/cschwan/gentoo * ready to bootstrap stage3 /home/cschwan/gentoo/usr/bin/gcc-config: line 79: /home/cschwan/gentoo/etc/env.d/gcc/config-x86_64-pc-linux-gnu: No such file or directory Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'rootuid' * gcc-config: Must be root The next ebuild is net-tools which fails because gcc cannot find "linux/if_strip.h" - thats because is uses the non-prefixed gcc.
The installed gcc-config is 1.5-r2, emerge --info is: Portage 2.2.01.20837-prefix (prefix/linux/amd64, gcc-4.5.4, unavailable, 3.6.11-gentoo x86_64) ================================================================= System uname: Linux-3.6.11-gentoo-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_740_@_1.73GHz-with-gentoo-2.1 Timestamp of tree: Fri, 17 Aug 2012 21:54:54 +0000 app-shells/bash: 4.2_p10::gentoo_prefix sys-devel/binutils: 2.22-r1::gentoo_prefix sys-devel/gcc: 4.2.4-r01.4::gentoo_prefix sys-devel/gcc-config: 1.5-r2::gentoo_prefix sys-devel/make: 3.82::gentoo_prefix sys-kernel/linux-headers: 3.5::gentoo_prefix (virtual/os-headers) Repositories: gentoo_prefix ACCEPT_KEYWORDS="~amd64-linux" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CPPFLAGS="-I/home/cschwan/gentoo/usr/include -I/home/cschwan/gentoo/tmp/usr/include" CXXFLAGS="-O2 -pipe" DISTDIR="/home/cschwan/gentoo/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles force-prefix parallel-fetch parse-eapi-ebuild-head preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-L/home/cschwan/gentoo/usr/lib -Wl,-rpath=/home/cschwan/gentoo/usr/lib -L/home/cschwan/gentoo/lib -Wl,-rpath=/home/cschwan/gentoo/lib -L/home/cschwan/gentoo/tmp/usr/lib -Wl,-rpath=/home/cschwan/gentoo/tmp/usr/lib" PKGDIR="/home/cschwan/gentoo/usr/portage/packages" PORTAGE_CONFIGROOT="/home/cschwan/gentoo/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/home/cschwan/gentoo/var/tmp" PORTDIR="/home/cschwan/gentoo/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix" USE="amd64 bootstrap bzip2 cli cracklib crypt cxx dri iconv ipv6 mmx modules mudflap ncurses nptl openmp pppd prefix session sse sse2 tcpd unicode zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
I temporarily solved the problem - by removing line no. 246 in ${EPREFIX}/usr/bin/gcc-config: [[ $(id -u) != $(python -c 'import portage.const as c; print c.rootuid;') ]] && die_eerror "Must be root" - setting the compiler by hand using: ${EPREFIX}/usr/bin/gcc-config ${EPREFIX}/etc/env.d/gcc/x86_64-pc-linux-gnu-4.2.4 - and resuming the bootstraping. I am not sure though, how a proper fix for the line above would look like.
This seems to be troubled by your uid. Have you ever invoked the bootstrap.sh by root and then normal user, or vice versa? check $EPREFIX/usr/lib/portage/pym/portage/const_autotool.py $EPREFIX/etc/make.globals to see if your uid/gid is set properly.
- const_autotool.py: portagegroup = "users" portageuser = "cschwan" rootuser = "cschwan" rootuid = 1000 rootgid = 100 - make.globals: PORTAGE_USER='cschwan' PORTAGE_GROUP='users' PORTAGE_ROOT_USER='cschwan' PORTAGE_INST_UID="1000" PORTAGE_INST_GID="100" - id -u: 1000 Seems to match, does it not?
I think I found the problem: when I execute the following command: $EPREFIX/usr/bin/python -v -c 'import portage.const as c; print c.rootuid;' 2>&1 | grep const it outputs me: # $EPREFIX/usr/lib/python2.7/sre_constants.pyc matches $EPREFIX/usr/lib/python2.7/sre_constants.py import sre_constants # precompiled from $EPREFIX/usr/lib/python2.7/sre_constants.pyc # /usr/lib/portage/pym/portage/const.pyc matches /usr/lib/portage/pym/portage/const.py import portage.const # precompiled from /usr/lib/portage/pym/portage/const.pyc # cleanup[1] sre_constants # cleanup[2] portage.const So my prefixed python imports the python packages from my system instead of my prefix!?
Ah-ha, that's the problem. Try this: $EPREFIX/usr/bin/python -c "import sys; print sys.path" to see what python path is used. I have met with this problem before (resulting in gcc-config fail) but forgot how did I fixed it :(
Yep, the paths (the second one) are definitely wrong: ['', '/usr/lib/portage/pym', '/home/cschwan/gentoo/usr/lib/python27.zip', '/home/cschwan/gentoo/usr/lib/python2.7', '/home/cschwan/gentoo/usr/lib/python2.7/plat-linux2', '/home/cschwan/gentoo/usr/lib/python2.7/lib-tk', '/home/cschwan/gentoo/usr/lib/python2.7/lib-old', '/home/cschwan/gentoo/usr/lib/python2.7/lib-dynload', '/home/cschwan/gentoo/usr/lib/python2.7/site-packages', '/home/cschwan/gentoo/usr/lib/portage/pym']
I'm wondering where that /usr/lib/portage/pym comes from. Is it a bootstrapped python? or ebuild compiled one?
How do I find out? If I continue the bootstrap script, it updates portage, and begins to emerge net-tools and finally fails with the following error: Hmmmm, I was already afraid of this to happen. Running /home/cschwan/gentoo/bin/bash ./bootstrap-prefix.sh "/home/cschwan/gentoo" stage3 somewhere failed :( Details might be found in the build log: /home/cschwan/gentoo/var/tmp/portage/sys-apps/net-tools-1.60_p20120127084908/temp/build.log
I am currently trying the manual bootstrapping procedure. After stage1 the paths are already wrong (from $EPREFIX/tmp/usr/bin/python): ['', '/usr/lib/portage/pym', '/home/cschwan/gentoo_new/tmp/usr/lib/python27.zip', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7/plat-linux2', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7/lib-tk', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7/lib-old', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7/lib-dynload', '/home/cschwan/gentoo_new/tmp/usr/lib/python2.7/site-packages']
... and this in turn is because =sys-apps/portage-2.1.11.31 installs a file "/etc/env.d/05portage" which contains: PYTHONPATH="/usr/lib/portage/pym" Should the bootstrap script clean this variable from the environment?
"unset PYTHONPATH" solved the problem for me. Also, this is only needed for bootstrapping; the start script cleans env properly.
aha, so PYTHONPATH is set in the env? I guess then we can simply blacklist/filter it!
Thanks people, I committed the block.
Thanks a lot!
(In reply to comment #11) > ... and this in turn is because =sys-apps/portage-2.1.11.31 installs a file > "/etc/env.d/05portage" which contains: > > PYTHONPATH="/usr/lib/portage/pym" This did bite me too, and I'm wondering if that's on purpose. Actually, I do think this is a bug in Gentoo Linux (non-Prefix), as PYTHONPATH is in the same league as LD_LIBRARY_PATH. We've killed this league of variables in Prefix for good reason: They (have the power to) break everything - not just Prefix.
(In reply to comment #16) > (In reply to comment #11) > > ... and this in turn is because =sys-apps/portage-2.1.11.31 installs a file > > "/etc/env.d/05portage" which contains: > > > > PYTHONPATH="/usr/lib/portage/pym" > > This did bite me too, and I'm wondering if that's on purpose. Yes, because it allows third-party apps to import the portage module, even though it's not installed into site-packages for the current python version. > Actually, I do think this is a bug in Gentoo Linux (non-Prefix), as > PYTHONPATH is in the same league as LD_LIBRARY_PATH. We've killed this > league of variables in Prefix for good reason: They (have the power to) > break everything - not just Prefix. I don't know of any good alternatives for the way that we use PYTHONPATH. I would suggest for prefix portage to add its own PYTHONPATH entry in $EPREFIX/etc/env.d, so that you get that in your environment when you source $EPREFIX/etc/profile.
Gentoo's Python is patched for ages to include portage's pym path. So the PYTHONPATH env just makes that Portage's pym stuff comes first: % cat /etc/gentoo-release Gentoo Base System release 2.1 % env PYTHONPATH= python -c "import sys; print(sys.path)" ['', '/home/ruurd', '/usr/lib64/python32.zip', '/usr/lib64/python3.2', '/usr/lib64/python3.2/plat-linux2', '/usr/lib64/python3.2/lib-dynload', '/usr/lib64/python3.2/site-packages', '/usr/lib64/portage/pym'] % python -c "import sys; print(sys.path)" ['', '/usr/lib/portage/pym', '/usr/lib64/python32.zip', '/usr/lib64/python3.2', '/usr/lib64/python3.2/plat-linux2', '/usr/lib64/python3.2/lib-dynload', '/usr/lib64/python3.2/site-packages', '/usr/lib64/portage/pym'] % cat $EPREFIX/etc/gentoo-release Gentoo Prefix Base System release 2.2 % env PYTHONPATH= python -c "import sys; print(sys.path)" ['', '/net/ra/export/gentoo/prefix-tree/scripts', '/Library/Gentoo/usr/lib/python33.zip', '/Library/Gentoo/usr/lib/python3.3', '/Library/Gentoo/usr/lib/python3.3/plat-darwin', '/Library/Gentoo/usr/lib/python3.3/lib-dynload', '/Library/Gentoo/usr/lib/python3.3/site-packages', '/Library/Gentoo/usr/lib/portage/pym'] % python -c "import sys; print(sys.path)" ['', '/Library/Gentoo/usr/lib/portage/pym', '/Library/Gentoo/usr/lib/python33.zip', '/Library/Gentoo/usr/lib/python3.3', '/Library/Gentoo/usr/lib/python3.3/plat-darwin', '/Library/Gentoo/usr/lib/python3.3/lib-dynload', '/Library/Gentoo/usr/lib/python3.3/site-packages']
(In reply to comment #18) > Gentoo's Python is patched for ages to include portage's pym path. Yeah, /usr/lib* path are tricky due to multilib. Portage used to install in /usr/$(get_libdir), but has since moved to /usr/lib. Meanwhile, Gentoo's python may still be patched to add /usr/$(get_libdir)/portage/pym to the path. People on x32 systems had reported this problem. So, PYTHONPATH gives us more reliable results.
(In reply to comment #19) > So, PYTHONPATH gives us more reliable results. Moving forward, my plan is to install symlinks into site-packages for python versions selected via the PYTHON_TARGETS USE_EXPAND variable. I've added support for this to the portage-9999 ebuild: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-9999.ebuild?view=log#rev1.69