Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 543292 - cross-emerge: prestrip: don't rely on USERLAND variable, instead use USERLAND of host
Summary: cross-emerge: prestrip: don't rely on USERLAND variable, instead use USERLAND...
Status: RESOLVED OBSOLETE
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-14 11:54 UTC by i.Dark_Templar
Modified: 2023-10-18 17:31 UTC (History)
0 users

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


Attachments
crosdev-prepstrip.patch (crossdev-prepstrip.patch,593 bytes, patch)
2015-03-14 20:14 UTC, i.Dark_Templar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2015-03-14 11:54:48 UTC
I'm trying to crosscompile Gentoo/FreeBSD from my Gentoo/Linux box, and portae fails to cross-emerge any package with following error message:

stat: cannot read file system information for ‘%i’: No such file or directory

Looking through Portage code I've found following lines in file 'prepstrip':
if  [[ ${USERLAND} == BSD ]] ; then
        get_inode_number() { stat -f '%i' "$1"; }
else
        get_inode_number() { stat -c '%i' "$1"; }
fi

My host userland is GNU, but profile for crosscompilation specifies BSD userland and I didn't find a way to override this.

Reproducible: Always

Steps to Reproduce:
1. emerge -1 crossdev
2. install build dependencies for freebsd target
ACCEPT_KEYWORDS='**' emerge -1 sys-apps/mtree virtual/pmake
ACCEPT_KEYWORDS='**' emerge -1 =sys-freebsd/freebsd-mk-defs-9.2
3. make symlinks for compatibility with BSD userland:
ln -sv /bin/sed /bin/gsed
ln -sv /usr/bin/patch /usr/bin/gpatch
ln -sv /usr/bin/find /usr/bin/gfind
ln -sv /usr/bin/xargs /usr/bin/gxargs
4. Initialize crossdev environment
USE="-sanitize" crossdev -s4 --target i686-gentoo-freebsd9.2 --binutils 2.24-r3 --gcc 4.8.3 --libc '9.2' --with-headers --init-target
5. Fix this environment
sed -i -e 's:ACCEPT_KEYWORDS=\"x86 ~x86\":ACCEPT_KEYWORDS=\"x86-fbsd ~x86-fbsd\":' /usr/i686-gentoo-freebsd9.2/etc/portage/make.conf
ln -sv .. /usr/i686-gentoo-freebsd9.2/usr/i686-gentoo-freebsd9.2
rm /usr/i686-gentoo-freebsd9.2/etc/portage/make.profile
ln -sv /usr/portage/profiles/default/bsd/fbsd/x86/9.2 /usr/i686-gentoo-freebsd9.2/etc/portage/make.profile
6. Build crosscompilation tools:
USE="-sanitize" crossdev -s4 --target i686-gentoo-freebsd9.2 --binutils 2.24-r3 --gcc 4.8.3 --libc '9.2' --with-headers
7. try to emerge @system
emerge-i686-gentoo-freebsd9.2 -1av @system
Actual Results:  
emerge fails after install phase with error message:

stat: cannot read file system information for ‘%i’: No such file or directory

Expected Results:  
emerge should succeed

To clean after this you'd need to run:
1. crossdev -C i686-gentoo-freebsd9.2
2. remove symlinks (I just made a package for them)
rm -v /bin/gsed /usr/bin/gpatch /usr/bin/gfind /usr/bin/gxargs
3. run 'emerge --depclean -a'

I hope I didn't miss any steps
Comment 1 i.Dark_Templar 2015-03-14 11:57:03 UTC
HOST EMERGE INFO:
# emerge --info
Portage 2.2.14 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.19-r1, 3.14.33-gentoo.45 x86_64)
=================================================================
System uname: Linux-3.14.33-gentoo.45-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.2
KiB Mem:     4050856 total,   2182404 free
KiB Swap:    4192252 total,   4192252 free
Timestamp of tree: Fri, 13 Mar 2015 00:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.2_p53
dev-lang/perl:            5.20.1-r4
dev-lang/python:          2.7.9-r1, 3.4.1
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.11
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6-r1, 1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.4
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.18 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo rion sunrise local-overlay
Installed sets: @fortune, @kde, @lxqt, @pidgin, @psi
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --binpkg-respect-use=y --autounmask=n --complete-graph=y --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="binpkg-logs distlocks ebuild-locks fakeroot fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/ http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.bloodhost.ru/ http://mirror.mdfnet.se/gentoo ftp://mirror.mdfnet.se/gentoo http://gentoo.inode.at/ http://ftp.df.lth.se/pub/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp.halifax.rwth-aachen.de/gentoo/"
INSTALL_MASK=" /etc/systemd /lib*/systemd /lib*/tmpfiles.d /usr/lib*/systemd /usr/lib*/tmpfiles.d /usr/lib*/python*/test "
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/rion /var/lib/layman/sunrise /usr/local/portage"
SYNC=""
USE="X a52 aac acl acpi alsa amd64 amr apm ares bash-completion bidi bluetooth branding bzip2 c++0x cairo caps cdda cdio cdr cleartype cli consolekit cracklib crypt cue cups custom-cflags custom-optimization cxx dbus dga dirac dri dts dvd dvdr emboss encode exif faad fam fbcon ffmpeg firefox flac fontconfig fontforge freetype fribidi gcrypt gif glamor gme gmp gnutls gpm gtk iconv icu idn imlib inotify ipv6 jadetex jpeg kde lcms libass libdvdcss lzma lzo mad matroska midi mmap mmx mng modules mp3 mp4 mpeg mpi multilib ncurses network nfs nls nptl offensive ogg openal opengl openmp pango pch pcmcia pcntl pcre pdf pic plasma pm-utils png policykit posix postproc ppds private-headers projectm qt3support qt4 raw readline schroedinger session sftp sndfile sockets spell sse sse2 ssl startup-notification svg system-cairo system-icu system-jpeg system-libvpx system-sqlite tcpd tga theora threads tiff truetype udev udisks unicode upower usb utils v4l vaapi vdpau vorbis vpx wavpack wicd wifi wma wxwidgets x264 xattr xcb xcomposite xft xinerama xpm xscreensaver xv xvid zlib" ABI_X86="64 32" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" 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 ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en ru_RU en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby20" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="vesa vga nvidia" 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"
USE_PYTHON="2.7 3.4"
Unset:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


