4 ms·
> This is just going to be a preference then. No, it is not. * It's not always that you have internet connection when building your code. * It's not always t
by dozzie 11y ago
> This is just going to be a preference then.
No, it is not.
* It's not always that you have internet connection when building
your code.
* It's not always that you have access to the website code is downloaded from
(websites break, and companies have different policies about internet), and
even if you do, you don't always have it direct (e.g. proxy).
* And at the last, people will build code for various purposes,
including building packages. Building a package should be a repeatable
operation and should always use only clean source (no artifacts from previous
builds), and downloading random things on every build from clean source is
very easy way to break the process.
>> It means it's pretty much random for your purposes.
> We are just going to have to agree to disagree on this one. First of all, you _already_ need an equally 'random' binary: rustc itself.
No. I downloaded Rust compiler myself (or had it installed from a package).
I controlled that, it didn't hit me in my face unexpectedly.
> Which is also bootstrapped.
s/also//. Cargo is not bootstrapped, because it needs pre-built Cargo to build itself.
Compare this to Rust compiler: you start with nothing but C(++? I don't
remember) compiler, and end with Rust compiler. No intermediate download
involved.
> Second, it's not clear to me why bootstrapping is valid for a compiler, but not for any other kind of project. Cargo is a build system, written in Rust, so it uses Rust's build system.
It's not invalid, quite the contrary. It's just Cargo doesn't boostrap
itself out of clean code. It's that simple. I wouldn't have as big problem
with it if its build process produced an intermediate, crippled Cargo binary.
I would then complain about requiring external dependencies to be downloaded
(in contrast to included), but that would be difference on strategy
preferences.
- vvanders 11y agoGoing to have to agree with dozzie here, he's right on almost all accounts. There's a ton of things I like about Rust but the points he outlined above are things that I've seen very much impede the adoption of Rust into some environments that have similar restrictions(no download on build, build from source without binaries) for security and reproducibility reasons.
- steveklabnik 11y agoAs I said to the parent, if offline builds do not work, please file bugs. Integrating Rust code into Firefox requires the same restrictions that you're talking about, and is a use case we explicitly want to support, and already do, to a certain extent.
- pcwalton 11y ago> There's a ton of things I like about Rust but the points he outlined above are things that I've seen very much impede the adoption of Rust into some environments that have similar restrictions(no download on build, build from source without binaries) for security and reproducibility reasons. They're all on the roadmap for the very near future, because Servo (and Rust-in-Gecko) needs them. There's nothing in the design of Cargo that prevents these from being solved. Personally, I love Cargo. Autoconf is miserable and I would hate to go back to it.
- mcguire 11y agoReproducibility is the thing that bothers me most about auto-downloading build systems. On the other hand, Cargo (IIRC) doesn't do what Maven does: if you say you want version X, you get version X or anything newer (unless you jump through hoops that I've never seen anyone jump through). [Security just scares the piss out of me in general; downloading binaries is probably the smallest problem.]
- burntsushi 11y agoCargo follows semver by default. Specifying version "1" means "1.x.x, <2". Pinning versions is simple. e.g., "=1.2.3". You can read more about it here: http://doc.crates.io/crates-io.html http://doc.crates.io/crates-io.html
- steveklabnik 11y agoAnd even when you have a range, Cargo.lock means that you get reproducable (in this sense) automatically.
- steveklabnik 11y agoA few things: 1. If an offline build does not work, that's a bug. This use case is one that we explicitly want and need, and do already support. 2. You are incorrect about Rust. Rust is written in Rust, not C++, and so building Rust involves downloading a binary of a previous Rust. That's what 'boostrapping' means.
- vvanders 11y agoI thought that rustc was boostrapped from the old c based compiler(allowing you to build clean from source) multiple times(C -> Rust 0.x? -> Rust 1.0)? From what I last saw of cargo there's not a clean path that lets you build from source that doesn't involve pulling binaries(and is really painful if you want to use cargo on a non-binary platform like RPi.
- Gankro 11y agoThere's never been a C-based compiler. Rust started out as OCaml. A true bootstrap would take weeks of non-stop compiling. You'd end up compiling rustc itself about 900 times, ignoring all the different LLVM builds, I think. Rust bootstraps from a binary snapshot of itself, and so you would have to work through the list of every snapshot ever (about 300, but you need to build rustc 3 times for each snapshot to properly bootstrap that copy). The snapshots are listed here: https://github.com/rust-lang/rust/blob/master/src/snapshots.txt https://github.com/rust-lang/rust/blob/master/src/snapshots.... In the past the snapshots were taken almost weekly as massive language churn dictated. Now they're quite rare.
- steveklabnik 11y agoThe situation with Cargo would be exactly the same: before Cargo existed, it couldn't use Cargo, because Cargo didn't exist. You can boostrap your own Cargo from that time period if you'd like, but that doesn't mean it's easy. But it's no different than rustc; where you can bootstrap your own snapshots from the OCaml compiler.
- throwaway999888 11y ago> I thought that rustc was boostrapped from the old c based compiler(allowing you to build clean from source) What's with all the baseless assumptions of the initial Rust compiler being written in either C or C++ in this thread? Contrary to apparently popular belief, C and C++ aren't some primordial lifeform compiler language which all language implementations have to be initially written in. Believe it or not, you can write a compiler in any (general purpose) programming language! Amazing, I know.
- pcwalton 11y ago> * It's not always that you have internet connection when building your code. Cargo does not require this. > * It's not always that you have access to the website code is downloaded from (websites break, and companies have different policies about internet), and even if you do, you don't always have it direct (e.g. proxy). Supporting local proxies is on the Cargo roadmap. > Compare this to Rust compiler: you start with nothing but C(++? I don't remember) compiler, and end with Rust compiler. No intermediate download involved. This is incorrect. Rust has been self-hosting for years. Before it was bootstrapping, it was written in OCaml. > It's not invalid, quite the contrary. It's just Cargo doesn't boostrap itself out of clean code. It's that simple. I wouldn't have as big problem with it if its build process produced an intermediate, crippled Cargo binary. Cargo is basically just part of the Rust compiler. Rust needs Rust to bootstrap itself, like tons of other languages. So Cargo needs Cargo to bootstrap itself. This really isn't a problem. The fact that you didn't even know that Rust is self-hosted is proof that it really doesn't matter to the user—it was so invisible you didn't notice it!
- dozzie 11y ago>> Compare this to Rust compiler: you start with nothing but C(++? I don't remember) compiler, and end with Rust compiler. No intermediate download involved. > This is incorrect. Rust has been self-hosting for years. Incorrect in that Rust actually downloads something, as steveklabnik pointed. I admit that I expected more from Rust, and I feel disappointed the same with the compiler as with Cargo. But your premise that self-hosted language automatically means that bootstrapping can't be done using C or C++ is false. Compare that with OCaml and GHC. > The fact that you didn't even know that Rust is self-hosted is proof that it really doesn't matter to the user—it was so invisible you didn't notice it! It could be tried to read as that, if it was a fact. I did expect Rust to be self-hosted, just it is a custom that bootstrapping compiler is written in something else. Look at how OCaml or GHC (Haskell) are built. Both allow to use C compiler to compile them (even though they generally advise to use pre-compiled compilers).
- pcwalton 11y ago> Both allow to use C compiler to compile them (even though they generally advise to use pre-compiled compilers). How many people actually do this, though? We had this conversation early on in Rust's life and the consensus was that we could make a non-bootstrapping compiler in theory, but that'd be asking us to do a huge amount of work (writing a separate compiler!) for something that very few people are going to use in practice. There are so many more important things that we could be (and are) working on than something that's basically just for purism, because most people just "apt-get install rust" or "brew install rust" and don't care how it's built.