How I can build my application using cargo with offline (without internet)


#1

I like to build my project with dependencies but whenever i use cargo build command it get stuck at following message

# cargo build
** Updating registry https://github.com/rust-lang/crates.io-index**

need help here because i an trying the build native application for linux in rust


#2

If this is your first time building something, you’re just going to have to let it run. The first time can be excruciatingly slow, and Cargo provides no indication as to whether it’s making any progress. I think the longest I’ve waited is ~25 minutes.

If you’ve built the package before, and it’s trying to update the registry… you’ll just have to let it. Sometimes, Cargo decides it needs to update the registry, and you can’t convince it otherwise. I used to maintain a local mirror of the index to get around this, but that’s been broken or removed or something recently.

Right now, in practice, Rust isn’t a language you can use without an internet connection.


#3

I think, this is a bug. If you have already a full build and you want to rebuild only your changes, you must not be forced to have a internet connection.

@DineshD: You could work with rustc directly.


#4

There’s a command cargo fetch that you can run with an internet connection. After that, it should have everything to build that project without more downloads.