[SOLVED!] How to compile cargo without cargo !?

Hi rustceans!
There is bug in ubuntu cargo package which makes it unable of compiling packages that depend on std.

Developer of the package has said that it'll take sometime to patch this problem so I grabbed the cargo source code to compile it myself. But it seems I must have a working version cargo to compile cargo‌!

Plus the cargo install cargo command fails too.
what am I supposed to do now?

You can use rustup to install cargo from binary build. Follow instructions at Install Rust - Rust Programming Language.

2 Likes

If you actually need to compile cargo without cargo, you can always try feeding the source code to some butterflies and waiting a while.

If you get impatient, you can always try @sanxiyn's suggestion (but his answer doesn't actually answer your question so I figured I'd give it a try).

1 Like

Ehmmm....

what?

The easiest way is to just use the pre-built binaries which rustup downloads. This is also the accepted method of installing if you are wanting to develop in Rust because it lets you freely jump between channels (nightly/beta/stable) or add extra compilation targets (for cross compiling).

While you can compile cargo from source, because it is self hosting you need a version of cargo on your system already. This bootstrapping/self-dependency problem is fairly common, for example how would you compile a C compiler (which is written in C) without already having a C compiler on your system? Most package managers get around this chicken-and-egg problem by downloading binaries.

TL;DR: use rustup until the Ubuntu package is fixed.

2 Likes