Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracker]: Some packages cannot be built because -no-undefined-version is enabled by default in lld-17 #18810

Closed
licy183 opened this issue Dec 24, 2023 · 7 comments
Labels

Comments

@licy183
Copy link
Member

licy183 commented Dec 24, 2023

Problem description

Some packages declare more symbols than they should declare in version script, and cause problem when these packages are built with lld-17.

A workaround for this is passing -Wl,--undefined-version to LDFLAGS, but it doesn't seem to be a proper way.

What steps will reproduce the bug?

Rebuild a package.

Package list

package origin issue upstream issue workaround fix upstream fix
binutils(-libs) #18750 - #18813 - -
libffi #18804 libffi/libffi#801 - #18806 √ (not released yet)
libgcrypt #18761 - #18814 - -
libtbb #18529 oneapi-src/oneTBB#1274 #18530 - -
mesa - - - #18337 √ (not released yet)
pulseaudio #18977 - #18981 - -
zlib #18529 - a321371 - -
@gouravkhunger
Copy link
Contributor

@licy183 Similar issue in libxslt too:

...
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-17: error: linker command failed with exit code 1 (use -v to see invocation)
...
make: *** [Makefile:1005: all] Error 2
Failed to build package 'libxslt' for arch 'aarch64'
[*] Building 'libxslt' exited with exit code 2
##[error]Process completed with exit code 2.

@licy183
Copy link
Member Author

licy183 commented Dec 25, 2023

libctf only exists in binutils-libs, so this is not related to libxslt.

@twaik
Copy link
Member

twaik commented Dec 25, 2023

Duplicating it here.
Libgcrypt can not be built, error:

libtool: link: aarch64-linux-android-clang -fstack-protector-strong -Oz -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o dumpsexp dumpsexp-dumpsexp.o  -L/data/data/com.termux/files/usr/lib -fopenmp
libtool: link: aarch64-linux-android-clang -DSTANDALONE -fstack-protector-strong -Oz -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o hmac256 hmac256-hmac256.o  -L/data/data/com.termux/files/usr/lib -fopenmp
/bin/bash ../libtool  --tag=CC   --mode=link aarch64-linux-android-clang -I/data/data/com.termux/files/usr/include  -fstack-protector-strong -Oz -fvisibility=hidden -fno-delete-null-pointer-checks -Wall    -Wl,--version-script=/home/builder/.termux-build/libgcrypt/src/src/libgcrypt.vers -version-info 24:3:4 -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -o libgcrypt.la -rpath /data/data/com.termux/files/usr/lib libgcrypt_la-visibility.lo libgcrypt_la-misc.lo libgcrypt_la-global.lo libgcrypt_la-sexp.lo libgcrypt_la-hwfeatures.lo libgcrypt_la-stdmem.lo libgcrypt_la-secmem.lo libgcrypt_la-missing-string.lo libgcrypt_la-fips.lo libgcrypt_la-context.lo libgcrypt_la-const-time.lo  libgcrypt_la-hwf-arm.lo ../cipher/libcipher.la ../random/librandom.la ../mpi/libmpi.la ../compat/libcompat.la  -L/data/data/com.termux/files/usr/lib -lgpg-error 
libtool: link: aarch64-linux-android-clang -shared  -fPIC -DPIC  .libs/libgcrypt_la-visibility.o .libs/libgcrypt_la-misc.o .libs/libgcrypt_la-global.o .libs/libgcrypt_la-sexp.o .libs/libgcrypt_la-hwfeatures.o .libs/libgcrypt_la-stdmem.o .libs/libgcrypt_la-secmem.o .libs/libgcrypt_la-missing-string.o .libs/libgcrypt_la-fips.o .libs/libgcrypt_la-context.o .libs/libgcrypt_la-const-time.o .libs/libgcrypt_la-hwf-arm.o  -Wl,--whole-archive ../cipher/.libs/libcipher.a ../random/.libs/librandom.a ../mpi/.libs/libmpi.a ../compat/.libs/libcompat.a -Wl,--no-whole-archive  -L/data/data/com.termux/files/usr/lib -lgpg-error  -fstack-protector-strong -Oz -Wl,--version-script=/home/builder/.termux-build/libgcrypt/src/src/libgcrypt.vers -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now   -fopenmp -Wl,-soname -Wl,libgcrypt.so -o .libs/libgcrypt.so
ld.lld: error: version script assignment of 'GCRYPT_1.6' to symbol 'gcry_md_get' failed: symbol not defined
ld.lld: error: version script assignment of 'GCRYPT_1.6' to symbol 'gcry_pk_register' failed: symbol not defined
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)

#18761

@twaik
Copy link
Member

twaik commented Dec 25, 2023

Updating scite to 5.4.0 (current 5.3.8) fails with

aarch64-linux-android-clang++  -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -rdynamic -Wl,--as-needed -Wl,-rpath,'${ORIGIN}' -Wl,--version-script ./lua.vers -Wl,-rpath,/data/data/com.termux/files/usr/lib/scite SciTEGTK.o Strips.o GUIGTK.o Widget.o DirectorExtension.o Cookie.o Credits.o EditorConfig.o ExportHTML.o ExportPDF.o ExportRTF.o ExportTEX.o ExportXML.o FilePath.o FileWorker.o IFaceTable.o JobQueue.o LexillaAccess.o MatchMarker.o MultiplexExtension.o PathMatch.o PropSetFile.o ScintillaCall.o ScintillaWindow.o SciTEBase.o SciTEBuffers.o SciTEIO.o SciTEProps.o StringHelpers.o StringList.o StyleDefinition.o StyleWriter.o Utf8_16.o -o ../bin/SciTE -L/data/data/com.termux/files/usr/lib -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -pthread -lgmodule-2.0 -pthread -lglib-2.0 -lm -lstdc++ -ldl -L ../../scintilla/bin -lscintilla 
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_absindex' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_arith' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_atpanic' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_callk' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_checkstack' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_close' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_compare' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_concat' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_copy' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_createtable' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_dump' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_error' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_gc' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_getallocf' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_getfield' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_getglobal' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_gethook' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_gethookcount' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_gethookmask' failed: symbol not defined
ld.lld: error: version script assignment of 'VERS_1.0' to symbol 'lua_geti' failed: symbol not defined
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [makefile:158: ../bin/SciTE] Error 1

@brad0
Copy link

brad0 commented Jan 4, 2024

cc @MaskRay

haampie added a commit to spack/spack that referenced this issue Jun 12, 2024
lld 17 and higher error by default when a symbol is versioned with a
non-existing version.

That change exposed various issues in different packages:

gentoo/gentoo#29097 (comment)
termux/termux-packages#18810
zlib-ng/zlib-ng#1421

The issue was fixed in zlib-ng 2.1.2, so adding the flag
`-Wl,--undefined-version` unconditionally only hides possible
regressions in the package going forward. Further, use of `%cce@17` may
not imply use of `lld` as a linker.

I would suggest not to deal with `-Wl,--(no-)undefined-version` flags in
Spack, because we don't control the choice of linker anyways -- it's not
in the dag & we don't add -fuse-ld / -ld-path / -B type of LDFLAGS.

Instead, fix the relevant packages if they fail to build.
@truboxl
Copy link
Contributor

truboxl commented Aug 20, 2024

I think can close this

@Biswa96
Copy link
Member

Biswa96 commented Aug 20, 2024

The latest victim of this issue was libbsd 344f345

@licy183 licy183 closed this as completed Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants