Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  2 Apr 2009 04:26:37 +0400 (MSD)
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        nork@FreeBSD.org
Subject:   ports/133291: [PATCH] graphics/ilmbase: produces library not linked with threads
Message-ID:  <20090402002637.986E010883C@hades.panopticon>
Resent-Message-ID: <200904020030.n320U0Do008861@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         133291
>Category:       ports
>Synopsis:       [PATCH] graphics/ilmbase: produces library not linked with threads
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 02 00:30:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sat Mar 21 18:50:30 MSK 2009
>Description:
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  
/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
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090402002637.986E010883C>