Summary: | sys-devel/libtool does not link -lpthread into shared CXX libraries when -pthread is used | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Craig Andrews <candrews> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | candrews, flow, kredba, mattst88, media-video, sam, toolchain, toralf |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://debbugs.gnu.org/cgi/bugreport.cgi?bug=15646 | ||
See Also: |
https://github.com/gentoo/gentoo/pull/7575 https://bugs.gentoo.org/show_bug.cgi?id=499028 https://bugzilla.redhat.com/show_bug.cgi?id=661333 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 618550 | ||
Attachments: |
build.log
libtool-2.4.6-pthread.patch |
Description
Craig Andrews
2018-03-19 13:48:15 UTC
This is another failure due to -flto being enabled. > /usr/lib64/libIlmThread.so: undefined reference to `pthread_create'
I think this but is really underlinking against pthread in media-libs/ilmbase (/usr/lib64/libIlmThread.so) and should be worked around there.
Note there is no libpthread in NEEDED depends:
$ lddtree /usr/lib64/libIlmThread.so
libIlmThread.so => /usr/lib64/libIlmThread.so (interpreter => none)
libIex-2_2.so.12 => /usr/lib64/libIex-2_2.so.12
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/libstdc++.so.6
ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
libm.so.6 => /lib64/libm.so.6
libc.so.6 => /lib64/libc.so.6
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/libgcc_s.so.1
Slightly simpler reproducer on ilmbase:
$ LDFLAGS="$(portageq envvar LDFLAGS) -Wl,--no-undefined" emerge -v1 media-libs/ilmbase
/bin/sh ../libtool --tag=CXX --mode=link x86_64-pc-linux-gnu-g++ -pipe -O2 -pipe -flto -pthread -version-info 12:0:0 -no-undefined -release 2_2 -Wl,-O1 -Wl,--as-needed -O2 -pipe -flto -Wl,--hash-style=gnu -Wl,--no-undefined -o libIlmThread.la -rpath /usr/lib64 IlmThreadPool.lo IlmThread.lo IlmThreadSemaphore.lo IlmThreadMutex.lo IlmThreadPosix.lo IlmThreadSemaphorePosix.lo IlmThreadSemaphorePosixCompat.lo IlmThreadMutexPosix.lo ../Iex/libIex.la -pthread
...
/dev/shm/portage/media-libs/ilmbase-2.2.0-r1/temp/ccHtIfsh.ltrans0.ltrans.o: In function `IlmThread_2_2::Thread::start()':
<artificial>:(.text+0x747): undefined reference to `pthread_create'
> Slightly simpler reproducer on ilmbase:
>
> $ LDFLAGS="$(portageq envvar LDFLAGS) -Wl,--no-undefined" emerge -v1
> media-libs/ilmbase
This fails for me even on non-lto systems.
Vague consensus it's a libtool bug of mis-handling -pthread (-lpthread would work) for c++ libraries: https://bugzilla.redhat.com/show_bug.cgi?id=661333 Upstream bug report: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=15646 Gentoo might want to apply the patch: http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/11704 It's a hack but non-invasive one. Created attachment 525216 [details, diff] libtool-2.4.6-pthread.patch Used this to apply/test the patch: --- a/sys-devel/libtool/libtool-2.4.6-r4.ebuild +++ b/sys-devel/libtool/libtool-2.4.6-r4.ebuild @@ -60,2 +60,3 @@ src_prepare() { epatch "${FILESDIR}"/${PN}-2.4.6-darwin-use-linux-version.patch + epatch "${FILESDIR}"/${PN}-2.4.6-pthread.patch if use prefix ; then @@ -81,3 +82,3 @@ src_prepare() { touch doc/*.1 - export HELP2MAN=false + export HELP2MAN=true fi I guess it will need to be applied to as well https://gitweb.gentoo.org/proj/elt-patches.git/ The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5690e822e589b92b4225c8c8b671ff8db5faf605 commit 5690e822e589b92b4225c8c8b671ff8db5faf605 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2018-03-26 08:37:26 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2018-03-26 08:38:31 +0000 sys-devel/libtool: Revbump to add pthread patch. Bug: https://bugs.gentoo.org/650876 Package-Manager: Portage-2.3.24, Repoman-2.3.6 .../files/libtool-2.4.6-libtoolize-slow.patch | 6 +- .../libtool/files/libtool-2.4.6-pthread.patch | 43 +++++++ .../files/libtool-2.4.6-pthread_bootstrapped.patch | 21 ++++ sys-devel/libtool/libtool-2.4.6-r5.ebuild | 124 +++++++++++++++++++++ sys-devel/libtool/libtool-9999.ebuild | 5 + 5 files changed, 196 insertions(+), 3 deletions(-)} The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61fedd15b0dbf3df6a37eae73cd1e931b17b9220 commit 61fedd15b0dbf3df6a37eae73cd1e931b17b9220 Author: Craig Andrews <candrews@gentoo.org> AuthorDate: 2018-03-24 01:23:08 +0000 Commit: Craig Andrews <candrews@gentoo.org> CommitDate: 2018-03-26 13:51:17 +0000 media-libs/openexr: Strip lto flag Closes: https://bugs.gentoo.org/650876 Package-Manager: Portage-2.3.24, Repoman-2.3.6 media-libs/openexr/openexr-2.2.0-r2.ebuild | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) *** Bug 651630 has been marked as a duplicate of this bug. *** The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=62add71b9ab7a444189d80e00a8eaca179cd1c85 commit 62add71b9ab7a444189d80e00a8eaca179cd1c85 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-12-28 00:54:17 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-12-28 00:56:42 +0000 patches: add cxx-pthread Bug: https://bugs.gentoo.org/650876 Bug: https://debbugs.gnu.org/15646 Signed-off-by: Sam James <sam@gentoo.org> eltpatch.in | 2 +- patches/cxx-pthread/2.4.6 | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0da3af137bae14fe5bec63eda205819e6cbcdf43 commit 0da3af137bae14fe5bec63eda205819e6cbcdf43 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-12-28 01:21:33 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-12-28 01:21:56 +0000 app-portage/elt-patches: add 20231228 Closes: https://bugs.gentoo.org/650876 Signed-off-by: Sam James <sam@gentoo.org> app-portage/elt-patches/Manifest | 1 + .../elt-patches/elt-patches-20231228.ebuild | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) |