Replies: 4 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
The problem is cargo and rust building everything from source again. If you have some rust/cargo dependency on e.g. zlib it will try to download that itself instead of using the version build from vcpkg. If you find out a way to inject it please feel free to tell me how. |
Beta Was this translation helpful? Give feedback.
-
|
An interesting example of the pattern of a C++ library that is internally written in Rust is rerun-sdk, that was added in #44854 . The trick there is that the upstream project host binaries of the static C library compiled by rust, and so that is downloaded on the fly by the build process. |
Beta Was this translation helpful? Give feedback.
-
|
You're absolutely right, and I agree that it's not ideal for Cargo to rebuild something like zlib even when it's already available on the system. However, I think this behavior stems from Cargo treating each build as a fully isolated, cross-platform-safe environment. While it may seem excessive, it's not too different from what we see in modern package managers like npm or Python's venv — they also tend to re-download and isolate dependencies rather than rely on system-installed versions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Recently, there has been a noticeable increase in C++ libraries that internally use Rust and are built using Cargo. While many of these libraries do expose a C++ interface, their build process still relies on the Rust toolchain.
Currently, vcpkg supports traditional CMake-based C++ libraries very well, but integrating libraries that require Cargo builds seems difficult or unsupported.
Given this trend, wouldn't it make sense for vcpkg to support the Cargo toolchain as part of its build system? That way, libraries written in Rust but exposing C/C++ interfaces can be seamlessly packaged and consumed via vcpkg.
I’d love to hear your thoughts on this or whether there are any existing efforts in this direction.
Beta Was this translation helpful? Give feedback.
All reactions