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
compiler.find_library() function considers unusable libraries to be found #10936
Comments
In both of these situations, the user has an inherently buggy system and that is what needs to be fixed, not Meson. However, |
I do find Red Hat's behavior questionable -- IMHO it seems like they should not install this linker script as part of the GCC package, and install it as part of the libatomic package instead. But it's not a broken library, it's obviously intended to produce a situation where the real library cannot be found. The question is what to do about it. Here's Meson's implementation of "this is a list of possible filenames where we might be able to find a library, check this list and try to find that library": meson/mesonbuild/compilers/mixins/clike.py Lines 1088 to 1109 in 2761131
I don't really understand this rationale here, but plainly there is some sort of situation whereby people want to The comment I linked to discusses some past rationale about:
The code comment is documenting some old code, and removing part of that old code. The code itself came from #3833, which makes a distinction between compiler default dirs and custom specified dirs, because only (???) in the latter case could the library be a static library that doesn't work with link_whole:
In short, I do not understand this mess, and the more I link surf the more confused I get. But it seems wrong. I am tempted to say that things have been wrong for a very long time, and were repeatedly papered over with hacks, but then people started to claim that the hacks were the original point. And some of them weren't very good solutions to begin with (like changing how shared libraries work, because of static libraries). |
"We can't do a link check because the library might have unresolved symbols that require other libraries." part of code comment seems to be untrue (with both GNU linkers and LLD) for operation creating libraries (not executables), except when using
|
Solution sufficiently handling these situations (and also working for static libraries with undefined references), would be to perform link check by creating shared library, not executable.
Test for static library (lib1.a) with undefined reference:
When creating executable linked against static library (lib1.a) with undefined reference, results depends on whether there is any reference to code containing undefined reference:
|
compiler.find_library() function considers unusable "libraries" to be found:
1. Linker scripts referring to non-existent files
As seen in scylladb/seastar#533 and systemd/systemd#25069, this is situation happening on Red Hat / Fedora with respect to their
/usr/lib/gcc/x86_64-redhat-linux/8/libatomic.so
(provided by gcc package) which is a linker script which contains:However libatomic package providing
/usr/lib64/libatomic.so.1.2.0
is not necessarily installed.But Meson's
find_library('atomic', required : false)
still claims to have found such library.Generic steps to reproduce:
In test project:
2. Corrupted libraries
In test project:
3. Inaccessible libraries
In test project:
The text was updated successfully, but these errors were encountered: