gdb und threads mit statischem Linken



  • Habe ein kleines Problem mit threads unter Linux (Fedora 1).
    Das Problem taucht nur auf, wenn ich statisch gegen pthread
    linke.

    Ich habe versucht das Problem etwas einzugrenzen und deswegen folgendes probiert:

    #include <pthread.h>
    #include <iostream>
    #include <stdlib.h>
    
    void* MyThreadFunc(void *arg);
    
    int main(){
       pthread_t thread;
    
       pthread_create(&thread, NULL, MyThreadFunc, NULL);
    
       pthread_join(thread, NULL);
    
       std::cout<<"Exiting main\n";
       return 0;
    }
    
    void* MyThreadFunc(void* arg){
         std::cout<<"Hello World from inside a thread!\n";
        return NULL;
    }
    

    Wenn ich das ganze übersetze mit

    g++ -o test hello.cpp -lpthread
    

    gibt es keine Probleme mit dem gdb.
    Wenn ich aber übersetze mit

    g++ -static -o test hello.cpp -lpthread
    

    kommt es zu folgendem:

    (gdb) run
    Starting program: .../test
    Hello World from inside a thread!
    
    Program received signal SIG32, Real-time event 32.
    0x0804aeef in __pthread_sigsuspend ()
    

    Ich moechte aber statisch linken, weil das Programm noch
    andere libs benutzt, die ich ebenfalls nur als
    Entwicklungsversion vorliegen habe.

    Welche Möglichkeiten habe ich, dem gdb mitzuteilen, dass er auch bei statischem linken threads unterstützen möge?

    /Dirk


Anmelden zum Antworten