[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-ports
Subject:    the right way to link pthread into shared libraries?
From:       Mikhail Teterin <mi+mill () aldan ! algebra ! com>
Date:       2007-09-26 17:47:07
Message-ID: 200709261347.08174.mi+mill () aldan ! algebra ! com
[Download RAW message or body]

Hello!

I was always under the impression, that using ${PTHREAD_LIBS} on
compiler's command line would produce a library, which is properly
linked with the correct threading implementation.

Unfortunately, that does not seem to be the case:

/bin/sh /opt/bin/libtool --tag=CXX --mode=link c++ -pipe -O2 -fno-strict-aliasing \
-pipe -march=opteron -D_THREAD_SAFE    -o libIlmThread.la -rpath /opt/lib \
-version-info 4:0:0 -no-undefined IlmThreadPool.lo IlmThread.lo IlmThreadSemaphore.lo \
IlmThreadMutex.lo IlmThreadPosix.lo IlmThreadSemaphorePosix.lo \
IlmThreadSemaphorePosixCompat.lo IlmThreadMutexPosix.lo ../Iex/libIex.la -pthread  \
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,/var/ports/graphics/OpenEXR/work/openexr-1.4.0/Iex/.libs -Wl,--rpath -Wl,/opt/lib \
../Iex/.libs/libIex.so -pthread -L/usr/lib -lstdc++ -lm -lgcc_pic /usr/lib/crtendS.o \
/usr/lib/crtn.o  -march=opteron -pthread -pthread -pthread -Wl,-soname \
-Wl,libIlmThread.so.4 -o .libs/libIlmThread.so.4 (cd .libs && rm -f libIlmThread.so \
&& ln -s libIlmThread.so.4 libIlmThread.so) (cd .libs && rm -f libIlmThread.so && ln \
-s libIlmThread.so.4 libIlmThread.so) ar cru .libs/libIlmThread.a  IlmThreadPool.o \
IlmThread.o IlmThreadSemaphore.o IlmThreadMutex.o IlmThreadPosix.o \
IlmThreadSemaphorePosix.o IlmThreadSemaphorePosixCompat.o IlmThreadMutexPosix.o \
ranlib .libs/libIlmThread.a creating libIlmThread.la
(cd .libs && rm -f libIlmThread.la && ln -s ../libIlmThread.la libIlmThread.la)
mi@aldan:work/openexr-1.4.0/IlmThread (1403) ldd .libs/libIlmThread.so.4
.libs/libIlmThread.so.4:
        libIex.so.4 => \
/var/ports/graphics/OpenEXR/work/openexr-1.4.0/Iex/.libs/libIex.so.4 (0x800943000)  \
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x800a59000)  libm.so.4 => /lib/libm.so.4 \
(0x800c50000)

Although `-pthread' can be seen several times on the command line,
the resulting executable is NOT linked with libpthread.so and the
pthread_* functions called from the library are left undefined...

Please, advise. Thanks!

 -mi
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic