Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 834490 - sys-libs/compiler-rt-sanitizers-13.0.1 /usr/bin/x86_64-pc-linux-gnu-ld: cannot find -l:libunwind.so
Summary: sys-libs/compiler-rt-sanitizers-13.0.1 /usr/bin/x86_64-pc-linux-gnu-ld: canno...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
: 835076 846965 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-03-02 15:12 UTC by Mamadou Babaei
Modified: 2022-11-06 12:56 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,3.37 KB, text/x-log)
2022-03-02 15:12 UTC, Mamadou Babaei
Details
emerge --info (emerge-info.txt,6.20 KB, text/plain)
2022-03-02 15:12 UTC, Mamadou Babaei
Details
.tar.xz compressed build log (build.log.tar.xz,28.81 KB, application/x-xz)
2022-03-02 17:45 UTC, Mamadou Babaei
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mamadou Babaei 2022-03-02 15:12:28 UTC
I usually build my LLVM toolchain using the following (at least up to a month ago it worked). But on a new install it won't:

$ echo 'sys-devel/clang default-compiler-rt default-libcxx static-analyzer WebAssembly' > /etc/portage/package.use/sys-devel_clang
$ echo 'sys-devel/clang-runtime compiler-rt -crt libcxx openmp sanitize' > /etc/portage/package.use/sys-devel_clang-runtime
$ echo 'sys-devel/llvm -exegesis gold libedit libffi ncurses sanitize xar xml WebAssembly' > /etc/portage/package.use/sys-devel_llvm
$ echo 'sys-libs/compiler-rt clang' > /etc/portage/package.use/sys-libs_compiler-rt
$ echo 'sys-libs/libcxx libcxxabi -libcxxrt -libunwind' > /etc/portage/package.use/sys-libs_libcxx
$ echo 'sys-libs/libcxxabi -libunwind' > /etc/portage/package.use/sys-libs_libcxxabi
$ echo 'sys-libs/libunwind debug-frame -libatomic lzma static-libs' > /etc/portage/package.use/sys-libs_libunwind

# static libs are required with libs that statically depend on libunwind
$ echo 'app-arch/xz-utils static-libs' > /etc/portage/package.use/app-arch_xz-utils

$ emerge -atuv sys-devel/llvm sys-devel/clang dev-util/lldb sys-devel/lld
$ emerge -1atv app-arch/xz-utils sys-libs/zlib

Then, doing:

