Re: static linking of pthread crashes with segfault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I tried to link a pthread application with -static and run into a segfault on x86, same on powerpc.

I tried gcc 4.4.2 (linux/x86) and 4.0.2 for powerpc-unknown-linux-gnu



For the x86 linux example I got in gdb:
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x08094d49 in __cxa_guard_release ()
#2  0x08050fa1 in get_locale_mutex () at ../../../../libstdc++-v3/src/locale_init.cc:38
#3  0x0805326a in locale (this=0x81497dc) at ../../../../libstdc++-v3/src/locale_init.cc:211
#4  0x0804efc7 in basic_streambuf (this=0x8147260) at /home/krud/work/gcc-4.4.2/build_linux/i686-pc-linux-gnu/libstdc++-v3/include/streambuf:442
#5  stdio_sync_filebuf (this=0x8147260) at /home/krud/work/gcc-4.4.2/build_linux/i686-pc-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:68
#6  Init (this=0x8147260) at ../../../../libstdc++-v3/src/ios_init.cc:85
#7  0x08048242 in global constructors keyed to a ()
#8  0x0810beed in __do_global_ctors_aux ()
#9  0x08048120 in _init ()
#10 0x080a8112 in __libc_csu_init ()
#11 0x080a7b73 in __libc_start_main ()
#12 0x08048151 in _start () at ../sysdeps/i386/elf/start.S:119
(gdb)

The application runs with shared libs without any problems.

g++ -static -O2 main.cpp /usr/lib/libpthread.a -o linux

Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
> You could try -static -pthread instead of specifying the static lib
> 

The build with 
g++ -static -pthread -O2 main.cpp  -o linux
results in the same problem

Any ideas?

Thanks
 Klaus

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux