Skip to content

libstd gets rebuilt unconditionally #33990

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
flo-l opened this issue May 31, 2016 · 8 comments
Closed

libstd gets rebuilt unconditionally #33990

flo-l opened this issue May 31, 2016 · 8 comments

Comments

@flo-l
Copy link
Contributor

flo-l commented May 31, 2016

For reference, the reddit thread, where the discussion started.

My goal

I want to hack on rustc. So I want to make a change, recompile as fast as possible and test the new binary with some input.rs.

The Problem

make rebuilds libstd even if it's unchanged. This takes ages and can't be skipped.

How to reproduce

I'm on Fedora Linux 23, fully updated.

I started with a clone of the rust repo, in which I already compiled rustc more than once (so LLVM was already built etc.).

git reset --hard 298730e   # this is the commit I used for this test
git clean -df
./configure --enable-debug

output

make rustc-stage1 NO_REBUILD=1

output

touch src/librustc_mir/lib.rs
make rustc-stage1 NO_REBUILD=1

output

As you can see in the output of the second make command libstd, libcore etc. get rebuilt.

@flo-l
Copy link
Contributor Author

flo-l commented May 31, 2016

cc @alexcrichton

@alexcrichton
Copy link
Member

Ah sorry, I believe I have misunderstood! The rebuilding as part of the second make command is actually the stage 1 set of libraries. These are the ones which are produced by the stage0 artifacts. That is, the chain of dependencies is:

  1. You modified src/librustc_mir/lib.rs
  2. This file is a dependency of x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_mir
  3. Transitively, that's a dependency of x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/bin/rustc, the final stage0 artifact.
  4. That file is a dependency of x86_64-unknown-linux-gnu/stage1/bin/rustc, the stage1 compiler.

The stage1 compiler has changed (as part of librustc_mir changing), so its dependants need to be rebuilt as well. These include the stage1 libraries (e.g. libcore + libstd).

Does that make sense? I'm gonna close this as it's intended behavior, but I'll of course answer any questions you may have!

@flo-l
Copy link
Contributor Author

flo-l commented May 31, 2016

Ah ok I understand, thanks for clarifying!

As mentioned above I'd like to build just rustc with some changes I made. Which make target corresponds to that and where will the binary be?

@alexcrichton
Copy link
Member

If all you want is the compiler itself, then this should suffice:

make x86_64-unknown-linux-gnu/stage1/bin/rustc

There may be a more ergonomic way to type that, although I don't recall off the top of my head...

Note though that this compiler won't be too too useful as it won't have a standard library to link against.

@flo-l
Copy link
Contributor Author

flo-l commented May 31, 2016

That does what it should! Thank you so much! 😁

And about that libstd thing: Could the --disable-inject-std-version option of the configure script help?

@alexcrichton
Copy link
Member

Wow I had no idea that option even still existed... I think that's from an era long since passed and no longer actually does anything!

@flo-l
Copy link
Contributor Author

flo-l commented May 31, 2016

I just checked, make x86_64-unknown-linux-gnu/stage1/bin/rustc seems to work, the produced binary reuses the previously built libstd. 🎉

Thank you very much, I was fighting with this for days!

@alexcrichton
Copy link
Member

Glad I could help!

bors added a commit that referenced this issue Jun 6, 2016
add documentation on howto build just rustc without libstd to the build system

I searched for days until I found this, maybe this helps other poor souls 😂

for reference #33990
bors added a commit that referenced this issue Jun 6, 2016
add documentation on howto build just rustc without libstd to the build system

I searched for days until I found this, maybe this helps other poor souls 😂

for reference #33990
bors added a commit that referenced this issue Jun 6, 2016
add documentation on howto build just rustc without libstd to the build system

I searched for days until I found this, maybe this helps other poor souls 😂

for reference #33990
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jun 7, 2016
…richton

add documentation on howto build just rustc without libstd to the build system

I searched for days until I found this, maybe this helps other poor souls 😂

for reference rust-lang#33990
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

2 participants