libtool
[Top][All Lists]
Advanced

[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.


References:

[1] http://lists.gnu.org/archive/html/libtool/2005-12/msg00060.html
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
[3] See Paul mail on 29.04 20:56
http://groups.google.com/group/comp.programming.threads/browse_thread/thread/5243754283a02465/5d73e8a1425663fe
[4] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31774
[5] See attachment where -lpthread is added explicitly:
    http://bugs.gentoo.org/132473

-- 
Peter.

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


reply via email to

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