Dixon, Lee L. - BROKEN: pthreads and c++ statically linked (original) (raw)
This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] |
- From: "Dixon, Lee L."
- To: gcc at gcc dot gnu dot org
- Date: Tue, 8 Nov 2005 09:31:56 -0500
- Subject: BROKEN: pthreads and c++ statically linked
I really don't know what I could be doing wrong, but on a stock FC4 install, I'm having a segfault in a pthread call when statically linked and including iostream (or STL includes like string)
Here's the code:
#include <pthread.h> #include
int main(int argc, char *argv[]) { pthread_mutexattr_t attr; pthread_mutexattr_init( &attr ); }
And I compile with: g++ -g -c example.c g++ -static -g -o example example.o -lpthread
The resulting program crashes in pthread_mutexattr_init. If I merely remove the include of , it works fine. This works fine on FC3.
A dynamic linking variation that blows up: g++ -g -o example example.o (leave off the -lpthread, yes this links) I also noticed that there are 2 libpthread.so files. One in /usr/lib, and another in /lib which is the one ldd points to.
Finally, if I remove the include, and attempt to dynamically link, it finally complains about not finding the pthread_mutexattr_init call. Was it somehow getting a pthread_mutexattr_init from the libstdc++ library??
Can anyone else confirm this crash? Has anyone else seen this problem? I've googled everywhere, and even posted to 2 forums without any response. And, yes, I must statically link in my case.
Thanks for any help, Lee
- Follow-Ups:
- Re: BROKEN: pthreads and c++ statically linked
* From: Jakub Jelinek
- Re: BROKEN: pthreads and c++ statically linked
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |