Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] statically linked example on Linux segfaults when exception is thrown
From: Neetu Garg (garg_neetu_at_[hidden])
Date: 2010-03-24 17:33:42


Hi Anthony,

As I said it works fine case of dynamic linking. Issue with exceptional handling occurs only with static linking.

I have 2 versions on gcc on my box. I also tried with different version of gcc, got same issue.

# gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)

Appreciate your help

Regards,

Neetu.

----- Original Message ----
From: Neetu Garg <garg_neetu_at_[hidden]>
To: Discussions about the boost.thread library <threads-devel_at_[hidden]>
Sent: Tue, March 23, 2010 10:11:22 AM
Subject: Re: [Threads-devel] statically linked example on Linux segfaults when exception is thrown

Thanks Anthony for prompt reply.

Yes it works fine if I link dynamically.

Here are compile and link command for dynamic linking and I did get the exception.

#g++ -c -pthread -I. -I/usr/local/include/boost-1_38 -I/usr/include testThreadException.cpp -o testThreadException.o

# g++ -pthread testThreadException.o -L/usr/local/lib -lboost_thread-gcc41-mt -L/usr/lib -lpthread -o testThreadException

I got output:
exception
DONE

Problem is only when I add "-static" option to link statically.

Regards,
NG

----- Original Message ----
From: Anthony Williams <anthony_at_[hidden]>
To: threads-devel_at_[hidden]
Sent: Tue, March 23, 2010 10:03:56 AM
Subject: Re: [Threads-devel] statically linked example on Linux segfaults when exception is thrown

On 23/03/10 16:58, Neetu Garg wrote:
> Thanks Anthony,
>
> I added "-pthread" while compilation as well as while linking, I am still getting segfaults.
>
> # g++ -c -pthread -I. -I/usr/local/include/boost-1_38 -I/usr/include testThreadException.cpp -o testThreadException.o
> # g++ -pthread testThreadException.o -static -L/u/test/lib -lboost_thread-gcc41-mt -lpthread -o testThreadException
>

That is strange. It may be something to do with the C++ runtime. Does it
work with dynamic linking?

Anthony

-- 
Author of C++ Concurrency in Action    http://www.stdthread.co.uk/book/
just::thread C++0x thread library            http://www.stdthread.co.uk
Just Software Solutions Ltd      http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
_______________________________________________
threads-devel mailing list
threads-devel_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/threads-devel
      
_______________________________________________
threads-devel mailing list
threads-devel_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/threads-devel
      

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk