public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32425]  New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
@ 2007-06-20 14:23 lionelb dot nospam at gmail dot com
  2007-06-20 14:27 ` [Bug c++/32425] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lionelb dot nospam at gmail dot com @ 2007-06-20 14:23 UTC (permalink / raw)
  To: gcc-bugs

Minimal program file hello.cpp:

#include <iostream>

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32425] -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
  2007-06-20 14:23 [Bug c++/32425] New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found) lionelb dot nospam at gmail dot com
@ 2007-06-20 14:27 ` pinskia at gcc dot gnu dot org
  2007-06-20 15:01 ` lionelb dot nospam at gmail dot com
  2007-06-21 22:43 ` lionelb dot nospam at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-20 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-06-20 14:27 -------
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.  Note -static-libgcc
is wrong here too because of exceptions.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32425


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32425] -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
  2007-06-20 14:23 [Bug c++/32425] New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found) lionelb dot nospam at gmail dot com
  2007-06-20 14:27 ` [Bug c++/32425] " pinskia at gcc dot gnu dot org
@ 2007-06-20 15:01 ` lionelb dot nospam at gmail dot com
  2007-06-21 22:43 ` lionelb dot nospam at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: lionelb dot nospam at gmail dot com @ 2007-06-20 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32425] -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found)
  2007-06-20 14:23 [Bug c++/32425] New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found) lionelb dot nospam at gmail dot com
  2007-06-20 14:27 ` [Bug c++/32425] " pinskia at gcc dot gnu dot org
  2007-06-20 15:01 ` lionelb dot nospam at gmail dot com
@ 2007-06-21 22:43 ` lionelb dot nospam at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: lionelb dot nospam at gmail dot com @ 2007-06-21 22:43 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-21 22:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-20 14:23 [Bug c++/32425] New: -O breaks executable (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found) lionelb dot nospam at gmail dot com
2007-06-20 14:27 ` [Bug c++/32425] " pinskia at gcc dot gnu dot org
2007-06-20 15:01 ` lionelb dot nospam at gmail dot com
2007-06-21 22:43 ` lionelb dot nospam at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).