The libsandbox Makefile uses CC=gcc instead of using the CC variable which (in my setup) is set in /etc/make.conf to 'sparc-unknown-linux-gnu-gcc'. This is a problem because I use distcc to cross-compile. When the Makefile uses gcc instead of sparc-unknown-linux-gnu-gcc, the build fails because my x86 box compiles the code using gcc aka i686-pc-linux-gnu-gcc and we all know that the two use different binary code. My experience is documented in this forum thread: http://forums.gentoo.org/viewtopic.php?t=119788 Reproducible: Always Steps to Reproduce: On the PC: 1. Build a cross-compile toolchain 2. Install distcc and start distccd On the sparc: 3. Install distcc and add the PC as a compile slave. 4. Add the following lines to /etc/make.conf (doesn't matter since the libsandbox Makefile ignores them): CHOST="sparc-unknown-linux-gnu" CC=${CHOST}-gcc CXX=${CHOST}-g++ FEATURES="distcc" 3. try to emerge portage like a stage one install: # USE="-* build" emerge portage" Actual Results: >>> md5 src_uri ;-) portage-2.0.49-r21.tar.bz2 >>> Unpacking source... >>> Unpacking portage-2.0.49-r21.tar.bz2 to /var/tmp/portage/portage-2.0.49-r21/work >>> Source unpacked. ./create-localdecls Checking truncate argument type... off_t Checking libc version... libc.so.6 Checking glibc subversion... gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT libsandbox.c gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT sandbox_futils.c gcc libsandbox.o sandbox_futils.o -shared -fPIC -ldl -lc -o libsandbox.so -nostdlib -lgcc /usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.2.3/../../../../sparc-unknown-linux-gnu/bin/ld: libsandbox.o: Relocation in generic ELF (EM: 3) libsandbox.o: could not read symbols: File in wrong format collect2: ld returned 1 exit status distcc[4850] ERROR: compile on localhost failed make: *** [libsandbox.so] Error 1 ... Expected Results: It should have (and would have) compiled. The lines which read gcc should have said 'sparc-unknown-linux-gnu-gcc' instead. I have edited the Makefile and replaced CC=gcc with CC=sparc-unknown-linux-gnu-gcc and everything works as expected. Unfortunately, I don't know how to make the Makefile inherit the data from make.conf...
Dear Troy, its normally set via environment variable CC=... you can do "env" and "env-update" and grep -r for "CC" in the /etc directory. If you want to help, you can set CC explicitly there to the cross compiler. It would also be of great help where else this invocation of CC is preventing cross proper compiling of the important parts of the system. thank you, Alex
Azarah, Anyone: Any idea how to quick fix this? Sandbox sets CC=gcc in the Makefile... How do we make it use the environment if it's set, and then default to gcc?
This is fixed in stable, btw. CC ?= gcc
Looks fixed to me. Thanks!