[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ shared library misses pthread dependency library

From: Peter Volkov
Subject: C++ shared library misses pthread dependency library
Date: Fri, 04 May 2007 12:26:31 +0400

Hello list.

This question was already asked on this list [1] and gcc bug report
followed [2] but seems that there is no solution still. The problem is
that libtool uses -nostdlib gcc flag during linkage of shared library
which case gcc to drop -lpthread. Hence resulting library misses pthread
dependency and has undefined ptread_* symbols.

While I was assured that shared library with missing dependency on
libpthread should work (just add -lpthread during final executable
linkage and application will use this library without problems) and even
has some advantages over normal library [3] I still think that libtool
should add explicitly -lpthread during linkage of C++ shared libraries.
-lpthread is required for g++ shared library because there is difference
in gcc and g++ which cause final executable linkage problem when
--as-needed ld flag is used and when program to be linked with shared
library does not have pthread_* functions itself [4]. In the current
situation we have to workaround this problem by adding libpthread by
ourselfs like in this bug report [5]. But as libtool should hide
platform specifics from us I think it's better to fix such issues in
first place. On the other hand libtool drops libpthread dependency but
does not restore it.


[3] See Paul mail on 29.04 20:56
[5] See attachment where -lpthread is added explicitly:


Attachment: signature.asc
Description: Эта часть сообщения подписана цифровой подписью

reply via email to

[Prev in Thread] Current Thread [Next in Thread]