Hi, I've found a combination of threads, popen and linking with
glibc statically which causes the application to lock up...
My machine is using x86 linux-2.4.18 and glibc-2.2.4 . I'm using
mandrake.. I've tried it on a debian machine running a 2.2 kernel and
also even on an alpha running linux and the problem happens there too..
I found this while trying to build a statically linked binary of my
application ReZound: http://rezound.sourceforge.net
I've narrowed it down to a few source code lines which I have attached
as bug.c
Basically, if you compile this as:
gcc -o bug bug.c -lpthread
it will work., but if you compile the same thing as:
gcc -static -o bug bug.c -lpthread
it will lock up..
Now.. if you remove either the call to popen or the call to the two
thread functions it will work when gcc is given -static
(And I know the FILE * from popen needs to be closed.. but it makes no
difference as the the problem happening whether I close it before the
thread starts or not)
The fact that it's related to -static (which BTW tells gcc to use
static libraries instead of dynamic libraries for linking) may
indicate that it's just a packaging problem, or that it's related to
something with dynamic library function calls.
Anyway, I hope this could be fixed soon... Even if everyone else in
the world doesn't upgrade glibc, I will, so the standalone app could
actually run.
Please reply to my email address because I can't find anywhere on the
glibc www site to actually subscribe to this mailing list..
Thanks,
Davy
------------------------------------------------------------------------
#include <stdio.h>
#include <pthread.h>
void *func(void *temp)
{
return NULL;
}
int main()
{
pthread_t threadID;
void *status;
popen("ls","r");
pthread_create(&threadID,NULL,func,NULL);
pthread_join(threadID,&status);
return 0;
}