Network access during Rust builds #21

Open
opened 2024-01-29 09:07:11 -07:00 by nitori · 4 comments
Owner

e3f88301 introduced the bindgen package, which unlike cbindgen, requires the network to build and fetch crates.
Ideally, it shouldn't need the network.

I don't really ever deal with Rust and as such have no idea how vendoring packages works.
The cbindgen package has pointers that may or may not be useful.
Simply getting a list of URLs to throw into a sources file will be enough, and it might be possible to just parse Cargo.lock to do this.

e3f88301 introduced the bindgen package, which unlike cbindgen, requires the network to build and fetch crates. Ideally, it shouldn't need the network. I don't really ever deal with Rust and as such have no idea how vendoring packages works. The cbindgen package has pointers that may or may not be useful. Simply getting a list of URLs to throw into a sources file will be enough, and it might be possible to just parse Cargo.lock to do this.
nitori self-assigned this 2024-01-29 09:07:11 -07:00
Owner

This is really going to be a pain in the ass, but I agree that network access should not be required.

I think perhaps the most elegant solution to this would be to package the crates it depends on (and package the ones those depend on) and provide them as .rlibs in /lib.

This also happens to be the solution that takes the most work.

This is really going to be a pain in the ass, but I agree that network access should not be required. I think perhaps the most elegant solution to this would be to package the crates it depends on (and package the ones those depend on) and provide them as `.rlib`s in `/lib`. This also happens to be the solution that takes the most work.
Owner

After posting my last comment I looked at cbindgen and I hadn’t realized the rust package installs cargo(1).

If we want to manually compile everything with rustc(1) and avoid the dependency on cargo package management, my previous point still stands, but it’s really not what Rust is designed to do.

After posting my last comment I looked at cbindgen and I hadn’t realized the rust package installs `cargo(1)`. If we want to manually compile everything with `rustc(1)` and avoid the dependency on cargo package management, my previous point still stands, but it’s *really* not what Rust is designed to do.
Owner

I just read through the build file for cbindgen. Makes sense, feels hacky, but if it works, it works. I just feel bad about depending on cargo. That’s probably the approach we should take to avoid the massive undertaking of packaging everything bindgen depends on, though.

I just read through the build file for cbindgen. Makes sense, feels hacky, but if it works, it works. I just feel bad about depending on cargo. That’s probably the approach we should take to avoid the massive undertaking of packaging everything bindgen depends on, though.
emma added the
question
label 2024-01-29 11:39:14 -07:00
Owner
This may be relevant: https://thomask.sdf.org/blog/2023/11/14/rust-without-crates-io.html
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: bonsai/repo#21
No description provided.