Date: Tue, 9 Dec 2008 10:35:07 +0100 (CET) From: Olaf Seibert <olafs@cs.ru.nl> To: FreeBSD-gnats-submit@FreeBSD.org Cc: olafs@cs.ru.nl Subject: ports/129518: g++42 uses wrong libstdc++.so and libgcc_s.so Message-ID: <20081209093507.10A502E05C@twoquid.cs.ru.nl> Resent-Message-ID: <200812090940.mB99e1u9074689@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 129518 >Category: ports >Synopsis: g++42 uses wrong libstdc++.so and libgcc_s.so >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 09 09:40:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Olaf Seibert >Release: FreeBSD 6.1-RELEASE amd64 >Organization: Radboud University Nijmegen >Environment: System: FreeBSD twoquid.cs.ru.nl 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Mar 19 15:05:26 CET 2007 root@twoquid.cs.ru.nl:/usr/src/sys/amd64/compile/TWOQUID amd64 >Description: If you have both gcc 4.1 and gcc 4.2 installed (gcc-4.1.3_20080630 and gcc-4.2.5_20080702 in my example), then programs created with g++4.2 will use the wrong libstdc++.so and libgcc_s.so. >How-To-Repeat: Script started on Tue Dec 9 10:17:38 2008 $ cat hello.cc #include <iostream> int main() { std::cout << "Hello, world!\n"; return 0; } $ g++42 hello.cc $ ldd ./a.out ./a.out: libstdc++.so.6 => /usr/local/lib/gcc-4.1.3/libstdc++.so.6 (0x80062b000) libm.so.4 => /lib/libm.so.4 (0x800825000) libgcc_s.so.1 => /usr/local/lib/gcc-4.1.3/libgcc_s.so.1 (0x800941000) libc.so.6 => /lib/libc.so.6 (0x800a4d000) $ exit Script done on Tue Dec 9 10:17:59 2008 Note the "gcc-4.1.3" in those paths. These files do indeed differ significantly between versions: -rw-r--r-- 1 root wheel 220755 Oct 1 21:37 /usr/local/lib/gcc-4.1.3/libgcc_s.so.1 -r--r--r-- 1 root wheel 238659 Oct 1 00:00 /usr/local/lib/gcc-4.2.5/libgcc_s.so.1 -rwxr-xr-x 1 root wheel 1228873 Oct 1 21:37 /usr/local/lib/gcc-4.1.3/libstdc++.so.6 -rwxr-xr-x 1 root wheel 1313164 Oct 1 00:00 /usr/local/lib/gcc-4.2.5/libstdc++.so.6 >Fix: Proper RPATH options should be used for all compilations. G++ should pass the correct -R (aka --rpath) options to the linker, and global library search paths should not be used. Global RPATHs (ldconfig!) are evil and cannot work properly. -Olaf. -- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081209093507.10A502E05C>