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

ICE generated when attempting to bootstrap on x86_64-unknown-linux-gnu with a local libc checkout #89296

Closed
lightspot21 opened this issue Sep 27, 2021 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lightspot21
Copy link

Steps to reproduce

Assuming rustc master, clean:

  1. Clone libc from https://github.com/rust-lang/libc and checkout tag 0.2.99 (same as shown in rustc master's Cargo.lock) inside the rustc repo root.
  2. Change Cargo.lock as:
diff --git a/Cargo.lock b/Cargo.lock
index 6b3a714920b..b9dc888b347 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1893,8 +1893,6 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
 [[package]]
 name = "libc"
 version = "0.2.99"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
 dependencies = [
  "rustc-std-workspace-core",
 ]
  1. Change Cargo.toml as:
diff --git a/Cargo.toml b/Cargo.toml
index 3822da2ccd5..a6f2bd40dac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -112,6 +112,6 @@ rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
 rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
 rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
 rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
-
+libc = { path = 'libc' }
 [patch."https://github.com/rust-lang/rust-clippy"]
 clippy_lints = { path = "src/tools/clippy/clippy_lints" }
  1. Run the following command
./x.py build -i --stage 1 --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu compiler/rustc library/std

Error output

Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling autocfg v1.0.0
   Compiling libc v0.2.99 (/home/lightspot21/repos/rust/libc)
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.65
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling cfg-if v1.0.0
   Compiling scopeguard v1.1.0
   Compiling log v0.4.14
   Compiling smallvec v1.6.1
   Compiling cc v1.0.69
   Compiling instant v0.1.6
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `242338`,
 right: `10278`', compiler/rustc_query_impl/src/on_disk_cache.rs:555:5

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.57.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C embed-bitcode=no -C debuginfo=0 -C debug-assertions=off -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `libc`
warning: build failed, waiting for other jobs to finish...
error: build failed
Build completed unsuccessfully in 0:05:27
Backtrace

stack backtrace:
   Compiling hashbrown v0.11.0
   0:     0x7f8435903243 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h39285ceae8a649f2
   1:     0x7f8435975fec - core::fmt::write::h0188529f4c2385fc
   2:     0x7f843591f6f2 - std::io::Write::write_fmt::hf8939236737fc0d3
   3:     0x7f84359030cf - std::sys_common::backtrace::print::h7e677897a0297258
   4:     0x7f8435928427 - std::panicking::default_hook::{{closure}}::h0a9e06d60f4c5f9c
   5:     0x7f84359281f3 - std::panicking::default_hook::h1c52e2b8cbfbaf22
   6:     0x7f84360e3641 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::he397f76e0ecfaebf
   7:     0x7f8435928893 - std::panicking::rust_panic_with_hook::h8de6825f28f52383
   8:     0x7f8435913d00 - std::panicking::begin_panic_handler::{{closure}}::h5d038e075ac84a09
   9:     0x7f8435913c44 - std::sys_common::backtrace::__rust_end_short_backtrace::h356ea3839faeb6de
  10:     0x7f8435928492 - rust_begin_unwind
  11:     0x7f84358e0721 - core::panicking::panic_fmt::h728f3e29540717bf
  12:     0x7f843597c5a8 - core::panicking::assert_failed_inner::hdb62319f1a85fb5d
  13:     0x7f843604f07b - core::panicking::assert_failed::h0c55ebb1577bca42
  14:     0x7f84375441b3 - rustc_query_impl::on_disk_cache::decode_tagged::h251b6dcb62aa0431
  15:     0x7f84375e90c6 - <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::new::h4b59b2a25ef5e78d
  16:     0x7f843625e6c3 - rustc_incremental::persist::load::load_query_result_cache::h19751fa193a8d613
  17:     0x7f8436285d90 - rustc_interface::passes::create_global_ctxt::hdc2c0bb7d305123c
  18:     0x7f843625cedc - rustc_interface::queries::Query<T>::compute::h5f94f459aa795199
  19:     0x7f84361bf559 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hc10f34e1794ae673
  20:     0x7f84361c0f0d - rustc_span::with_source_map::h45f4db966f4bc9be
  21:     0x7f84361c06f0 - rustc_interface::interface::create_compiler_and_run::ha040450ac43aa6bc
  22:     0x7f84360d6c8e - scoped_tls::ScopedKey<T>::set::hc1c18124f854b72d
  23:     0x7f84360e6565 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0c16973631f3825e
  24:     0x7f84361ae561 - std::panicking::try::h5dbbfd1a4ce3a0df
  25:     0x7f84360cc6e6 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hed264ccaa380ed94
  26:     0x7f84359204f8 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h808e9eb66c407dff
  27:     0x7f84358f5c4a - std::sys::unix::thread::Thread::new::thread_start::h6a556919fb924504
  28:     0x7f84302f8259 - start_thread
  29:     0x7f84357775e3 - __GI___clone
  30:                0x0 - <unknown>

Tbh I feel I am doing something wrong here; the reason I use a separate libc is because of a port of rustc I am working on. I don't know much Rust so apologies for any errors.

@lightspot21 lightspot21 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 27, 2021
@JohnTitor JohnTitor added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 8, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 25, 2023

Likely a duplicate of #76720, since this is a stage 1 build.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants