Summary: | media-libs/libsoundtouch[openmp] built with clang causes issues with other apps like audacity: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_for_static_fini | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Agostino Sarubbo <ago> |
Component: | Current packages | Assignee: | Gentoo Sound Team <sound> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | fordfrog, richard, sam, telans |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=740396 https://bugs.gentoo.org/show_bug.cgi?id=349078 https://bugs.gentoo.org/show_bug.cgi?id=915833 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 881275 | ||
Bug Blocks: | 731004 | ||
Attachments: |
build.log.xz
1-CMakeError.log 1-CMakeOutput.log |
Description
Agostino Sarubbo
2020-09-04 07:45:36 UTC
Created attachment 658288 [details]
build.log.xz
build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Created attachment 658290 [details]
1-CMakeError.log
1-CMakeError.log
Created attachment 658292 [details]
1-CMakeOutput.log
1-CMakeOutput.log
this is the error (shortened command): [31mFAILED: [0mbin/Gentoo/audacity : && /usr/lib/llvm/10/bin/x86_64-pc-linux-gnu-clang++ -O2 -pipe -march=native -frecord-gcc-switches -fno-diagnostics-color -std=gnu++14 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld -Wl,--export-dynamic -rdynamic ... -o bin/Gentoo/audacity -lm -latomic -ldl lib64/audacity/libportaudio-v19.a lib64/audacity/liblibnyquist.a lib64/audacity/libportmixer.a -lz -lpthread -L/usr/lib64 -pthread /usr/lib64/libwx_gtk3u_adv-3.0-gtk3.so /usr/lib64/libwx_baseu-3.0-gtk3.so /usr/lib64/libwx_gtk3u_core-3.0-gtk3.so /usr/lib64/libwx_gtk3u_html-3.0-gtk3.so /usr/lib64/libwx_baseu_net-3.0-gtk3.so /usr/lib64/libwx_gtk3u_qa-3.0-gtk3.so -lz /usr/lib64/libexpat.so /usr/lib64/libmp3lame.so /usr/lib64/libsoxr.so /usr/lib64/libFLAC++.so /usr/lib64/libFLAC.so /usr/lib64/libvorbis.so /usr/lib64/libvorbisenc.so /usr/lib64/libvorbisfile.so /usr/lib64/liblilv-0.so /usr/lib64/libdl.so /usr/lib64/libsratom-0.so /usr/lib64/libsord-0.so /usr/lib64/libserd-0.so /usr/lib64/libsuil-0.so /usr/lib64/libsndfile.so lib64/audacity/libportaudio-v19.a /usr/lib64/libSoundTouch.so /usr/lib64/libgtk-3.so /usr/lib64/libgdk-3.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libpango-1.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libcairo-gobject.so /usr/lib64/libcairo.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libglib-2.0.so && : ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_for_static_fini ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_for_static_init_4 ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_for_static_init_4u ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_fork_call ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_critical ld.lld: error: /usr/lib64/libSoundTouch.so: undefined reference to __kmpc_end_critical clang-10: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. but i can't reproduce it with the following command (am i missing something?): CC=x86_64-pc-linux-gnu-clang CXX=x86_64-pc-linux-gnu-clang++ LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld" emerge -va1 audacity Stable x86, up-to-date, compiling fails at the same spot last three days. Currently running version 2.2.2. ninja: build stopped: subcommand failed. * ERROR: media-sound/audacity-2.4.2-r1::gentoo failed (compile phase): * ninja -v -j4 -l0 failed I wrote about it with emerge --info on the forums here: https://forums.gentoo.org/viewtopic.php?p=8497778 Also put the full build log as a .txt file here: https://2chronicles36.org/media-sound-audacity-2.4.2-r1-20200906-135527.txt (In reply to Andy Figueroa from comment #5) > Stable x86, up-to-date, compiling fails at the same spot last three days. > Currently running version 2.2.2. > > ninja: build stopped: subcommand failed. > * ERROR: media-sound/audacity-2.4.2-r1::gentoo failed (compile phase): > * ninja -v -j4 -l0 failed > > I wrote about it with emerge --info on the forums here: > https://forums.gentoo.org/viewtopic.php?p=8497778 > > Also put the full build log as a .txt file here: > https://2chronicles36.org/media-sound-audacity-2.4.2-r1-20200906-135527.txt could you please upload the log here? i get something weird from the provided link. according to what i found, it seems to need -openmp option for the linking. is your media-libs/libsoundtouch built with openmp use flag? (In reply to Andy Figueroa from comment #5) > Also put the full build log as a .txt file here: > https://2chronicles36.org/media-sound-audacity-2.4.2-r1-20200906-135527.txt This the wrong bug for you. Please *attach* your logs, not link, to the correct one. Of course this would be greatly improved with a meaningful $summary. This is actually not an issue with Audacity but an issue with libSoundTouch or rather with Clang and it's OpenMP implementation. If you compile libsoundtouch with clang and the LD flag -Wl,-z,defs [1] the compilation will fail. This is because -fopenmp defaults to libGomp which is the GCC implementation. In order to build OpenMP support with clang you need to build with "-fopenmp=libomp"[2]. Obviously you need to have libomp[3] installed for this. So easy, right? Just add "LDFLAGS=${LDFLAGS} -fopenmp=libomp" to an env file. Sadly no. OpenMP is too deep inside the make process and libtool is going to cut the "=libomp". I don't have any good and more importantly clean solution at this point besides recommending to compile OpenMP projects with GCC and Gold. Then again I am also not that familiar with autotools and maybe there is an easy way to do this. [1] https://wiki.gentoo.org/wiki/Project:Quality_Assurance/-Wl,-z,defs_and_-Wl,--no-allow-shlib-undefined [2] https://stackoverflow.com/a/33400688 [3] https://packages.gentoo.org/packages/sys-libs/libomp (In reply to GoGoOtaku from comment #10) > This is actually not an issue with Audacity but an issue with libSoundTouch > or rather with Clang and it's OpenMP implementation. > > If you compile libsoundtouch with clang and the LD flag -Wl,-z,defs [1] the > compilation will fail. This is because -fopenmp defaults to libGomp which is > the GCC implementation. In order to build OpenMP support with clang you need > to build with "-fopenmp=libomp"[2]. Obviously you need to have libomp[3] > installed for this. Unless I'm missing something the default OpenMP implementation for Clang is libomp and has been for a few years now https://github.com/llvm/llvm-project/blob/llvmorg-12.0.0/clang/CMakeLists.txt#L282 Although yes, it seems anything OpenMP only successfully builds with GCC on either of my two systems. Sorry, forgot to share this with you guys! https://github.com/NTULINUX/gentoo_backup/blob/master/etc/portage/package.env # media-sound/audacity: libSoundTouch.so: undefined reference to __kmpc_* media-libs/libsoundtouch openmp.conf https://github.com/NTULINUX/gentoo_backup/blob/master/etc/portage/env/openmp.conf Cheers! In case you guys missed it: /etc/portage/package.env: media-libs/libsoundtouch openmp.conf /etc/portage/env/openmp.conf: CXXFLAGS="-O2 -march=x86-64-v2 -fopenmp=libomp -fPIC -fstack-protector-strong -fstack-clash-protection -fomit-frame-pointer -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" You only really need CXXFLAGS="-O2 -fopenmp=libomp" *** Bug 884781 has been marked as a duplicate of this bug. *** *** Bug 740396 has been marked as a duplicate of this bug. *** *** Bug 885541 has been marked as a duplicate of this bug. *** *** Bug 831175 has been marked as a duplicate of this bug. *** The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4f260fbb7738de5bce902cd54f86cd3a8395561 commit f4f260fbb7738de5bce902cd54f86cd3a8395561 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-24 07:45:41 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-24 07:45:41 +0000 media-libs/libsoundtouch: respect LDFLAGS Closes: https://bugs.gentoo.org/740310 Closes: https://bugs.gentoo.org/881275 Signed-off-by: Sam James <sam@gentoo.org> .../files/libsoundtouch-2.3.2-flags.patch | 18 +++++++ .../libsoundtouch/libsoundtouch-2.3.2-r1.ebuild | 63 ++++++++++++++++++++++ 2 files changed, 81 insertions(+) *** Bug 925758 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=d3c77e47d0c2ae8806b340aabb53947012c239f5 commit d3c77e47d0c2ae8806b340aabb53947012c239f5 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-24 08:29:20 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-24 08:34:20 +0000 patches/openmp: new patch to allow -fopenmp=* Bug: https://bugs.gentoo.org/740310 Signed-off-by: Sam James <sam@gentoo.org> eltpatch.in | 2 +- patches/openmp/2.4.6 | 36 ++++++++++++++++++++++++++++++++++++ patches/openmp/2.4.7 | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0dc7b3c1b26e36133f67b6df8375e375bfde7902 commit 0dc7b3c1b26e36133f67b6df8375e375bfde7902 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-24 08:36:00 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-24 08:36:17 +0000 app-portage/elt-patches: add 20240324 Sam James (1): patches/openmp: new patch to allow -fopenmp=* Bug: https://bugs.gentoo.org/740310 Signed-off-by: Sam James <sam@gentoo.org> app-portage/elt-patches/Manifest | 1 + .../elt-patches/elt-patches-20240324.ebuild | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) To summarise, there were two problems here: 1) libtool filtering -fopenmp=*. If you wanted to use libomp with Clang before it defaulted to it, it would be a pain to specify which impl you wanted. (Still is a problem, but it matters less now because of the default change). 2) libsoundtouch was clobbering LDFLAGS anyway. I've fixed 2) in Gentoo, and I've sent a patch for 1) upstream and fixed it in elt-patches. Reopening for now. I don't see libomp linked with unlike with GCC. Same in bug 740310. Not sure what's going on yet. |