The program segfaults if you link the pthread library as the first library, because on intel it works in this order I think it a bug in the egcs alpha. It needs KDE but this is not a bug in KDE, because it works on my Intel. /* This program runs in both versions on my Intel RedHat 5.2 but on the alpha it gives a segfault if the pthread library is linked at first. I think this is a bug. Intel works: RH5.2 Alpha Debian segfault. * egcs-2.90.29 980515 (egcs-1.0.3 release) * RedHat 52 segfaults */ // KDE include files #include <kapp.h> #include <pthread.h> /* Success : g++ -I/opt/kde/include -I/opt/qt/include -I/usr/X11R6/include -L/opt/kde/lib -L/opt/qt/lib -L/usr/X11R6/lib test.cpp -lkfile -lkfm -lkdeui -lkdecore -lqt -lXext -lX11 -lpthread SEGFAULT : g++ -I/opt/kde/include -I/opt/qt/include -I/usr/X11R6/include -L/opt/kde/lib -L/opt/qt/lib -L/usr/X11R6/lib test.cpp -lpthread -lkfile -lkfm -lkdeui -lkdecore -lqt -lXext -lX11 The only difference is the linking order of the pthread library. */ static void *writerThread(void *arg){ printf("a\n"); return NULL; } int main(int nargs,char** args) { printf("hi\n"); KApplication a( nargs, args, "kmpg" ); pthread_t tr; printf("hello\n"); pthread_create(&tr,NULL,writerThread,NULL); printf("b\n"); a.exec(); return 0; }
Are the other kde libraries linked in the example thread safe? Is this still valid on the RH 6.0? assigned to pbrown for follow ups.
This still happens under RHL 6.0 on alpha. Cristian, even if the kde libraries aren't thread safe, all the KDE/X stuff is being done in one thread, so it shouldn't segfault, right? I am no linking expert, but this behaviour does seem strange to me too.
Jim, can you please take a look into this?
What libraries do I need to use to reproduce this bug? I tried it on a few systems here and I just got things like: /usr/include/kconfigbase.h:80: qcolor.h: No such file or directory It looks like it may be a real bug (link order does matter, but getting it wrong should not - usually - cause core dumps). Preston, is there a machine at redhat (say a chroot jails on porky/jetson?) which can reproduce this?