meson: avoid duplicate library entries on executable link lines#228
Open
igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
Open
meson: avoid duplicate library entries on executable link lines#228igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
igoropaniuk wants to merge 1 commit intolinux-msm:masterfrom
Conversation
736dc58 to
b0ff75a
Compare
Both the qdl_common static library and each of the qdl/qdl-ramdump/qdl-ks executables were declared with the same `dependencies: common_dep` (libusb-1.0, libxml-2.0, libzip, plus ws2_32 on Windows). Meson propagates a static library's dependencies to its consumers via `link_with`, so listing those dependencies again on each executable caused every common library to appear twice on the final link line. Apple's ld surfaced this as: ld: warning: ignoring duplicate libraries: '-lxml2' The other dependencies are passed by absolute dylib path on macOS (libusb-1.0, libzip), so the linker silently deduplicated those while still warning about libxml2, which is referenced as `-lxml2` from the system path. Fix it by introducing a compile-only view of the common dependencies using `partial_dependency(compile_args: true, includes: true)` and attaching that to the executables instead of the full deps. The executables still see the headers needed to compile their own sources (e.g. usb.c -> libusb.h, file.c -> zip.h), while link arguments now flow to them exactly once via the static library's automatic propagation. Fixes: ff189b1 ("build: migrate from GNU Make to Meson build system") Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
b0ff75a to
dd7fc1a
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.
Both the qdl_common static library and each of the qdl/qdl-ramdump/qdl-ks executables were declared with the same
dependencies: common_dep(libusb-1.0, libxml-2.0, libzip, plus ws2_32 on Windows). Meson propagates a static library's dependencies to its consumers vialink_with, so listing those dependencies again on each executable caused every common library to appear twice on the final link line. Apple's ld surfaced this as:ld: warning: ignoring duplicate libraries: '-lxml2'
The other dependencies are passed by absolute dylib path on macOS (libusb-1.0, libzip), so the linker silently deduplicated those while still warning about libxml2, which is referenced as
-lxml2from the system path.Fix it by introducing a compile-only view of the common dependencies using
partial_dependency(compile_args: true, includes: true)and attaching that to the executables instead of the full deps. The executables still see the headers needed to compile their own sources (e.g. usb.c -> libusb.h, file.c -> zip.h), while link arguments now flow to them exactly once via the static library's automatic propagation.Fixes: ff189b1 ("build: migrate from GNU Make to Meson build system")