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

Building libstd without any features does not work #56228

Closed
RalfJung opened this issue Nov 26, 2018 · 9 comments
Closed

Building libstd without any features does not work #56228

RalfJung opened this issue Nov 26, 2018 · 9 comments
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@RalfJung
Copy link
Member

Building libstd without any features set leads to

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

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `std`.

To learn more, run the command again with --verbose.
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.qBKqt1BCzPhj/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "-p" "std"` failed with exit code: Some(101)

Looks like we try to use that crate even if the feature is not set (and hence the dependency not enabled in Cargo.toml)?

Cc @alexcrichton

@alexcrichton
Copy link
Member

This looks like it's likely related to compiling with panic=unwind, if panic=abort is used does it fix the error?

@RalfJung
Copy link
Member Author

That gets me a bit further, but libtest still fails to build:

error[E0463]: can't find crate for `panic_unwind`
  --> /home/r/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:57:1
   |
57 | extern crate panic_unwind;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

Seems libtest does not support panic=abort?

@alexcrichton
Copy link
Member

Ah yeah that's true, libtest currently has no way to work with panic abort

@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Aug 6, 2019
@jonas-schievink
Copy link
Contributor

Should this be closed? It seems unlikely to me that libtest will get support for panic=abort, and libstd appears to build fine now (which this issue is about).

@RalfJung
Copy link
Member Author

RalfJung commented Aug 6, 2019

@jonas-schievink so you tested libstd with no features and no compiler flags?

@jonas-schievink
Copy link
Contributor

No, but that failure looked expected to me. Perhaps I misread though.

@RalfJung
Copy link
Member Author

RalfJung commented Aug 6, 2019

I see. So that would be considering panic_unwind / panic_abort features mandatory in the sense that they cannot both be left off.

I could live with that, but it should be better documented in the Cargo.toml then.

@walksanatora
Copy link

walksanatora commented Feb 1, 2023

so wait how do you fix this
was able to partially fix with -Zbuild_std=std,panic_abort but now it is failing with the inability to find libunwind.so

@jyn514
Copy link
Member

jyn514 commented Feb 3, 2023

cargo build -Zbuild-std-features='' -Zbuild-std on a hello-world project works for me, so I'm going to assume this has been fixed (and indeed I see that the panic_abort crate is now mandatory).

@walksanatora I'm not sure how to fix your exact problem, but it doesn't look related to the original issue. The issue tracker is not a support forum. For future questions please ask in one of these places:

https://discord.gg/rust-lang/
https://discord.gg/rust-lang-community/
https://users.rust-lang.org/
https://rust-lang.zulipchat.com/

@jyn514 jyn514 closed this as completed Feb 3, 2023
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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants