Often, when I try to emerge otcl the build fails with: [...] ar cq libotcl.a otcl.o ranlib libotcl.a rm -f libotcl.so gcc -o otclsh -O2 -march=athlon-xp -fomit-frame-pointer -pipe -I/usr/lib/tcl8.4/include/generic -I. -I/usr/include -I/usr/include -I/include otclAppInit.c \ -L. -lotcl -L/usr/lib -ltk8.4 -L/usr/lib -ltcl8.4 -L/usr/X11R6/lib -lXext -lX11 -lnsl -ldl -lm ld -shared -o libotcl.so otcl.o rm -f libotcl.so gcc -o owish -O2 -march=athlon-xp -fomit-frame-pointer -pipe -I/usr/lib/tcl8.4/include/generic -I. -I/usr/include -I/usr/include -I/include otkAppInit.c \ -L. -lotcl -L/usr/lib -ltk8.4 -L/usr/lib -ltcl8.4 -L/usr/X11R6/lib -lXext -lX11 -lnsl -ldl -lm /local/var/tmp/portage/otcl-1.8-r1/temp/ccDhTIb2.o(.text+0x4f): In function `Tcl_AppInit': : undefined reference to `Otcl_Init' collect2: ld returned 1 exit status make: *** [otclsh] Error 1 make: *** Waiting for unfinished jobs.... /local/var/tmp/portage/otcl-1.8-r1/temp/ccNRjpNh.o(.text+0x67): In function `Tcl_AppInit': : undefined reference to `Otcl_Init' collect2: ld returned 1 exit status make: *** [owish] Error 1 The build fails at various points. Reproducible: Sometimes Steps to Reproduce: 1. emerge otcl Actual Results: Build fails. Expected Results: Build should proceed. The reason for this is a race condition which appears when MAKEOPTS="-jN" where N is larger than one is defined in /etc/make.globals When more than one target is being compiled concurrently by make, usually it's ok. In this case however, for some reason the Makefile deletes libotcl.so and libotcl.a at various points during the build and then re-creates them. If one target is being linked against the library while the other has just deleted it, the undefined symbol error occurs. Workaround: edit /etc/make.globals and specify MAKEOPTS="-j1" In a future release, I suggest: * The ebuild should check if "-jX" exists and strip it from MAKEOPTS. * The Makefile should be patched to not recreate the library for each target.
Fixed.