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

Investigate installing cbindgen / cxxbridge from vendored sources #588

Open
jschwe opened this issue Dec 18, 2024 · 2 comments
Open

Investigate installing cbindgen / cxxbridge from vendored sources #588

jschwe opened this issue Dec 18, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jschwe
Copy link
Collaborator

jschwe commented Dec 18, 2024

Currently, cbindgen and cxxbridge-cmd need to be preinstalled with the correct version for offline builds to work (when using cbindgen or cxxbridge corrosion functions).
If we could support installing these commands from vendored sources, that would make offline builds easier with less setup required.

@doronbehar
Copy link

Hey and thanks for trying to help. Just wanted to let you know that through the Nix ecosystem, I was able to simply setting the environment variable CARGO_HOME to a .cargo directory that has a config file with:

[source."crates-io"]
"replace-with" = "vendored-sources"

[source."vendored-sources"]
"directory" = "@vendor@"

And Nix's ecosystem puts in the @vendor@ directory all the required dependencies.

I don't think you should bother too much to track any such potential issues. I have very basic knowledge of the Rust ecosystem because I'm only a distribution packager, so it took me a long time to figure out that using CARGO_HOME could fix this so elegantly. Perhaps The only thing worth learning and noting in the docs is the usage of the CARGO_HOME environment variable - something that took me a long time to figure out.

@jschwe
Copy link
Collaborator Author

jschwe commented Dec 18, 2024

Interesting - It sounds like cargo install xxx might be installing from the vendored sources then, which "it just works" and this issue can be closed.

it took me a long time to figure out that using CARGO_HOME could fix this so elegantly

I guess it wouldn't harm to add an offline builds section to the common issues page of our documentation.
Just a note: The .cargo/config.toml can also be part of the repo (See the lookup rules), so perhaps this could also be achieved by a distribution-specific patch which just adds this file to the root of the repo during the build process. I would be a bit worried that changing CARGO_HOME might have some other potential side-effects. I guess when using only vendored sources it might not be an issue, but I'm also not a cargo expert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants