PThread Issue: -pthread vs. -lpthread for a new port

Ulrich Spoerlein q at uni.de
Mon Jan 3 17:56:27 GMT 2005


On Mon, 03.01.2005 at 16:36:36 +0100, Michael Nottebrock wrote:
> > And running a ruby program requiring wxruby I get this error:
> > /libexec/ld-elf.so.1: /usr/local/lib/libgthread-2.0.so.400: Undefined
> > symbol "pthread_getschedparam"
> 
> This is expected: When shared libraries are linked with -pthread, the linker 
> only resolves the necessary symbols but does not emit a DT_NEEDED symbol for 
> the resulting shared library, it only does for programs.
> 
> Bottom line: Pthread symbols must always be resolved through the actual 
> program. Make sure the program that uses wxruby is linked with -pthread as 
> well.

wxruby.so get's loaded by ruby on demand. That is when using 'require
wxruby'. I'm pretty sure we don't want to link pthread into ruby itself.

% irb
irb(main):001:0> require "wxruby"
/libexec/ld-elf.so.1: /usr/local/lib/libgthread-2.0.so.400: Undefined symbol "pthread_getschedparam"

% LD_PRELOAD=/usr/lib/libpthread.so.1 irb
irb(main):001:0> require "wxruby"
=> true
irb(main):002:0>

Preloading libc_r.so works too, of course.

(irb is the interactive ruby shell)

Ulrich Spoerlein
-- 
 PGP Key ID: F0DB9F44				Encrypted mail welcome!
Fingerprint: F1CE D062 0CA9 ADE3 349B  2FE8 980A C6B5 F0DB 9F44
Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
didn't you understand?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050103/25c0bd97/attachment.bin


More information about the freebsd-ports mailing list