Fix bug with passing shared libraries to ldc2 (D/dlang) - #16170
Open
exhu wants to merge 5 commits into
Open
Conversation
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.
LLM usage disclosure: i've consulted google's gemini to find out the place where and how to write a unit test here since I don't write python these days.
Current meson produces invalid command to build Dlang app that depends on an internal static C library built with meson that depends on a system shared library.
I've added a minimal test case to demonstrate, but it depends on blkid library and pkg-config (i've tried other libraries like zlib but it's unreliable, looks like ldc2 sorts the inputs, and there's no such problem with shared libraries built as a subproject). Overall I'm not sure if it's acceptable to put a test into this directory because it depends on a library to be installed.
This is the error before fix:
The fix is that "/usr/lib/x86_64-linux-gnu/libblkid.so" must be prefixed with "-L=" so that ldc2 passes it to the linker after the static library that references libblkid, otherwise it's passed before and thus unresolved reference.