Bug 133291 - [PATCH] graphics/ilmbase: produces library not linked with threads
Summary: [PATCH] graphics/ilmbase: produces library not linked with threads
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Norikatsu Shigemura
Depends on:
Reported: 2009-04-02 01:30 UTC by Dmitry Marakasov
Modified: 2009-09-08 03:30 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov 2009-04-02 01:30:00 UTC
At least libIlmThread built by graphics/ilmbase port uses threads, but is not linked with threading library itself. The cause is likely libtool magic because of which the library is built in a strange way:

c++ -shared -nostdlib /usr/lib/crti.o /usr/lib/crtbeginS.o  .libs/IlmThreadPool.o .libs/IlmThread.o .libs/IlmThreadSemaphore.o .libs/IlmThreadMutex.o .libs/IlmThreadPosix.o .libs/IlmThreadSemaphorePosix.o .libs/IlmThreadSemaphorePosixCompat.o .libs/IlmThreadMutexPosix.o  -Wl,--rpath -Wl,/usr/home/amdmi3/projects/freebsd/ports/graphics/ilmbase/prefix/lib -L/usr/home/amdmi3/projects/freebsd/ports/graphics/ilmbase/prefix/lib -lIex -pthread -L/usr/lib -lstdc++ -lm -lc -lgcc_s /usr/lib/crtendS.o /usr/lib/crtn.o  -march=prescott -pthread -pthread -pthread -Wl,-soname -Wl,libIlmThread.so.6 -o .libs/libIlmThread.so.6

I assume -nostdlib is what causes -pthread not link with -lthr.

% ldd /usr/local/lib/libIlmThread.so  
	libIex.so.6 => /usr/local/lib/libIex.so.6 (0x2819c000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x28300000)
	libm.so.5 => /lib/libm.so.5 (0x281ad000)
	libc.so.7 => /lib/libc.so.7 (0x2808b000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x281c6000)

The results of all this is an inability to directly link to IlmThread:

% gcc 1.cc -lIlmThread -L/usr/local/lib
/usr/local/lib/libIlmThread.so: undefined reference to `pthread_create'

and thus the need to explicitely add -pthread to linker flags in all ports that use ilmbase (at least graphics/nvidia-texture-tools and graphics/devil which depend on it), so I believe this should be fixed in ilmbase. No idea on how to make libtool not use that -nostdlib strangeness though.

Port maintainer (nork@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.77
Comment 1 Edwin Groothuis freebsd_committer 2009-04-02 01:30:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nork

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Dmitry Marakasov freebsd_committer 2009-09-08 03:24:34 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 3 dfilter service freebsd_committer 2009-09-08 03:24:37 UTC
amdmi3      2009-09-08 02:24:26 UTC

  FreeBSD ports repository

  Modified files:
    graphics/OpenEXR     Makefile 
  - Explicitely link with threads library, otherwise it was impossible to link with -lIlmImf (and dependent libraries as well) without -pthread
  PR:             133291
  Submitted by:   myself
  Approved by:    maintainer timeout
  Revision  Changes    Path
  1.37      +5 -1      ports/graphics/OpenEXR/Makefile
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"