Build a shared library for find_library link tests#15613
Open
thesamesam wants to merge 1 commit intomesonbuild:masterfrom
Open
Build a shared library for find_library link tests#15613thesamesam wants to merge 1 commit intomesonbuild:masterfrom
thesamesam wants to merge 1 commit intomesonbuild:masterfrom
Conversation
8fd4381 to
1ab2e38
Compare
7b6aa4f to
44d9722
Compare
aeae58f to
287aff9
Compare
In 4f43a40 I claimed that we were building a shared library for the new find_library link test, but I changed my mind while working on it [0] and went for a cute trick instead: > I should say as a correction to the commit message: >> We can workaround that by building a shared library as a test rather than an executable, > We're not doing that, I thought we were going to have to, and I had it to begin with, but in the end, we have a nicer solution where we just pass the right flags. In the end, the cute trick didn't work (mesonbuild#15601) for static libraries where -Wl,--allow-shlib-undefined doesn't help. Now, we could try -Wl-z,defs, but we want something portable to all linkers. Relying on the ELF behaviour of shared libraries seems best here, so do that. So, build a shared library as I originally promised to do instead, so undefined references are tolerated. Only do this if get_std_shared_lib_link_args gives us some non-empty argument because some platforms only support static linking, and don't do this when `static` is passed to `find_library`. We may still want to add a toggle for people to override this for a toolchain, possibly for non-ELF targets where I'm not sure the shared library behaviour is always the same. [0] mesonbuild#15134 (comment) Fixes: mesonbuild#15601 Fixes: 4f43a40 Signed-off-by: Sam James <sam@gentoo.org>
287aff9 to
570cff0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In 4f43a40 I claimed that we were building a shared library for the new find_library link test, but I changed my mind while working on it [0] and went for a cute trick instead:
In the end, the cute trick didn't work (#15601) for static libraries where -Wl,--allow-shlib-undefined doesn't help. Now, we could try -Wl-z,defs, but we want something portable to all linkers. Relying on the ELF behaviour of shared libraries seems best here, so do that.
So, build a shared library as I originally promised to do instead, so undefined references are tolerated.
Only do this if get_std_shared_lib_link_args gives us some non-empty argument because some platforms only support static linking.
We may still want to add a toggle for people to override this for a toolchain, possibly for non-ELF targets where I'm not sure the shared library behaviour is always the same.
[0] #15134 (comment)
Fixes: #15601