CROSS-COMPILATION TARGET EMERGE INFO:
# emerge-i686-gentoo-freebsd9.2 --info
Portage 2.2.14 (python 2.7.9-final-0, default/bsd/fbsd/x86/9.2, gcc-4.8.3, unavailable, 3.14.33-gentoo.45 x86_64)
=================================================================
System uname: Linux-3.14.33-gentoo.45-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.2
KiB Mem:     4050856 total,   2228268 free
KiB Swap:    4192252 total,   4192252 free
Timestamp of tree: Fri, 13 Mar 2015 00:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
Repositories: gentoo
ACCEPT_KEYWORDS="x86-fbsd ~x86-fbsd"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CHOST="i686-gentoo-freebsd9.2"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-march=i486 -O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr"
FFLAGS="-march=i486 -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/lib/systemd"
LANG="ru_RU.utf8"
LDFLAGS=""
PKGDIR="/usr/i686-gentoo-freebsd9.2/packages/"
PORTAGE_CONFIGROOT="/usr/i686-gentoo-freebsd9.2/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/usr/i686-gentoo-freebsd9.2/tmp/"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
USE="acl berkdb cracklib crypt cxx dri gdbm iconv ipv6 java5 java6 libav modules ncurses nls oss pcre python2 readline ssl tcpd unicode x86-fbsd zlib" ABI_X86="32" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="FreeBSD" 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 ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="BSD" VIDEO_CARDS="apm ark chips cirrus cyrix dummy i128 intel mach64 mga nv r128 radeon rendition s3 s3virge savage siliconmotion sis tga trident tseng vmware fbdev" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 2 i.Dark_Templar 2015-03-14 12:04:59 UTC
I see few ways to work around the issue: allow to override USERLAND from make.conf (thus I'd just set it to GNU and issue should gone), or somehow get USERLAND of host. I've seen code in portage guessing userland based on OS it runs on, maybe in case of crosscompilation this variable has to be forced to be calculated and not relied on value from profile.

I've forced my setup to use profile 'default/bsd/fbsd/x86/9.2' because other values are very useful, like contents of @system set.
Comment 3 Zac Medico gentoo-dev 2015-03-14 16:53:56 UTC
We can solve this by introducing a new environment variable to use here, perhaps PORTAGE_USERLAND. The value of this variable can come from the linux system's profile (profile for PORTAGE_CONFIGROOT=/).
Comment 4 i.Dark_Templar 2015-03-14 20:14:09 UTC
Created attachment 398920 [details, diff]
crosdev-prepstrip.patch

I've made a small patch and tested it with portage 2.2.14, now portage works fine for me. I think new code should run only in case of cross-compilation, but I don't know how to check for it yet, and it still shouldn't do any harm running even for native compilation process.

I've just copied this code from another file of portage (isolated-functions.sh).
Comment 5 Zac Medico gentoo-dev 2015-03-14 22:39:50 UTC
(In reply to i.Dark_Templar from comment #4)
> Created attachment 398920 [details, diff] [details, diff]
> crosdev-prepstrip.patch

I'd prefer to use a new environment variable, as mentioned in 
comment #3. Making it rely strictly on the $(uname -s) value is not flexible. For example, it won't work for prefix portage with a GNU prefix userland running on a *BSD kernel.
Comment 6 i.Dark_Templar 2015-03-15 07:46:40 UTC
(In reply to Zac Medico from comment #5)
> I'd prefer to use a new environment variable, as mentioned in 
> comment #3. Making it rely strictly on the $(uname -s) value is not
> flexible. For example, it won't work for prefix portage with a GNU prefix
> userland running on a *BSD kernel.

Yes, new environment variable sounds good. Consider my patch as a temporary and partial workaround.
Comment 7 SpanKY gentoo-dev 2015-05-31 05:39:53 UTC
i'm in the process of rewriting prepstrip in python at which point this is moot