On a Ubuntu Linux machine g++ doesn't appear to be linking libraries as it should. I can't supply full source code, but essentially it is a small program which creates a pthread. It compiles fine on two other Debian machines, but on the Ubuntu machine it complains about an undefined reference to pthread_create.
The command line is something like this:
g++ -I. -lpthread source_code.cpp -o program
To debug this I ran g++ under strace to see how it was looking for libpthread. When I did that, I did not see ANY references to libpthread. It was as if the linker wasn't even trying to search for the library. On the machines that did compile I saw several calls to open() when it searched the filesystem for the library.
When I ran ld separately it seems to find libpthread without a problem, and the strace output confirms that it is searching for the library as it should. I ran ld separately like this:
user@machine:~/src$ ld -lpthread
ld: warning: cannot find entry symbol _start; not setting start address
Why could cause g++ to not search the filesystem correctly for libraries when ld seems to do so just fine by itself? Kinda stumped on this one at the moment.
Thanks!