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

[16.0-rc2] lld fails to link mesa #60859

Closed
berolinux opened this issue Feb 19, 2023 · 4 comments
Closed

[16.0-rc2] lld fails to link mesa #60859

berolinux opened this issue Feb 19, 2023 · 4 comments
Labels
invalid Resolved as invalid, i.e. not a bug lld

Comments

@berolinux
Copy link

Linking mesa 23.0.0-rc5 with lld 16.0-rc2 results in

ld.lld: error: version script assignment of 'global' to symbol 'HMI' failed: symbol not defined

(building it with clang 16.0-rc2 using -fuse-ld=gold succeeds, as does using lld 15.0.7).

@ms178
Copy link

ms178 commented Feb 19, 2023

I've seen similar errors with a slightly older Clang-16 snapshot: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8003

Using mold with ulimit -n 9999, it succeeds.

@MaskRay
Copy link
Member

MaskRay commented Feb 19, 2023

This is a Mesa version script bug that some symbols are not defined. Use https://gitlab.freedesktop.org/mesa/mesa/-/issues/8003 to track it. You can work around it with -Wl,--undefined-version.

@MaskRay MaskRay closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2023
@MaskRay MaskRay added the invalid Resolved as invalid, i.e. not a bug label Feb 19, 2023
@berolinux
Copy link
Author

Similar things happen when trying to build Qt (either version 5 or 6):

ld.lld: error: src/corelib/CMakeFiles/Core.dir/global/qversiontagging.cpp.o: symbol qt_version_tag@@Qt_6.4 has undefined version Qt_6.4
ld.lld: error: src/corelib/CMakeFiles/Core.dir/global/qversiontagging.cpp.o: symbol qt_version_tag@Qt_6.3 has undefined version Qt_6.3
ld.lld: error: src/corelib/CMakeFiles/Core.dir/global/qversiontagging.cpp.o: symbol qt_version_tag@Qt_6.0 has undefined version Qt_6.0
ld.lld: error: src/corelib/CMakeFiles/Core.dir/global/qversiontagging.cpp.o: symbol qt_version_tag@Qt_6.1 has undefined version Qt_6.1
ld.lld: error: src/corelib/CMakeFiles/Core.dir/global/qversiontagging.cpp.o: symbol qt_version_tag@Qt_6.2 has undefined version Qt_6.2
ld.lld: error: lto.tmp: symbol qt_version_tag@@Qt_6.4 has undefined version Qt_6.4

All the test cases work fine with ld.bfd, gold and mold, as well as lld 15.

While it does look like the version scripts are buggy, maybe given compatibility with the other linkers is a goal, this should be a warning rather than a hard error by default?

@aaronmondal
Copy link
Contributor

I've read often that things work with mold, so to clarify:

This is a bug. Mold also flags it, but as a warning which often gets lost in all the output. Please try to actually fix the linker scripts and not rely on molds more relaxed defaults.

Ignoring these [lld errors]/[mold warnings] will lead to issues down the line e.g. when using LTO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Resolved as invalid, i.e. not a bug lld
Projects
None yet
Development

No branches or pull requests

5 participants