Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 915048

Summary: sys-devel/crossdev: missing musl symbols linker errors with "--llvm --target <arch>-gentoo-linux-musl"
Product: Gentoo Linux Reporter: Siva Mahadevan <account>
Component: Current packagesAssignee: Gentoo Crossdev team <crossdev>
Status: UNCONFIRMED ---    
Severity: normal CC: cat, embedded, lockalsash, toolchain
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
crossdev --llvm --target aarch64-gentoo-linux-musl
crossdev --llvm --target riscv64-gentoo-linux-musl

Description Siva Mahadevan 2023-10-01 19:05:55 UTC
Created attachment 871956 [details]
emerge --info

When using crossdev to install the llvm+musl toolchain for aarch64 and riscv64 (possibly others, these are the ones I've tested), I'm getting these missing symbol errors:

ld.lld: error: undefined symbol: __subtf3
>>> referenced by cacosl.c
>>>               obj/src/complex/cacosl.lo:(cacosl)
>>> referenced by casinl.c
>>>               obj/src/complex/casinl.lo:(casinl)
>>> referenced by catanl.c
>>>               obj/src/complex/catanl.lo:(catanl)
>>> referenced 126 more times

ld.lld: error: undefined symbol: __extenddftf2
>>> referenced by casinl.c
>>>               obj/src/complex/casinl.lo:(casinl)
>>> referenced by casinl.c
>>>               obj/src/complex/casinl.lo:(casinl)
>>> referenced by ccoshl.c
>>>               obj/src/complex/ccoshl.lo:(ccoshl)
>>> referenced 137 more times

[...]

The commands used to install these toolchains are:
$ crossdev --llvm --target aarch64-gentoo-linux-musl
$ crossdev --llvm --target riscv64-gentoo-linux-musl

System installed LLVM version: 17.0.1
System installed musl version: 1.2.4

I'm running the musl+clang+openrc gentoo system profile on my build machine.

Will attach the full build logs for both runs in following comments
Comment 1 Siva Mahadevan 2023-10-01 19:08:47 UTC
Created attachment 871957 [details]
crossdev --llvm --target aarch64-gentoo-linux-musl
Comment 2 Siva Mahadevan 2023-10-01 19:09:09 UTC
Created attachment 871958 [details]
crossdev --llvm --target riscv64-gentoo-linux-musl
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-02 13:51:09 UTC
LLVM support for crossdev is very new indeed, fwiw. I'm not super surprised there's some bugs, although I thought arm64 built fine before.

catcream: can you take a look?
Comment 4 Alfred Persson 2023-10-03 05:01:22 UTC
Seems like an issue with compiler-rt.

> checking whether linker accepts -lcompiler_rt... no
> checking whether linker accepts /usr/lib/llvm/16/bin/../../../../lib/clang/16/lib/linux/libclang_rt.builtins-aarch64.a... no


Could you try manually emerging '=cross_llvm-aarch64-gentoo-linux-musl/compiler-rt-17'? This could be an issue where you've unmasked sys-libs/compiler-rt:17 (and other llvm17 things) and not cross_llvm-aarch64-gentoo-linux-musl/compiler-rt. I can take a closer look next week.
Comment 5 Siva Mahadevan 2023-10-03 13:04:50 UTC
I already had '=cross_llvm-aarch64-gentoo-linux-musl/compiler-rt-17.0.1' installed on the system successfully. I re-emerged just for good measure, but the same error occurs.

> This could be an issue where you've unmasked sys-libs/compiler-rt:17 (and other llvm17 things)

I don't have any custom masking configuration on my system.
Comment 6 Sv. Lockal 2024-05-31 11:05:49 UTC
I had the same issue. For some reason, `crossdev --stable --llvm --target aarch64-gentoo-linux-musl` installed compiler-rt-18, while using clang-17 toolchain. I did not do any manual or auto unmasking for any cross* package, and even though I have systemwide sys-devel/clang-18, not sure why it affected cross_llvm* version.

Anyways, this fixed the issue for me:

  emerge -va cross_llvm-aarch64-gentoo-linux-musl/compiler-rt:17
  # rerun crossdev ...

I did not remove cross_llvm-aarch64-gentoo-linux-musl/compiler-rt:18, but I guess it does nothing.