Hello,
I am using LLVM 14.0.4 to cross build musl libc, below is the build command that I use:
./configure CC="clang --target=aarch64-linux-gnu" --target=aarch64-linux-gnu CFLAGS="--rtlib=compiler-rt" AR=/usr/local/llvm-14.0.3/bin/llvm-ar RANLIB=/usr/local/llvm-14.0.3/bin/llvm-ranlib --syslibdir=/usr/local/lib LIBCC=-L/usr/local/llvm-14.0.3/lib/clang/14.0.3/lib/linux LDFLAGS="-fuse-ld=lld"
make
But it report the below error:
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 casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced 102 more times
ld.lld: error: undefined symbol: __addtf3
>>> referenced by casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced by casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced 261 more times
ld.lld: error: undefined symbol: __multf3
>>> referenced by casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced by casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced by casinl.c
>>> obj/src/complex/casinl.lo:(casinl)
>>> referenced 244 more times
ld.lld: error: undefined symbol: __divtf3
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced 22 more times
ld.lld: error: undefined symbol: __getf2
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced 5 more times
ld.lld: error: undefined symbol: __fixtfdi
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by __rem_pio2l.c
>>> obj/src/math/__rem_pio2l.lo:(__rem_pio2l)
>>> referenced by llrintl.c
>>> obj/src/math/llrintl.lo:(llrintl)
>>> referenced 3 more times
ld.lld: error: undefined symbol: __floatditf
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
ld.lld: error: undefined symbol: __trunctfsf2
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by atanhl.c
>>> obj/src/math/atanhl.lo:(atanhl)
>>> referenced 7 more times
ld.lld: error: undefined symbol: __extendsftf2
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by catanl.c
>>> obj/src/complex/catanl.lo:(catanl)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced 3 more times
ld.lld: error: undefined symbol: __trunctfdf2
>>> referenced by ccoshl.c
>>> obj/src/complex/ccoshl.lo:(ccoshl)
>>> referenced by ccoshl.c
>>> obj/src/complex/ccoshl.lo:(ccoshl)
>>> referenced by cexpl.c
>>> obj/src/complex/cexpl.lo:(cexpl)
>>> referenced 31 more times
ld.lld: error: undefined symbol: __extenddftf2
>>> referenced by ccoshl.c
>>> obj/src/complex/ccoshl.lo:(ccoshl)
>>> referenced by ccoshl.c
>>> obj/src/complex/ccoshl.lo:(ccoshl)
>>> referenced by cexpl.c
>>> obj/src/complex/cexpl.lo:(cexpl)
>>> referenced 39 more times
ld.lld: error: undefined symbol: __muldc3
>>> referenced by cpow.c
>>> obj/src/complex/cpow.lo:(cpow)
>>> referenced by csqrt.c
>>> obj/src/complex/csqrt.lo:(csqrt)
ld.lld: error: undefined symbol: __mulsc3
>>> referenced by cpowf.c
>>> obj/src/complex/cpowf.lo:(cpowf)
ld.lld: error: undefined symbol: __unordtf2
>>> referenced by cpowl.c
>>> obj/src/complex/cpowl.lo:(cpowl)
>>> referenced by cpowl.c
>>> obj/src/complex/cpowl.lo:(cpowl)
>>> referenced by vfprintf.c
>>> obj/src/stdio/vfprintf.lo:(printf_core)
ld.lld: error: undefined symbol: __multc3
>>> referenced by cpowl.c
>>> obj/src/complex/cpowl.lo:(cpowl)
ld.lld: error: undefined symbol: __floatsitf
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced 15 more times
ld.lld: error: undefined symbol: __floatunsitf
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced 6 more times
ld.lld: error: undefined symbol: __netf2
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(hexfloat)
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(hexfloat)
>>> referenced 21 more times
ld.lld: error: undefined symbol: __eqtf2
>>> referenced by floatscan.c
>>> obj/src/internal/floatscan.lo:(__floatscan)
>>> referenced by acosl.c
>>> obj/src/math/acosl.lo:(acosl)
>>> referenced by asinl.c
>>> obj/src/math/asinl.lo:(asinl)
>>> referenced 15 more times
ld.lld: error: undefined symbol: __lttf2
>>> referenced by __rem_pio2l.c
>>> obj/src/math/__rem_pio2l.lo:(__rem_pio2l)
>>> referenced by __tanl.c
>>> obj/src/math/__tanl.lo:(__tanl)
>>> referenced by __tanl.c
>>> obj/src/math/__tanl.lo:(__tanl)
>>> referenced 18 more times
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
Since I think those undefined symbols e.g., __subtf3 should be in the compiler-rt, do it mean that lld failed to find compiler-rt library? But I have used the build option “LIBCC=-L/usr/local/llvm-14.0.3/lib/clang/14.0.3/lib/linux” to specify the compiler runtime library, is there anything else I should do? Thanks!