>
> OK, so a few more things. Use ldd on your lib to see what libraries
>
> it's going to link against. Then use "readelf -d" to see what NEEDED
>
> items there are. You should see mongodb in the NEEDED list.
>
>
>
> If mongodb does not appear, the library was not linked correctly, and
>
> you need to look very carefully at the output of make during the
>
> linking stage to see why.
>
>
>
> Andrew.
I figured out that the symbol that i am missing is not located in a shared object(libmongoc.so), rather it is located inside libmongo.a. Now i compared the status of this system with another build machine of mine on which everything works fine. Turns out(result of readelf -d and ldd) that the final lib srv.so is not dependent on libmongoc.so at all.
Below is a comparison of a system on which linking and loading is fine compared to the problematic one:
System working file: readelf -a -s srv.so|grep
0000002a00c0 016b00000007 R_X86_64_JUMP_SLO 000000000006f350 mongo_cursor_set_query + 0
363: 000000000006f350 8 FUNC GLOBAL DEFAULT 11 mongo_cursor_set_query
552: 000000000006f350 8 FUNC GLOBAL DEFAULT 11 mongo_cursor_set_query
System causing problem: output of readelf -a -s srv.so
000000282098 000900000007 R_X86_64_JUMP_SLO 0000000000000000 mongo_cursor_set_query + 0
9: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND mongo_cursor_set_query
477: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND mongo_cursor_set_query
Now what bugs me is that in the makefile i have specified -lmongoc which directs the compiler to link dynamically. The symbol is present in the .a file. How can it work on the system on which it is working correctly? Does the linker fall back to static linking when it cant find a symbol in dynamic lib? In this case how did the linker find the symbol in libmongoc.a whereas on the link line i specified -lmongoc?