$ emerge -auDN @world

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-libs/compiler-rt-sanitizers-13.0.1  USE="asan cfi clang dfsan gwp-asan hwasan libfuzzer lsan memprof msan orc profile safestack scudo tsan ubsan xray -debug (-shadowcallstack) -test" ABI_X86="32 (64)" 
[ebuild  N     ] sys-devel/clang-runtime-13.0.1  USE="compiler-rt libcxx openmp sanitize" ABI_X86="32 (64) (-x32)" 

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests
>>> Running pre-merge checks for sys-libs/compiler-rt-sanitizers-13.0.1
>>> Emerging (1 of 2) sys-libs/compiler-rt-sanitizers-13.0.1::gentoo
>>> Failed to emerge sys-libs/compiler-rt-sanitizers-13.0.1, Log file:
>>>  '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/temp/build.log'
>>> Jobs: 0 of 2 complete, 1 failed                 Load avg: 0.33, 0.41, 0.86
*** Resuming merge...
Calculating dependencies... done!
 * emerge --keep-going: sys-devel/clang-runtime-13.0.1 dropped because it
 * requires ~sys-libs/compiler-rt-sanitizers-13.0.1:13.0.1

 * Messages for package sys-libs/compiler-rt-sanitizers-13.0.1:

 * ERROR: sys-libs/compiler-rt-sanitizers-13.0.1::gentoo failed (compile phase):
 *   ninja -v -j17 -l16 failed
 * 
 * Call stack:
 *     ebuild.sh, line  127:  Called src_compile
 *   environment, line 3560:  Called cmake_src_compile
 *   environment, line 1523:  Called cmake_build
 *   environment, line 1492:  Called eninja
 *   environment, line 2012:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 
 * If you need support, post the output of `emerge --info '=sys-libs/compiler-rt-sanitizers-13.0.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-libs/compiler-rt-sanitizers-13.0.1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/work/compiler-rt_build'
 * S: '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/work/compiler-rt'

 * Messages for package sys-devel/clang-runtime-13.0.1:

 * emerge --keep-going: sys-devel/clang-runtime-13.0.1 dropped because it
 * requires ~sys-libs/compiler-rt-sanitizers-13.0.1:13.0.1
 * 
 * The following 2 packages have failed to build, install, or execute
 * postinst:
 * 
 *  (sys-libs/compiler-rt-sanitizers-13.0.1:13.0.1/13.0.1::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.1/temp/build.log'
 *  (sys-devel/clang-runtime-13.0.1:13.0.1/13.0.1::gentoo, ebuild scheduled for merge)
 * 


Reproducible: Always
Comment 1 Mamadou Babaei 2022-03-02 15:12:42 UTC
Created attachment 766153 [details]
build log
Comment 2 Mamadou Babaei 2022-03-02 15:12:55 UTC
Created attachment 766154 [details]
emerge --info
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-02 16:34:52 UTC
You've attached the log from bug 834489.
Comment 4 Mamadou Babaei 2022-03-02 17:43:36 UTC
Sorry! I'll rebuild and reattach.
Comment 5 Mamadou Babaei 2022-03-02 17:45:08 UTC
Created attachment 766161 [details]
.tar.xz compressed build log
Comment 6 Arfrever Frehtes Taifersar Arahesis 2022-03-02 23:18:01 UTC
Probably your version of sys-libs/libunwind or sys-libs/llvm-libunwind is installed only for 64-bit ABI.

Error "cannot find -l:libunwind.so" occurred during building of 32-bit library.

You said that you use sys-devel/clang[default-compiler-rt,default-libcxx].


Ebuilds of sys-devel/clang need:
-	~sys-devel/clang-runtime-${PV}
+	~sys-devel/clang-runtime-${PV}[${MULTILIB_USEDEP}]
 	default-compiler-rt? (
-		=sys-libs/compiler-rt-${PV%_*}*
+		=sys-libs/compiler-rt-${PV%_*}*[${MULTILIB_USEDEP}]
-		llvm-libunwind? ( sys-libs/llvm-libunwind )
+		llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] )
-		!llvm-libunwind? ( sys-libs/libunwind )
+		!llvm-libunwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
 	)
-	default-libcxx? ( >=sys-libs/libcxx-${PV} )
+	default-libcxx? ( >=sys-libs/libcxx-${PV}[${MULTILIB_USEDEP}] )
Comment 7 Arfrever Frehtes Taifersar Arahesis 2022-03-02 23:35:23 UTC
sys-libs/compiler-rt has abi_x86_32 and abi_x86_64 USE flags, but not other abi_* USE flags, so:

-	~sys-devel/clang-runtime-${PV}
+	~sys-devel/clang-runtime-${PV}[${MULTILIB_USEDEP}]
 	default-compiler-rt? (
-		=sys-libs/compiler-rt-${PV%_*}*
+		=sys-libs/compiler-rt-${PV%_*}*[abi_x86_32?,abi_x86_64?]
-		llvm-libunwind? ( sys-libs/llvm-libunwind )
+		llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] )
-		!llvm-libunwind? ( sys-libs/libunwind )
+		!llvm-libunwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
 	)
-	default-libcxx? ( >=sys-libs/libcxx-${PV} )
+	default-libcxx? ( >=sys-libs/libcxx-${PV}[${MULTILIB_USEDEP}] )
Comment 8 Mamadou Babaei 2022-03-03 14:06:23 UTC
Thank you! I'm not sure what went wrong. I'll investigate carefully and let you know. But, I've copied the same config files from another machine, which I don't have access to anymore.
Comment 9 Mamadou Babaei 2022-03-03 14:13:25 UTC
Do you have any suggestions on how to fix this? I guess in the pass portage added something to /etc/portage/package.use/zz-autounmask automatically.
Comment 10 Mamadou Babaei 2022-03-03 14:19:48 UTC
Ah, OK you are right. Now I see:

emerge -atv sys-libs/libunwind

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild   R    ] sys-libs/libunwind-1.6.2:0/8::gentoo  USE="debug-frame lzma static-libs zlib -debug -doc -libatomic -test" ABI_X86="(64) -32 (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] 

I guess I have to add abi_x86_32 use flag?
Comment 11 Mamadou Babaei 2022-03-03 14:24:17 UTC
I just went to an older machine and it has this inside zz-autounnmask:

# required by app-emulation/wine-vanilla-5.5::gentoo[unwind]
# required by @selected
# required by @world (argument)
>=sys-libs/libunwind-1.4.0 abi_x86_32
# required by sys-libs/libunwind-1.4.0::gentoo[lzma]
# required by app-emulation/wine-vanilla-5.5::gentoo[unwind]
# required by @selected
# required by @world (argument)
>=app-arch/xz-utils-5.2.5 abi_x86_32

Perhaps, portage somehow did not manage to do the same on this machine. I'll try to add those flags, rebuild, and let you know.
Comment 12 Mamadou Babaei 2022-03-03 14:28:47 UTC
After adding:

echo '# abi_x86_32 abi_x86_64 is a remedy for https://bugs.gentoo.org/834490' > /etc/portage/package.use/sys-libs_libunwind
echo 'sys-libs/libunwind abi_x86_32 abi_x86_64 debug-frame -libatomic lzma static-libs' >> /etc/portage/package.use/sys-libs_libunwind

Emerge shows:

Calculating dependencies... done!
[ebuild   R    ] app-arch/xz-utils-5.2.5-r1  ABI_X86="32*" 
[ebuild   R    ] sys-libs/zlib-1.2.11-r4  ABI_X86="32*" 
[ebuild   R    ] sys-libs/libunwind-1.6.2  ABI_X86="32*" 
[ebuild  N     ] sys-libs/compiler-rt-sanitizers-13.0.1  USE="asan cfi clang dfsan gwp-asan hwasan libfuzzer lsan memprof msan orc profile safestack scudo tsan ubsan xray -debug (-shadowcallstack) -test" ABI_X86="32 (64)" 
[ebuild  N     ] sys-devel/clang-runtime-13.0.1  USE="compiler-rt libcxx openmp sanitize" ABI_X86="32 (64) (-x32)" 

The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by sys-libs/libunwind-1.6.2::gentoo[lzma]
# required by net-fs/samba-4.15.5-r1::gentoo
# required by net-fs/cifs-utils-6.13-r1::gentoo[acl]
# required by @selected
# required by @world (argument)
>=app-arch/xz-utils-5.2.5-r1 abi_x86_32
# required by sys-libs/libunwind-1.6.2::gentoo[zlib]
# required by net-fs/samba-4.15.5-r1::gentoo
# required by net-fs/cifs-utils-6.13-r1::gentoo[acl]
# required by @selected
# required by @world (argument)
>=sys-libs/zlib-1.2.11-r4 abi_x86_32

Autounmask changes successfully written.

 * IMPORTANT: config file '/etc/portage/package.use/zz-autounmask' needs updating.
 * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
 * sections of the emerge man page to learn how to update config files.
Comment 13 Mamadou Babaei 2022-03-03 14:37:17 UTC
Thank you very much! It worked!
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-03-15 11:21:42 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #7)
> sys-libs/compiler-rt has abi_x86_32 and abi_x86_64 USE flags, but not other
> abi_* USE flags, so:
> 
> -	~sys-devel/clang-runtime-${PV}
> +	~sys-devel/clang-runtime-${PV}[${MULTILIB_USEDEP}]
>  	default-compiler-rt? (
> -		=sys-libs/compiler-rt-${PV%_*}*
> +		=sys-libs/compiler-rt-${PV%_*}*[abi_x86_32?,abi_x86_64?]
> -		llvm-libunwind? ( sys-libs/llvm-libunwind )
> +		llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] )
> -		!llvm-libunwind? ( sys-libs/libunwind )
> +		!llvm-libunwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
>  	)
> -	default-libcxx? ( >=sys-libs/libcxx-${PV} )
> +	default-libcxx? ( >=sys-libs/libcxx-${PV}[${MULTILIB_USEDEP}] )

Multilib flags on clang are for building clang libraries, not controlling target runtimes.  Target runtimes are handled via clang-runtime.
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-03-15 11:22:36 UTC
I've added additional USE deps to clang-runtime @ 2022-03-06.  I think that's the best we can do here.
Comment 16 Arfrever Frehtes Taifersar Arahesis 2022-03-15 18:16:55 UTC
Reporter of this bug (as mentioned in comment #0) has sys-libs/libcxxabi[-libunwind] and sys-libs/libcxx[-libunwind] for unknown reasons.

Such libc++abi.so and libc++.so would not be linked against libunwind.so and chain of dependencies from sys-devel/clang-runtime down to sys-libs/libcxxabi would not require sys-libs/libunwind or sys-libs/llvm-libunwind (so no [${MULTILIB_USEDEP}] would be enforced).

But `clang` tool from sys-devel/clang[default-compiler-rt] would internally still pass -l:libunwind.so flag (or -l:libunwind.a when static linking) to linker, which requires library present for correct ABI:
https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/ToolChains/CommonArgs.cpp#L1445-L1463


I think that having more complete dependencies directly for default-compiler-rt and default-libcxx would not be actually bad...
But if this idea is still not liked, then maybe sys-devel/clang-runtime should gain libunwind USE flag:
  libunwind? (
    llvm-libunwind? ( >=sys-libs/llvm-libunwind-${PV}[${MULTILIB_USEDEP}] )
    !llvm-libunwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
  )

And sys-devel/clang could depend on sys-devel/clang-runtime with appropriate USE flags:

  default-compiler-rt? ( ~sys-devel/clang-runtime-${PV}[compiler-rt,libunwind] )
  default-libcxx? ( ~sys-devel/clang-runtime-${PV}[libcxx] )


(With random combinations of USE flags, problem is still reproducible after 2022-03-06. Bug #835076 is most likely duplicate of this bug.)
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-16 02:15:00 UTC
*** Bug 835076 has been marked as a duplicate of this bug. ***
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-23 04:33:46 UTC
*** Bug 846965 has been marked as a duplicate of this bug. ***