Skip to content
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

stage0 libstd fails to build when jemalloc is disabled #43510

Closed
cuviper opened this issue Jul 27, 2017 · 6 comments · Fixed by #43589
Closed

stage0 libstd fails to build when jemalloc is disabled #43510

cuviper opened this issue Jul 27, 2017 · 6 comments · Fixed by #43589
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@cuviper
Copy link
Member

cuviper commented Jul 27, 2017

Since #43320 bumped the bootstrap compiler, stage0 libstd fails to build when jemalloc is disabled:

error[E0463]: can't find crate for `alloc_jemalloc`

error: aborting due to previous error

error: Could not compile `std`.

I believe it needs to restore the logic removed here:
https://github.com/rust-lang/rust/pull/42727/files#diff-242481015141f373dcb178e93cffa850L236

I tried to add this to libstd/lib.rs:

// Always use alloc_system during stage0 since we don't know if the alloc_*
// crate the stage0 compiler will pick by default is available (most
// obviously, if the user has disabled jemalloc in `./configure`).
#![cfg_attr(any(stage0, feature = "force_alloc_system"), feature(global_allocator))]
#![cfg(any(stage0, feature = "force_alloc_system"))]
#[global_allocator]
static ALLOC: alloc_system::System = alloc_system::System;

Then stage0 passed, but stage1 std failed like:

error[E0463]: can't find crate for `std`

error: aborting due to previous error

error: Could not compile `std`.

😕

@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 28, 2017
@Mark-Simulacrum
Copy link
Member

cc @alexcrichton

@alexcrichton
Copy link
Member

We should probably add a builder for this...

@cuviper
Copy link
Member Author

cuviper commented Jul 28, 2017

or just get on with evicting jemalloc... 😉

@aidanhs
Copy link
Member

aidanhs commented Aug 1, 2017

force_alloc_system is not the right way to fix this - I added that so I could build rust with a local rust that does not have jemalloc i.e. unless the following two conditions are true:

  • you're using a local rust (as opposed to the automatic stage0 download) and
  • your local rust does not have jemalloc (you compiled the whole thing yourself with --disable-jemalloc)

it's irrelevant.

Edit: to be clear, by "not the right way to fix this" I mean "it worked fine before I added that flag, so its removal is probably not the root cause". That's doesn't exclude the possibility that we could perform some incantations with this flag and fix the issue.

Edit2: sorry, I thought you were exclusively referring to force_alloc_system rather than all the stage0 logic. I read #43524 and thought this issue was about the same thing.

@cuviper
Copy link
Member Author

cuviper commented Aug 1, 2017

Generally, the two conditions you list are actually true for me. I build Fedora's rustc without jemalloc, and I use that as the local stage0 to build the next release. And i think the force flag does come into play too, because if we need to rebuild the current release then the local rust gets treated as a stage1.

But right now it's more direct. I am using the downloaded stage0, which wants to default to jemalloc. Since I'm disabling that for my build, stage0 can't find it.

@aidanhs
Copy link
Member

aidanhs commented Aug 1, 2017

Interesting, I kinda figured I was the only one! Rereading #39086, I see I'm wrong about my two conditions above - it actually applies when trying to build something without jemalloc, from something that defaults to it.

Anyway, it should all be fixed soonish...

aidanhs added a commit that referenced this issue Aug 10, 2017
bors added a commit that referenced this issue Aug 10, 2017
Make a disable-jemalloc build work

Fixes #43510. I've tested this up to building a stage1 compiler.

r? @alexcrichton

cc @cuviper @vorner

@cuviper your fix was almost correct, you just had a stray `!` in there which caused the second error you saw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants