Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 258622 - crossdev created cross toolchains override native toolchain
Summary: crossdev created cross toolchains override native toolchain
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-11 17:06 UTC by Zdenek Behan
Modified: 2009-02-12 23:43 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Behan 2009-02-11 17:06:52 UTC
When creating a toolchain using "crossdev --whatever whichever-toolchain", and the process succeeds, the enviroment file for gcc is installed into /etc/env.d/05gcc-arch-etc-etc-glibc.

gcc-config, when selecting native and cross toolchains does not differentiate between them (only says so), and "gcc" runs the first compiler, alphabetically.

In my case, i have:
 [1] arm-unknown-linux-gnu-4.1.2 *
 [2] i686-pc-linux-gnu-4.3.3 *
 [3] mipsel-unknown-linux-gnu-4.1.2 *
 [4] powerpc-unknown-linux-gnu-4.1.2 *

[2], the i686 compiler is native, the other are cross compilers, created by crossdev.

running just gcc refers to arm-unknown-linux-gnu-gcc which breaks just about anything that tries to compile any source (fe. portage).


Fix could be very simple: Simply changing the /etc/env.d/ file names for crosscompilers from 05 to 06 fixes the problem for me (after env-update). Until the next time i run gcc-config which adds the file back to 05.


Reproducible: Always

Steps to Reproduce:
1. Install a cross-compiler, alphabetically higher than the native (arm > i686)
2. run env-update, source /etc/profile
3. use gcc to compile something, then run it



I think this bug appeared with baselayout-2 and the appropriate version of gcc-config.

My package versions:
 sys-devel/crossdev-0.9.19
 sys-devel/gcc-config-1.4.1
 sys-apps/baselayout-2.0.0
 sys-apps/openrc-0.4.2
Comment 1 SpanKY gentoo-dev 2009-02-12 05:53:21 UTC
nothing in your output indicates a problem.  presumably you have color disabled and so you cant tell the difference between the colored * marks.

post `emerge --info` like the bug reporting page told you to.  then post every file in /etc/env.d/05gcc* as an attachment as well as the `ls` output of every dir found in the referenced files.
Comment 2 Zdenek Behan 2009-02-12 09:00:42 UTC
I have color enabled, and from my indicated output, the i686 is correctly shown as green, all other as cyan. When i do gcc-config <whichever_number>, it correctly says setting the (native|cross)-compiler to ....

Here's my emerge --info, and more info underneath:
Portage 2.2_rc23 (default/linux/x86/2008.0, gcc-4.3.3, glibc-2.9_p20081201-r1, 2.6.28-gentoo i686)
=================================================================
System uname: Linux-2.6.28-gentoo-i686-Intel-R-_Core-TM-2_Quad_CPU_@_2.40GHz-with-glibc2.0
Timestamp of tree: Thu, 05 Feb 2009 09:15:01 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
app-shells/bash:     3.2_p48
dev-java/java-config: 1.3.7-r1, 2.1.7
dev-lang/python:     2.5.4-r2
dev-python/pycrypto: 2.0.1-r6
dev-util/cmake:      2.6.2-r1
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.2
sys-apps/sandbox:    1.3.2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.28-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/4.1/env /usr/kde/4.1/share/config /usr/kde/4.1/shutdown /usr/kde/4.2/env /usr/kde/4.2/share/config /usr/kde/4.2/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.sh.cvut.cz/MIRRORS/gentoo/"
LANG="en_US.UTF8"
LC_ALL="en_US.UTF8"
LDFLAGS="-Wl,-O1"
LINGUAS="en cs"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp/portage"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/desktop-effects /usr/portage/local/layman/mozilla /usr/portage/local/layman/kde-testing /usr/portage/local/crossdev /usr/portage/local/custom /usr/portage/local/cloud"
SYNC="rsync://10.16.1.1/gentoo-portage"
USE="X Xaw3d aac aalib acl acpi acpi4linux aim alsa apache2 arts artswrappersuid asf audiofile avi bash-completion bcmath berkdb bluetooth browserplugin bzip2 bzlib cairo cdr cdrom cgi chroot clanJavaScript cli codecs cpdflib cracklib crypt ctype cups curl curlwrappers d3d dbase dbus dbx dga dio divx4linux dlloader dri dvb dvd dvdr dvdread edl encode erandom escreen esd ethereal exif ext-png ext-zlib extensions fam fastcgi fb fbcon ffmpeg fftw flash fluidsynth font-server foomaticdb fortran freetype ftp gd gdbm ggi gif gii gimp gimpprint ginac glade glitz glut glx gnuplot gnutls gphoto2 gpm gps graphviz gs gsl gsnd gtk gtk2 hal hub iconv icq ide idea ieee1394 image imagekits imagemagick imap imlib imlib2 immqt-bc ipv6 irmc isdnlog j2ee jabber jai java javacomm javascript jce jikes jp2 jpeg jpeg2k junit kde kdeenablefinal kdehiddenvisibility kdeprefix koffice-plugin lcms ldap libcaca libedit lids live mad maps matroska mbox midi mikmod mime ming mixer mjpeg mmap mmx mmx2 mmxext mng modplug motif mozilla mp3 mpeg mplayer msn mudflap musepack mysql mysqli ncurses net nls nntp normalizemime nptl nptlonly nsplugin ntlm nvidia odbc openal opengl openmp operanom2 oscar oss pam pcre pdf pdfkit pdflib perl php physfs playlist plotutils png portaudio posix ppds pppd pthreads python qt qt4 quicktime radius readline recode reflection rtc samba sasl sdl session sftplogging shared sharedmem silc silverxp simplexml slp smime sms smtp sndfile snmp sockets sounds speedo speex spell spl sqlite sse sse2 ssl ssse3 subversion svg svga sysfs sysvipc szip tcltk tcpd tcpmd5 tetex theora threads tiff timidity truetype truetype-fonts type1 type1-fonts unicode usb v4l v4l2 vcd videos vidix vim vim-pager vim-with-x vorbis webkit win32codecs wma123 wmf wxgtk1 wxwindows x264 x86 xcb xcomposite xfs xim xine xinerama xml xorg xosd xpm xrandr xscreensaver xulrunner xv xvid xvmc yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 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 auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en cs" USERLAND="GNU" VIDEO_CARDS="nv nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


# cat 05gcc-arm-unknown-linux-gnu 
PATH="/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2"
ROOTPATH="/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2"

# cat 05gcc-i686-pc-linux-gnu
MANPATH="/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/man"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/info"
LDPATH="/usr/lib/gcc/i686-pc-linux-gnu/4.3.3"
PATH="/usr/i686-pc-linux-gnu/gcc-bin/4.3.3"
ROOTPATH="/usr/i686-pc-linux-gnu/gcc-bin/4.3.3"
GCC_SPECS=""

(sorry, uninstalled the others, because i didn't need them anymore, but things still break)

Here's the sequence that breaks things:
 # gcc-config -l
 [1] arm-unknown-linux-gnu-4.1.2 *
 [2] i686-pc-linux-gnu-4.3.3 *
 # gcc-config 1
* Switching cross-compiler to arm-unknown-linux-gnu-4.1.2...
 # gcc-config 2
* Switching native-compiler to i686-pc-linux-gnu-4.3.3... 
 # env-update
>>> Regenerating /etc/ld.so.cache...
 # source /etc/profile
 # echo ${PATH}
/usr/kde/3.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.3.3:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/kde/4.2/sbin:/usr/kde/4.2/bin:/usr/qt/3/bin:/opt/vmware/workstation/bin
 # gcc --version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And here's how I fix it:

 # rename "05" "06" /etc/env.d/05gcc-arm-unknown-linux-gnu
 # env-update
>>> Regenerating /etc/ld.so.cache...
 # source /etc/profile
 # echo ${PATH}
/usr/kde/3.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.3.3:/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/kde/4.2/sbin:/usr/kde/4.2/bin:/usr/qt/3/bin:/opt/vmware/workstation/bin
 # gcc --version
gcc (Gentoo 4.3.3 p1.0, pie-10.1.5) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Please note that I managed to reproduce this on like 3 completely different systems with different package sets, keywords, and generally not much in common.

My guess and reasoning behind my fix is, that the compiler used when using just "gcc" (/usr/bin/gcc, installed by gcc-config) is determined by the PATH enviroment variable. If you run just "gcc" and not "i686-pc-linux-gnu-gcc", it picks any gcc it finds first. So this generally only breaks for cross-compilers which are alphabetically above your native one. You probably always call cross-compilers with their full name, (ie. powerpc-pc-linux-gnu-gcc), so those are not affected by anything of this. And the native only is affected if you have either alpha, arm/armeb or hppa cross-compiler.
Comment 3 SpanKY gentoo-dev 2009-02-12 21:59:33 UTC
except that no cross-compiler should install `gcc` so the location of a cross-compiler in the PATH is irrelevant.  nothing you posted looks wrong to me (except for the gcc --version showing 4.1.2).  i need the `ls` output of those PATHs.

like /usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2/
Comment 4 Zdenek Behan 2009-02-12 22:29:46 UTC
(In reply to comment #3)
> except that no cross-compiler should install `gcc` so the location of a
> cross-compiler in the PATH is irrelevant.  nothing you posted looks wrong to me
> (except for the gcc --version showing 4.1.2).  i need the `ls` output of those
> PATHs.
> 
> like /usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.1.2/

Uhm, yes. Now it started making sense. I admit this is entirely my fault and the bug is likely invalid, sorry for being a pain. :(

Because I indeed DO have 'gcc' in the cross-compiler path. A symlink i created, now that you mentioned it. This is so that i can export the cross-compiler via distcc, and use it on a different target machine using just CC='distcc gcc' (ie. with portage). (That's really just about the only way i use them anywhere)

Note that this used to work with previous baselayout version, and only broke with baselayout-2 and corresponding tool updates, but i'm surely quite out of spec of the system here doing stuff the author did not intend to.
Comment 5 SpanKY gentoo-dev 2009-02-12 23:24:08 UTC
packages should generally execute the fully named compiler (so like $CHOST-gcc), so creating distcc wrappers for that should be sufficient

if a package executes `gcc` to $CHOST code (dont confuse this with $CBUILD code), then you should file a bug to get that package fixed (assuming there isnt a bug already).
Comment 6 Zdenek Behan 2009-02-12 23:43:43 UTC
(In reply to comment #5)
> packages should generally execute the fully named compiler (so like
> $CHOST-gcc), so creating distcc wrappers for that should be sufficient
> 
> if a package executes `gcc` to $CHOST code (dont confuse this with $CBUILD
> code), then you should file a bug to get that package fixed (assuming there
> isnt a bug already).

Will certainly do that. But I found the build system of several packages to be basically broken whenever you ask it to do anything else than a native local build, be it local crosscompile or remote crosscompile with distcc or something even more horrible. And not just some obscure rarely used packages, but packages like bash. Things like "ROOT=/new-arm-root/ CTARGET=arm-unknown-linux-gnu CBUILD=i686-pc-linux-gnu emerge system" are bound to fail horribly in multiple places. In the best case with a message saying "Crosscompile not possible" during configure.

Maybe it was broken only in portage and manually i'd get it to compile the way i wanted it to, but my workaround made them work all at once and think that they are actually building natively, locally, which saved me a TON of time with unnecessary experimenting and fixing, yet still sucessfully putting things to a lot different (and very slow) boxes.

Anyway, thanks for the help, and sorry again for the bother. :)