-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[brotli] build failure when used with cargo-vcpkg #16991
Labels
category:port-bug
The issue is with a library, which is something the port should already support
depends:upstream-changes
Waiting on a change to the upstream project
Comments
waych
added a commit
to waych/vcpkg
that referenced
this issue
Mar 31, 2021
This change allows downstream consumers of the archives to not worry about ordering the link correctly when using this package, which can be problematic when --as-needed is passed to the linker and the order isn't otherwise known. Keeping the brotlicommon-static archive as is allows for probing of the brotli libraries to remain symmetric between dynamic and static links. Fixes static linking issue discussed in microsoft#16991 which is blocking rust-sdl2 CI dependent upon vcpkg discussed here Rust-SDL2/rust-sdl2#1085 .
waych
added a commit
to waych/vcpkg-rs
that referenced
this issue
Apr 1, 2021
vcpkg-rs discovers libraries to link using the manifest files from vcpkg. While ports are handled corrrectly already in dependency order, multiple libraries defined by a single Port are otherwise not sorted. This can cause problems when there is an explicit ordering that should be obeyed. This is observed when building rust-sdl2 using the 'use-vcpkg' flag, as this transitively includes the broli port, which defines 3 libraries: libbrotlicommon, libbrotlidec and libbrotlienc. These libraries expect to be linked with libbrotlicommon last, as otherwise rustc's invocation of link will fail (as --as-needed is passed to the linker). See also: microsoft/vcpkg#16991 See also: Rust-SDL2/rust-sdl2#1085 This commit works around the issue by teaching vcpkg-rs the bare minimum required to parse (optional) .pc files if they are available in the vcpkg package, and uses them to infer the correct ordering that should be used. Closes mcgoo#26
waych
added a commit
to mcgoo/vcpkg-rs
that referenced
this issue
Apr 16, 2021
vcpkg-rs discovers libraries to link using the manifest files from vcpkg. The manifest files do not indicate any ordering of library files. While ports are handled correctly already in dependency order, multiple libraries defined by a single Port are otherwise not sorted. This can cause problems when there is an explicit ordering that should be obeyed. This is observed when building rust-sdl2 using the 'use-vcpkg' flag, as this transitively includes the brotli port, which defines 3 libraries: libbrotlicommon, libbrotlidec and libbrotlienc. These libraries expect to be linked with libbrotlicommon last, as otherwise rustc's invocation of link will fail (as --as-needed is passed to the linker). See also: microsoft/vcpkg#16991 See also: Rust-SDL2/rust-sdl2#1085 This commit works around the issue by teaching vcpkg-rs the bare minimum required to parse (optional) .pc files if they are available in the vcpkg package, and uses them to infer the correct ordering that should be used. Closes #26
Fixed in vcpkg-rs 0.2.12. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
category:port-bug
The issue is with a library, which is something the port should already support
depends:upstream-changes
Waiting on a change to the upstream project
Host Environment
To Reproduce
Steps to reproduce the behavior:
Failure logs
cargo vcpkg -v build
succeeds without error. Thecargo build ...
command fails on final link however with the following:The failing link command is:
This is failing because the libraries
"-lbrotlicommon-static" "-lbrotlidec-static" "-lbrotlienc-static"
are not listed in an order sympathetic to the"-Wl,--as-needed"
flag used.Additional context
Debugging this as part of unblocking the CI for rust-sdl2 which has been blocked for a while on another issue that requires an update to its vcpkg ref anchor. The CI does regression tests using the vcpkg variant of build. See: Rust-SDL2/rust-sdl2#1085 where the initial blocking issue was discovered as fixed already in vcpkg; this issue was discovered while trying to move to vcpkg to HEAD as of this week.
The way cargo-vcpkg probes to find the libraries for each installed package is by looking at the manifest file
./installed/vcpkg/info/brotli_1.0.9_x64-linux.list
and path matching, which unconditionally globs the archives in alphanumeric order (the way the manifest itself is generated).While this ordering dependency could be described via pkgconfig .pc Libs, it wouldn't be understood by cargo-vcpkg as is.
A simpler fix would be to link the contents of
brotlicommon-static
into thebrotlienc-static
andbrotlidec-static
archives. This way both static archives could stand on their own and not impose ordering requirements on downstream consumers.The text was updated successfully, but these errors were encountered: