Skip to content
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

vcpkg build-dependency now unconditionally pulled in for all targets #2031

Closed
decathorpe opened this issue Aug 28, 2023 · 5 comments
Closed

Comments

@decathorpe
Copy link

It looks like since openssl-sys 0.9.91, the vcpkg dependency is now hard-required, even on targets where it is unused. Would it be possible to cfg-gate the build-dependency and usage of vcpkg in build.rs? For example, it does not make sense for Linux distributions to package the vcpkg crate, but openssl-sys now can't be built without it.

Looking at the PR that introduced this change (#1982), it sounds like this is a workaround for host != target environment? If there's no other way to resolve this than to make the build-dependency unconditional, then I'll likely need to apply some downstream patches for openssl-sys for the builds in Fedora Linux.

@sfackler
Copy link
Owner

Yes, it needs to be pulled in for cross-compile workflows.

@decathorpe
Copy link
Author

Ok :( That's unfortunate. I'll drop the dependency with a downstream patch then. Thanks for confirming!

@alex
Copy link
Collaborator

alex commented Aug 28, 2023

As a long term action item, it seems like maybe this scenario could be addressed by making cargo more flexible in declaring host or target build deps?

@sfackler
Copy link
Owner

Yeah more powerful dependency filtering would cover it.

@micolous
Copy link
Contributor

It looks like since openssl-sys 0.9.91, the vcpkg dependency is now hard-required, even on targets where it is unused.

vcpkg (and vcpkg-rs) can also build for non-Windows targets, which may or may not be cross-compiled.

While rust-openssl doesn't support that today, it absolutely could be used to build for a Linux target at some point in the future if someone was so inclined (that someone is unlikely to be me, though).

So while I acknowledge the minor absurdity of the situation for a Linux distributor, even if you could resolve the dependency loop to filter it out by target on a Cargo level, it would lead to a similar situation to what I'm trying to unwrap with the assumption that you wouldn't use vcpkg to build for *-pc-windows-gnu.

If you're building in cargo, it's only used as a build dependency, so doesn't bloat anyone's binaries, much like providing OpenSSL via pkg-config.

Would it be possible to cfg-gate the build-dependency and usage of vcpkg in build.rs? For example, it does not make sense for Linux distributions to package the vcpkg crate, but openssl-sys now can't be built without it.

To turn around your suggestion: it does not make sense to have a hard dependency on pkg-config on *-pc-windows-msvc targets... we should cfg-gate that too! Linux users can just add a --cfg flag for that. 😉

See also: #1062

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants