Skip to content

brew install rust takes 39 minutes #39576

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

Closed
timotheecour opened this issue Feb 6, 2017 · 20 comments
Closed

brew install rust takes 39 minutes #39576

timotheecour opened this issue Feb 6, 2017 · 20 comments

Comments

@timotheecour
Copy link

that seems to be the longest time of all homebrew packages IIRC

==> Installing ripgrep dependency: rust
==> Using the sandbox
==> Downloading https://static.rust-lang.org/dist/rustc-1.14.0-src.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/Users/timothee/homebrew/Cellar/rust/1.14.0 --enable-clang --release-channel=stable
==> make
==> make install
==> Downloading https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/2016-11-02/cargo-nightly-x86_64-apple-darwin.tar.gz
######################################################################## 100.0%
==> ./install.sh --prefix=/private/tmp/rust-20170205-1206-tvi7um/rustc-1.14.0/cargobootstrap
==> Cloning https://github.com/rust-lang/cargo.git
Cloning into '/Users/timothee/Library/Caches/Homebrew/rust--cargo--git'...
remote: Counting objects: 278, done.
remote: Compressing objects: 100% (272/272), done.
remote: Total 278 (delta 39), reused 59 (delta 1), pack-reused 0
Receiving objects: 100% (278/278), 693.76 KiB | 0 bytes/s, done.
Resolving deltas: 100% (39/39), done.
Note: checking out '298a0127f703d4c2500bb06d309488b92ef84ae1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

==> Checking out tag 0.15.0
==> ./configure --prefix=/Users/timothee/homebrew/Cellar/rust/1.14.0 --local-rust-root=/Users/timothee/homebrew/Cellar/rust/1.14.0 --enable-optimize
==> make
==> make install
==> Caveats
Bash completion has been installed to:
  /Users/timothee/homebrew/etc/bash_completion.d

zsh completion has been installed to:
  /Users/timothee/homebrew/share/zsh/site-functions
==> Summary
🍺  /Users/timothee/homebrew/Cellar/rust/1.14.0: 24,937 files, 241.7M, built in 39 minutes 9 seconds
@retep998
Copy link
Member

retep998 commented Feb 6, 2017

As far as I can tell, it looks like it is building Rust from source, and building Rust from source takes a while. If you don't want to build Rust from source, then don't use homebrew to build Rust from source. Instead you should install Rust using rustup.

@killercup
Copy link
Member

killercup commented Feb 6, 2017

The currently available Rust formula was updated three days ago and contains binary versions of Rust 1.15 for the last three versions of macOS.

The formula for ripgrep contains depends_on "rust" => :build, though, which is surprising and seems to come from here. Nevertheless, this, too, contains bottles (binaries) for the last three versions of macOS.

@steveklabnik
Copy link
Member

If homebrew packages are wrong, bugs should be filed with those packages, or homebrew itself. I don't think there's anything actionable about this ticket, other than the usual "make Rust faster to compile" that we're working across in all fronts.

@timotheecour if you have a specific issue here that's Rust's fault and can be improved, please let us know! Until then, I'm going to give this one a close. Thanks!

@timotheecour
Copy link
Author

timotheecour commented Feb 7, 2017

@retep998 @killercup @steveklabnik

thanks for answers, filed Homebrew/homebrew-core#9703 for one of the above points: ripgrep depends on "rust" => :build which takes takes 39 minutes #9703

Regardless of homebrew:

Looking at htop during install shows only 2 active threads most of the time (rarely up to 8), even though I'm running on a machine with 48 CPU (with 0 activity).

threads of the form:

rustc src/librustc/lib.rs --crate-name rustc --crate-type dylib -C prefer-dynamic -C opt-level=2
  • is the default build using all available "make -j nproc" cpu?
  • how come most of the time only 2 threads are active?

@retep998
Copy link
Member

retep998 commented Feb 7, 2017

@timotheecour Rust's unit of compilation is the crate, unlike in C/C++ where each source file is a unit of compilation. Crates depend on each other much more than C/C++ source files do, so it is quite normal for a Rust build to be waiting for one or two specific crates before more stuff can be built. Rustbuild does by default use as many CPU cores as it can, it is just limited by interdependencies between crates

@ilovezfs
Copy link

ilovezfs commented Feb 7, 2017

The formula for ripgrep contains depends_on "rust" => :build, though, which is surprising and seems to come from here.

@killercup Why is this "surprising"? ripgrep is written in rust. So it needs rust to build.

@killercup
Copy link
Member

@ilovezfs I assume :build means "compile" in this context. And compiling Rust is not necessary: You just need the compiler binary and are good to go.

One could assume that ripgrep requires a nightly compiler, but that would mean that there should be (a) a HEAD flag somewhere in the formula, and (b) actually passing features (like --features "simd") when compiling ripgrep.

In fact, ripgrep itself offers an alternative brew formula with binaries compiled with rust nightly to enable those features: https://github.com/BurntSushi/ripgrep#installation

@ilovezfs
Copy link

ilovezfs commented Feb 7, 2017

=> :build means build time for the formula. The formula is ripgrep. At build time, it needs rust.

=> :build has nothing to do with whether "rust" itself is the binary bottle or a local source build.

@killercup
Copy link
Member

Ah, thanks, @ilovezfs, that makes sense. (I love ZFS, too, btw.) Then, I must assume OP was not using a system for which pre-build binaries exist.

@ilovezfs
Copy link

ilovezfs commented Feb 7, 2017

@killercup Yeah ZFS is awesome :)

Then, I must assume OP was not using a system for which pre-build binaries exist.

That is correct. OP is using a non-standard prefix (the standard prefix is /usr/local), and neither the ripgrep bottle nor the rust bottle are relocatable bottles, so source builds of both rust and ripgrep are triggered. If OP uses the standard prefix, /usr/local, then the ripgrep bottle would be poured and rust would not be installed at all.

@timotheecour
Copy link
Author

@ilovezfs
unfortunately on linux (Homebrew/homebrew-core#9703), there is not bottle for rust nor ripgrep (and IIRC we can't use /usr/local as standard prefix on linux, it defaults to ~/.linuxbrew to avoid clashing)

@ilovezfs
Copy link

@timotheecour right the standard prefix is different for Linuxbrew. I suggest you inquire about getting rust bottled for Linux here: https://github.com/Linuxbrew/homebrew-core/issues

@timotheecour
Copy link
Author

@ilovezfs
I did : https://github.com/Linuxbrew/homebrew-core/issues/1733
I also have a PR in progress to try to fix it but it's running into additional issues, see

https://github.com/Linuxbrew/homebrew-core/pull/1744#issuecomment-278893844
it's trying to build a Mach-O 64-bit x86_64 executable on linux

@ilovezfs
Copy link

@timotheecour ah OK. Then we should continue this conversation on https://github.com/Linuxbrew/homebrew-core/pull/1744.

@bateni
Copy link

bateni commented Nov 29, 2018

The currently available Rust formula was updated three days ago and contains binary versions of Rust 1.15 for the last three versions of macOS.

The formula for ripgrep contains depends_on "rust" => :build, though, which is surprising and seems to come from here. Nevertheless, this, too, contains bottles (binaries) for the last three versions of macOS.

I just ran into this issue after upgraing to Mojave. It seems that there is no pre-built binary for Mojave. Would be nice to add.

@odanielgoncalves
Copy link

Captura de Tela 2023-05-26 às 14 14 15

O Segredo para instalar o brew em maquinas mais antigas (imac 2013 - 10.15) é ter muita paciência.. Formatei o hd fiz todas as atualizações e sem instalar nada comecei a instalar primeiro o brew quando chega no Rust ele ficou 128 minutes 29 seconds :) mas foi no total acho que levei umas 6 horas quase pra rodar tudo o segredo é não fechar e esquecer..

@blksith0
Copy link

The currently available Rust formula was updated three days ago and contains binary versions of Rust 1.15 for the last three versions of macOS.
The formula for ripgrep contains depends_on "rust" => :build, though, which is surprising and seems to come from here. Nevertheless, this, too, contains bottles (binaries) for the last three versions of macOS.

I just ran into this issue after upgraing to Mojave. It seems that there is no pre-built binary for Mojave. Would be nice to add.

Waiting...
I gave up after 2 hours.

==> Installing rust
==> ./configure --prefix=/usr/local/Cellar/rust/1.69.0 --enable-vendor --set rust.jemalloc --release-channel=stable
==> make
^Z

@WangElectronics
Copy link

I let it stay overnight and it doesn't compile.

`==> Upgrading rust
1.68.1 -> 1.70.0

==> ./configure --prefix=/usr/local/Cellar/rust/1.70.0 --enable-vendor --set rust.jemalloc --rele
==> make

^C^C^C
One sec, cleaning up...
^C
One sec, cleaning up...`

@vike2000
Copy link

haha, wimps! (jk)

I stuck with it and just spent 8h 30min installing rust (as dep of brew install oci-cli) on macOS 10.13.6 High Sierra and an iMac 2010 i3 3.2ghz w/ 16gb ram (some other apps running but mostly taking up ram).
Also, just before completion, I noticed the installation had been building up at least 16gb temp data.

🍺  /usr/local/Cellar/rust/1.71.0: 38,254 files, 1.2GB, built in 510 minutes 30 seconds

phew!

@pgatech
Copy link

pgatech commented Jan 5, 2024

haha, wimps! (jk)

I stuck with it and just spent 8h 30min installing rust (as dep of brew install oci-cli) on macOS 10.13.6 High Sierra and an iMac 2010 i3 3.2ghz w/ 16gb ram (some other apps running but mostly taking up ram). Also, just before completion, I noticed the installation had been building up at least 16gb temp data.

🍺  /usr/local/Cellar/rust/1.71.0: 38,254 files, 1.2GB, built in 510 minutes 30 seconds

phew!

I had it even worse, when I wanted to upgrade PHP version 7.3 to 8.1, and it seemed like I was stuck, there was no clarity, almost 1 day of waiting. brew install shivammathur/php/php@8.1 and btw i use Catalina
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests