[Bug c/32415] New: libgcc_s not found in library search path with --enable-version-specific-runtime-libs
Minimal program in test.c: int main() {} Compile: # /var/scratch/lionelb/usr/gcc-4.1.2/bin/gcc -v test.c Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: /var/scratch/lionelb/usr/src/gcc-4.1.2/configure --prefix=/var/scratch/lionelb/usr/gcc-4.1.2 --enable-languages=c,c++,fortran --enable-version-specific-runtime-libs --with-build-time-tools=/var/scratch/lionelb/usr/binutils-2.17/bin --with-as=/var/scratch/lionelb/usr/binutils-2.17/bin/as --with-ld=/var/scratch/lionelb/usr/binutils-2.17/bin/ld --enable-__cxa_atexit Thread model: posix gcc version 4.1.2 /var/scratch/lionelb/usr/gcc-4.1.2/libexec/gcc/x86_64-unknown-linux-gnu/4.1.2/cc1 -quiet -v test.c -quiet -dumpbase test.c -mtune=k8 -auxbase test -version -o /tmp/cc92Pr4G.s ignoring nonexistent directory "/var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /var/scratch/lionelb/usr/gcc-4.1.2/include /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include /usr/include End of search list. GNU C version 4.1.2 (x86_64-unknown-linux-gnu) compiled by GNU C version 3.4.6 20060404 (Red Hat 3.4.6-8). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 2f59716e3dacf2fc2f167478c592 /var/scratch/lionelb/usr/binutils-2.17/bin/as -V -Qy -o /tmp/ccgIgKwi.o /tmp/cc92Pr4G.s GNU assembler version 2.17 (x86_64-unknown-linux-gnu) using BFD version 2.17 /var/scratch/lionelb/usr/gcc-4.1.2/libexec/gcc/x86_64-unknown-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/crtbegin.o -L/var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2 -L/var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccgIgKwi.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/crtend.o /usr/lib/../lib64/crtn.o /var/scratch/lionelb/usr/binutils-2.17/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status Now: # find /var/scratch/lionelb/usr/gcc-4.1.2 -name libgcc_s* /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/lib/libgcc_s.so /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/lib/libgcc_s.so.1 /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/lib64/libgcc_s.so /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/lib64/libgcc_s.so.1 so it doesn't look as if gcc is looking in the right place for libgcc_s. This problem appears to affect GCC 4.2.0 as well. -- Summary: libgcc_s not found in library search path with --enable- version-specific-runtime-libs Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lionelb dot nospam at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32415
[Bug c++/32425] New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
Minimal program file hello.cpp: #include int main() { std::cout << "hello world\n"; return 0; } Compiled as follows: # /var/scratch/lionelb/usr/gcc-4.2.0/bin/g++ -v -static-libgcc -O hello.cpp Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: /var/scratch/lionelb/usr/src/gcc-4.2.0/configure --prefix=/var/scratch/lionelb/usr/gcc-4.2.0 --enable-languages=c,c++,fortran --enable-version-specific-runtime-libs --with-build-time-tools=/var/scratch/lionelb/usr/binutils-2.17/bin --with-as=/var/scratch/lionelb/usr/binutils-2.17/bin/as --with-ld=/var/scratch/lionelb/usr/binutils-2.17/bin/ld --enable-__cxa_atexit Thread model: posix gcc version 4.2.0 /var/scratch/lionelb/usr/gcc-4.2.0/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/cc1plus -quiet -v -D_GNU_SOURCE hello.cpp -quiet -dumpbase hello.cpp -mtune=generic -auxbase hello -O -version -o /tmp/ccCOiRAs.s ignoring nonexistent directory "/var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/include/c++ /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/include/c++/x86_64-unknown-linux-gnu /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/include/c++/backward /usr/local/include /var/scratch/lionelb/usr/gcc-4.2.0/include /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/include /usr/include End of search list. GNU C++ version 4.2.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.2.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 2397c1b5728582bf7ba9c1e7650657db /var/scratch/lionelb/usr/binutils-2.17/bin/as -V -Qy -o /tmp/ccmsgJch.o /tmp/ccCOiRAs.s GNU assembler version 2.17 (x86_64-unknown-linux-gnu) using BFD version 2.17 /var/scratch/lionelb/usr/gcc-4.2.0/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtbegin.o -L/var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0 -L/var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../.. /tmp/ccmsgJch.o -lstdc++ -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtend.o /usr/lib/../lib64/crtn.o Compiles without error (note: the -static-libgcc is to work around a problem reported in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32415) Running the executable gives: # ./a.out ./a.out: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./a.out) If compiled *without* the -O flag the program runs normally as expected. Higher optimization levels cause the same error, but -Os does not. I cannot reproduce the error with a simpler program. gcc 4.1.2 configured identically does not exhibit the problem. I find it puzzling that the error is reported for /usr/lib64/libstdc++.so.6, since there is a libstdc++.so.6.0.9 (plus appropriate links) in /var/scratch/lionelb/usr/gcc-4.2.0/lib/gcc/x86_64-unknown-linux-gnu/4.2.0 which appears before /usr/lib64 in the link line. -- Summary: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found) Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lionelb dot nospam at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32425
[Bug c++/32425] -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
--- Comment #2 from lionelb dot nospam at gmail dot com 2007-06-20 15:01 --- (In reply to comment #1) > And this is not a bug, you need to setup LD_LIBRARY_PATH correctly to point > to where the latest version of libstdc++ reside which means where > --enable-version-specific-runtime-libs puts the library. I see; that does solve the problem (as does using -Wl,-rpath ... maybe not recommended). Odd that I only hit that with the -O (and not with 4.1.2 at all). I guess that was just "lucky". > Note -static-libgcc is wrong here too because of exceptions. As mentioned in the report, please see: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32415 I may have a workaround for this now. BTW what are the implications for exceptions of linking with -static-libgcc? Cheers, Lionel -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32425
[Bug c/32415] libgcc_s not found in library search path with --enable-version-specific-runtime-libs
--- Comment #1 from lionelb dot nospam at gmail dot com 2007-06-20 15:31 --- (In reply to comment #0) I can work around this by symlinking: to ../lib64/libgcc_s.so from /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2 and: to ../../lib/libgcc_s.so from /var/scratch/lionelb/usr/gcc-4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/32 Is this advisable? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32415
[Bug c++/32425] -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
--- Comment #3 from lionelb dot nospam at gmail dot com 2007-06-21 22:43 --- (In reply to comment #2) > (In reply to comment #1) > > BTW what are the implications for exceptions of linking with -static-libgcc? Ok, that was a RTFM, got it now. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32425