-
Notifications
You must be signed in to change notification settings - Fork 7k
[vcpkg-rust] Rust support #30251
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
base: master
Are you sure you want to change the base?
[vcpkg-rust] Rust support #30251
Conversation
@FrankXie05 I saw you posted on #24402. Could you help me getting this to work? |
This should be moved into a script helper port instead of into scripts |
@Neumann-A Do you have an example of a script helper port that I can use as scaffolding? |
|
@zaddach At least this is indispensable as an entrance. |
Please don't touch this. |
@zaddach |
Maybe we can package |
No the way to do this is to simply provide a |
I mean, as a port, like |
Okay, I'll give that a shot. |
I've transformed the script into a helper port. It seems to work (on Windows), there are still a couple of open points:
Here is the ClamAV 1.0.0 package PR that uses this package for testing: #30660 |
@BillyONeal Can you take a look at this PR? |
On windows the environment gets sanitized so you need to pass it explicitly via the triplet or forward PATH via the pass-through mechanism for env variables. |
From what I read about passing through env variables, my understanding is that it's very much intended to not use the system's tools and prefer to install a portable tool(chain) in the interest of reproducibility. What's irking me here is that vcpkg finds my system Rust and uses it when it's present, which feels like going against this philosophy. My takeaway is that it's okay to add the rust toolchain even on systems that have already (a system) one installed. |
I've updated the rust packages and limited architectures and platforms to windows, linux, x86, x64. It's easy to add more architectures or platforms (as long as they're compiled by Rust), but I'd only add them when the need arises (and somebody can assist me in debugging on that platform). I also have a script for generating the rust package section in |
@BillyONeal User wants to add Rust cargo to vcpkg in such a way, could you please take a look at it? |
Thanks for your contribution, the script is nice, but it might not be accepted:
|
Note: I will be converting your PR to draft status. When you respond, please revert to "ready for review". That way, I can be aware that you've responded since you can't modify the tags. |
Any chance of merging yet? |
Yes, reasons for hold see: #31748 |
endif() | ||
|
||
# If the package doesn't match the host triplet, bail here | ||
if(NOT HOST_TRIPLET MATCHES "^${arg_ARCH}-${arg_PLATFORM}.*$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to test against something else then the triplet name! In general -> if native: check against VCPKG_CMAKE_SYSTEM_NAME
otherwise test against CMAKE_HOST_WIN32 or something similar. Triplet names can be unrelated to the host/target
@zaddach |
Hi, @talregev. My understanding was that there's not much interest in integrating with Rust in vcpkg at the time when I opened the PR. I haven't followed the discussion about integrating with Rust recently, if the stance has changed I'd be happy to bring the PR up to speed and have it reviewed. Without having Rust as a tool available there's no point in trying to integrate packages that rely on Rust (like ClamAV, in my case). |
I am not the maintainer, I just contribute to vcpkg. I am interesting in rust because I want to update the librsvg, and not just me: You mean you are willing to work on the PR if there is ok from maintainers to do so? |
There is not a lack of interest. IMO the main barrier is cargo. Downloading crates as neeeded with cargo is convenient ... unless you have to go through a different download, caching and dependency tracking mechanism. |
@MonicaLiu0311 Since tool ports aren't a thing any more, and the reason for hold should be gone, will you merge the PR if I bring it up to speed? |
@BillyONeal Can you give your opinion? |
Just trying to get a better scope of the problem, but after skimming the crates.io documentation, it looks like we could emulate the registry on disk, which could give us an opportunity to integrate with vcpkg caching, then I imagine we could configure cargo to use the disk registry. Is this the type of thing we are looking to solve, or did I miss something important? |
I don't fully understand how the ports would interact with this registry, but it might be more complicated.
Literally, "dependency resolution is a global problem, not a local problem". I always wonder how I would collect all the licenses and attribution and sources I would need to pass or provide alongside my app. If I can't answer that for some package, I cannot use that package. |
I see. So the complicated issue is that we need all dependency managers to agree on compatible dependency resolutions. Well, I'll assume there is no good reason to change how vcpkg resolves dependencies to continue the discussion, which, from my understanding, involves essentially one solved dependency graph for each release, allowing for some tweaks for end users. And then we override environment variables, etc, so tools like pkgconfig use the vcpkg dependencies. So the logical path for a solution would be to coerce cargo to follow the same restrictions. Which sounds theoretically possible by replacing the registry. I agree it's a complicated direction, but if I understand this problem correctly, vcpkg and cargo take two different approaches to the same dependency problem, so either these ecosystems work closely to align better, or we find something that will work, albeit with some complications and compromises. |
... in particular for a libxml2 wrapper, https://github.com/KWARC/rust-libxml. |
Fixes #20619
Unblocks #24894
Unblocks #24402
Some ports, such as clamav or librsvg require an installed Rust toolchain. I've taken inspiration from Lord-Kamina's work linked in #24402 to download static rust binaries.
I need help to figure out how to detect the system rust correctly, my current attempt with
find_program
isn't finding my system's installation in$HOME/.cargo
.