dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
99 stars 18 forks source link

Binutils: libctf fails to compile #99

Closed dslm4515 closed 6 months ago

dslm4515 commented 6 months ago

libctf fails to compile:

  CCLD     libctf-nobfd.la
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_set' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_get' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [Makefile:687: libctf.la] Error 1
make[3]: *** Waiting for unfinished jobs....
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_set' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_get' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_arc_open' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_fdopen' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_open' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen_ctfsect' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [Makefile:684: libctf-nobfd.la] Error 1
make[3]: Leaving directory '/sources/binutils-2.40/build/libctf'
make[2]: *** [Makefile:583: all] Error 2
make[2]: Leaving directory '/sources/binutils-2.40/build/libctf'
make[1]: *** [Makefile:12000: all-libctf] Error 2
make[1]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/sources/binutils-2.40/build/gas'
make[3]: Leaving directory '/sources/binutils-2.40/build/gas'
make[2]: Leaving directory '/sources/binutils-2.40/build/gas'
make[1]: Leaving directory '/sources/binutils-2.40/build'
make: *** [Makefile:1005: all] Error 2

Current system linker: /usr/bin/ld (symlink to LLD) Current system compiler: clang (LLVM-17.0.5)

dslm4515 commented 6 months ago

According to bugzilla ticket for binutils:

You are overwriting the ld program in your PATH, which was also configured to use for building.

The problem is installation order: ld is being installed before libctf, but ld uses libctf and thus if libctf is relinked for any reason by the install phase, ld might find itself calling on symbols that aren't in the libctf already present on the system (if it even is there).

if I make /usr/bin/ld unavailable:

mv -v  /usr/bin/ld{,.disabled}  

binutuils compiles with no errors.