I was checking out a coworkers message queue library and found that it didn't work, but it did for him. After days of scratching our heads I eventually realized that I wasn't doing "-lpthread" on the command line. When I did, suddenly everything was right with the world again. How does this happen? I get it that pthread, in my case, is a dynamically-linked library. If I compile my sample code (which isn't relavant here, I think) without the -lpthread, it's like the linker or OS is just filling in the blanks, if you will, with stub routines that do nothing. If I do supply the -lpthread flag and run the program in gdb, this line appears:
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Recompiling the program without the flag and using gdb mentions no inclusion of phtreads, which makes sense. I'm using a Raspberry Pi here, if that matters.
g++ --version reports:
g++ (Debian 4.6.3-14+rpi1) 4.6.3
Obviously this is something I'd like to fix, if you can.
Using "nm" to dump the symbol table on the two executables reveals no differences, at least for pthread symbols.