Which lib for pthreads?

Dan Nelson dnelson at allantgroup.com
Mon Mar 7 07:40:03 PST 2005


In the last episode (Mar 07), Jonathon McKitrick said:
> On Sun, Mar 06, 2005 at 08:15:26PM -0500, Chuck Swiger wrote:
> : Um.  If you are compiling C++ code into an object file, you ought
> : to use c++ and not cc when linking, too.
> 
> I'm using ${CC} in the makefile, and it seems to automagically choose
> the correct tool.
> 
> : Also, you may not have relinked 'app'.  Do an ldd on app and see
> : whether it has a dependency on libc_r?  Try relinking app using
> : -pthread against a libplugina.so compiled with -pthread...
> 
> That was the problem.  I thought only the library with the thread
> calls needed to be linked with pthread.  Apparently the app needs it
> as well.

Ideally not; dynamic shared libraries can list dependencies:

$ ldd /usr/lib/libreadline.so
/usr/lib/libreadline.so:
	libncurses.so.5 => /lib/libncurses.so.5 (0x2819a000)

I'm pretty sure static libs could do the same at one time, but I can't
find any documentation to back that up.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list