Steps to reproduce: 1. emerge gcc 2. Compile this: #include <math.h> int main(void) { float test=cos(3.1415926); return (int) test; } Output from gcc Test.c -o test -v -lm: - 3.4.0-r6: Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/specs Configured with: /var/tmp/portage/gcc-3.4.0-r6/work/gcc-3.4.0/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4/info --enable-shared --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77 --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/include/g++-v3 --with-local-prefix=/usr/local --disable-werror --enable-shared --enable-nls --without-included-gettext --enable-multilib --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 3.4.0 20040601 (Gentoo Linux 3.4.0-r6, ssp-3.4-2, pie-8.7.6.3) /usr/libexec/gcc/x86_64-pc-linux-gnu/3.4.0/cc1 -quiet -v Test.c -quiet -dumpbase Test.c -mtune=k8 -auxbase Test -version -o /tmp/ccbbVr3w.s ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/include /usr/include End of search list. GNU C version 3.4.0 20040601 (Gentoo Linux 3.4.0-r6, ssp-3.4-2, pie-8.7.6.3) (x86_64-pc-linux-gnu) compiled by GNU C version 3.4.0 20040601 (Gentoo Linux 3.4.0-r6, ssp-3.4-2, pie-8.7.6.3). GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128304 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../x86_64-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccalbDC6.o /tmp/ccbbVr3w.s GNU assembler version 2.15.91.0.1 (x86_64-pc-linux-gnu) using BFD version 2.15.91.0.1 20040527 /usr/libexec/gcc/x86_64-pc-linux-gnu/3.4.0/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o test /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccalbDC6.o -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.0/../../../../lib64/crtn.o 3.4.1-r1: Using built-in specs. Configured with: /var/tmp/portage/gcc-3.4.1-r1/work/gcc-3.4.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4/info --enable-shared --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77 --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3 --with-local-prefix=/usr/local --disable-werror --enable-shared --enable-nls --without-included-gettext --enable-multilib --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 3.4.1 (Gentoo Linux 3.4.1-r1, ssp-3.4-2, pie-8.7.6.3) /usr/libexec/gcc/x86_64-pc-linux-gnu/3.4.1/cc1 -quiet -v Test.c -quiet -dumpbase Test.c -mtune=k8 -auxbase Test -version -o /tmp/cc50YkEV.s ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include End of search list. GNU C version 3.4.1 (Gentoo Linux 3.4.1-r1, ssp-3.4-2, pie-8.7.6.3) (x86_64-pc-linux-gnu) compiled by GNU C version 3.4.1 (Gentoo Linux 3.4.1-r1, ssp-3.4-2, pie-8.7.6.3). GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128304 /usr/lib/gcc/x86_64-pc-linux-gnu/../../../x86_64-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccefIYQK.o /tmp/cc50YkEV.s GNU assembler version 2.15.91.0.1 (x86_64-pc-linux-gnu) using BFD version 2.15.91.0.1 20040527 /usr/libexec/gcc/x86_64-pc-linux-gnu/3.4.1/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o test /usr/lib/gcc/x86_64-pc-linux-gnu/../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/../../../lib64/crti.o crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/../../../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccefIYQK.o -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/../../../lib64/crtn.o /usr/lib/gcc/x86_64-pc-linux-gnu/../../../x86_64-pc-linux-gnu/bin/ld: crtbegin.o: No such file: No such file or directory collect2: ld returned 1 exit status --- emerge info --- Portage 2.0.50-r9 (gcc34-amd64-2004.1, gcc-3.4.0, glibc-2.3.4.20040619-r0, 2.6.7-love7) ================================================================= System uname: 2.6.7-love7 x86_64 4 Gentoo Base System version 1.5.1 distcc 2.14 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="amd64 ~amd64" AUTOCLEAN="yes" CFLAGS="-O2 -pipe -march=k8 -fomit-frame-pointer -ftracer" CHOST="x86_64-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -pipe -march=k8 -fomit-frame-pointer -ftracer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache digest maketest sandbox userpriv usersandbox" GENTOO_MIRRORS="ftp://gentoo.inode.at/source/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage /usr/local/fluidportage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="X aalib alsa amd64 apm arts artswrappersuid avi berkdb cdr clamav crypt cups dga dillo directfb divx4linux dvd encode esd f77 foomaticdb gdbm gif gpm gtk gtk2 icq imlib java jpeg kde libg++ libwww linguas_de matroska mikmod motif mozilla mpeg multilib ncurses nls nptl offensive oggvorbis opengl oss pam pdflib perl png ppds python qt quicktime readline scanner sdl slang spell ssl tcltk tcpd tetex truetype usb xface xinerama xml2 xmms xv xvid zlib" --- /emerge info ---
alright, i just compiled a vanilla gcc 3.4.1 with no patches applied. i still get an error. i really think you should report this upstream. ayanami root # gcc test.c -o moo /tmp/ccQD9dzn.o(.text+0x1c): In function `main': : undefined reference to `cos' collect2: ld returned 1 exit status
god i'm a dummie today. gcc test.c -lm -o moo and it should work. *hangs head*
it turns out that somehow /usr/lib/gcc wasn't a symlink to /usr/lib/gcc-lib on my system... So if anyone runs into this: rm /usr/lib/gcc -rf ln -sf /usr/lib/gcc-lib /usr/lib/gcc