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

rustc 1.67.0 internal compiler error for sparc64-unknown-netbsd target when building rust 1.67.0 natively #108117

Closed
he32 opened this issue Feb 16, 2023 · 8 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-netbsd Operating system: NetBSD O-SPARC Target: SPARC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@he32
Copy link
Contributor

he32 commented Feb 16, 2023

Code

Sorry... No code, above trying to build the rust compiler itself,
natively, on NetBSD/sparc64 10.0_BETA.

Meta

The issue is observed while using rust 1.66.0 to build 1.67.0 for the perhaps
a little obscure target sparc64-unknown-netbsd.

Rust 1.66.0 itself did build successfully natively on this platform.

I've tried building rust 1.67.0 both with the slightly old external LLVM
(14.0.6) and with the bundled LLVM -- both fail the same way.

The issue occurs rather late in the build, at a time when the natively
built new rustc is being used to build the rust compiler itself again (if I have
understood correctly). The full build log is some 2MB in size, and should
now be downloadable from

https://filesender.sikt.no/?s=download&token=5cb5b8e1-4773-4da2-9e1c-b97daf057004

until march 16 2023.

rustc --version --verbose:

rustc 1.66.0 (69f9c33d7 2022-12-12) (built from a source tarball)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: sparc64-unknown-netbsd
release: 1.66.0
LLVM version: 14.0.6

(that's for the already installed 1.66.0 version.)

Error output

     Running `/usr/pkgsrc/wip/rust/work/rustc-1.67.0-src/build/bootstrap/debug/rustc --crate-name typenum --edition=2018 /usr/pkgsrc/wip/rust/work/rustc-1.67.0-src/vendor/typenum/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Zunstable-options --check-cfg 'values(feature, "const-generics", "force_unix_path_separator", "i128", "no_std", "scale-info", "scale_info", "strict")' --check-cfg 'names()' --check-cfg 'values()' -C metadata=5e39c60fcb634ae1 -C extra-filename=-5e39c60fcb634ae1 --out-dir /usr/pkgsrc/wip/rust/work/rustc-1.67.0-src/build/sparc64-unknown-netbsd/stage2-tools/sparc64-unknown-netbsd/release/deps --target sparc64-unknown-netbsd -L dependency=/usr/pkgsrc/wip/rust/work/rustc-1.67.0-src/build/sparc64-unknown-netbsd/stage2-tools/sparc64-unknown-netbsd/release/deps -L dependency=/usr/pkgsrc/wip/rust/work/rustc-1.67.0-src/build/sparc64-unknown-netbsd/stage2-tools/release/deps --cap-lints allow -Csymbol-mangling-version=v0 -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(parallel_compiler)' '--check-cfg=values(release)' '--check-cfg=values(no_btreemap_remove_entry)' '--check-cfg=values(crossbeam_loom)' '--check-cfg=values(span_locations)' '--check-cfg=values(rustix_use_libc)' -Zmacro-backtrace -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,/usr/pkg/lib -Zunstable-options -Csplit-debuginfo=off -Z binary-dep-depinfo`
thread 'rustc' panicked at 'expected expression', compiler/rustc_expand/src/base.rs:176:18
stack backtrace:
   0:         0x4b4e9a84 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha98ec3ab0ebc45c6
   1:         0x4b588e1c - core::fmt::write::he50a8ed9ed8f8a70
   2:         0x4b4a6820 - std::io::Write::write_fmt::h2b7f3b980e9cb2b9
   3:         0x4b4e9874 - std::sys_common::backtrace::print::h80ed1a24eac33214
   4:         0x4b4d59e8 - std::panicking::default_hook::{{closure}}::h4bfe009cbf4cdf18
   5:         0x4b4d5618 - std::panicking::default_hook::hd365f50bc82cde54
   6:         0x4b4cfe34 - core::ops::function::Fn::call::hdc74585b697a9aef
   7:         0x41664e80 - rustc_driver[b3449c293f48fb29]::DEFAULT_HOOK::{closure#0}::{closure#0}
   8:         0x4b4d63e4 - std::panicking::rust_panic_with_hook::hc39cbbdde74271b9
   9:         0x4b4e9e70 - std::panicking::begin_panic_handler::{{closure}}::h03db108ee89381c9
  10:         0x4b4e9bf0 - std::sys_common::backtrace::__rust_end_short_backtrace::hcb185c8d6ea6926e
  11:         0x4b4d5bac - rust_begin_unwind
  12:         0x4b4859b8 - core::panicking::panic_fmt::hada63450f332ba58
  13:         0x478e02f4 - <rustc_expand[c5a7c97120d81084]::base::Annotatable>::expect_expr
  14:         0x478c0004 - <rustc_expand[c5a7c97120d81084]::expand::AstFragmentKind>::expect_from_annotatables::<alloc[20875b84b34d27cd]::vec::Vec<rustc_expand[c5a7c97120d81084]::base::Annotatable>>
  15:         0x478c32a0 - <rustc_expand[c5a7c97120d81084]::expand::MacroExpander>::fully_expand_fragment
  16:         0x478c0c3c - <rustc_expand[c5a7c97120d81084]::expand::MacroExpander>::expand_crate
  17:         0x417c54bc - <rustc_session[1e08ea05f674addc]::session::Session>::time::<core[2c0009376117aa86]::result::Result<rustc_ast[44bc1b3735e615d3]::ast::Crate, rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_interface[813d6c11d2970333]::passes::configure_and_expand::{closure#1}>
  18:         0x417bc7d8 - rustc_interface[813d6c11d2970333]::passes::configure_and_expand
  19:         0x417f59b8 - <rustc_interface[813d6c11d2970333]::queries::Queries>::expansion
  20:         0x4162b740 - rustc_span[b087444988390df3]::with_source_map::<core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_interface[813d6c11d2970333]::interface::run_compiler<core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_driver[b3449c293f48fb29]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  21:         0x41616860 - <scoped_tls[b73c11231e9b3dad]::ScopedKey<rustc_span[b087444988390df3]::SessionGlobals>>::set::<rustc_interface[813d6c11d2970333]::interface::run_compiler<core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_driver[b3449c293f48fb29]::run_compiler::{closure#1}>::{closure#0}, core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>>
  22:         0x415cada0 - std[4c094d4434749a4d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[813d6c11d2970333]::util::run_in_thread_pool_with_globals<rustc_interface[813d6c11d2970333]::interface::run_compiler<core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_driver[b3449c293f48fb29]::run_compiler::{closure#1}>::{closure#0}, core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>>
  23:         0x415a0ad8 - <<std[4c094d4434749a4d]::thread::Builder>::spawn_unchecked_<rustc_interface[813d6c11d2970333]::util::run_in_thread_pool_with_globals<rustc_interface[813d6c11d2970333]::interface::run_compiler<core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>, rustc_driver[b3449c293f48fb29]::run_compiler::{closure#1}>::{closure#0}, core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2c0009376117aa86]::result::Result<(), rustc_errors[1860347428201aa0]::ErrorGuaranteed>>::{closure#1} as core[2c0009376117aa86]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:         0x4b49ea3c - std::sys::unix::thread::Thread::new::thread_start::h46069fca6121842a
  25:         0x4bf0fcc8 - pthread__create_tramp
                               at /usr/src/lib/libpthread/pthread.c:592:12
  26:         0x4b8666b8 - <unknown>

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.67.0 (fc594f156 2023-01-24) (built from a source tarball) running on sparc64-unknown-netbsd

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C symbol-mangling-version=v0 -Z unstable-options -Z macro-backtrace -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,/usr/pkg/lib -Z unstable-options -C split-debuginfo=off -Z binary-dep-depinfo -Z tls-model=initial-exec

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

query stack during panic:
end of query stack

Did not run successfully: exit status: 101
error: could not compile `typenum`

Backtrace

Backtrace already provided above.

@he32 he32 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 Feb 16, 2023
@he32
Copy link
Contributor Author

he32 commented Feb 25, 2023

Just FYI, the native build of 1.67.1 on NetBSD/sparc64 fails the same way.

@workingjubilee
Copy link
Contributor

In order to assist diagnosis later (if this is actually secretly architecture neutral it may be solved sooner, but if it is arch-specific, it may take a while for a sparc64 expert to come by: they aren't common, lately) I have put the log into a gist: https://gist.github.com/workingjubilee/428fdf2392ec7723b25c1b29f9f573ce

Don't worry, it's only 124KiB gzipped.

@psumbera
Copy link
Contributor

psumbera commented Mar 9, 2023

@he32
Copy link
Contributor Author

he32 commented Mar 9, 2023

Yep, will try that. It'll take a while -- my sparc64 hosts are not the speediest variants...

@he32
Copy link
Contributor Author

he32 commented Mar 15, 2023

Good news: the native build on NetBSD/sparc64 10.0_BETA succeeded after applying the referenced patch above, pointed to by @psumbera

@psumbera
Copy link
Contributor

Thanks for confirming this. My testing reveals that for version 1.68.0 there is no need for this patch.

@he32
Copy link
Contributor Author

he32 commented Mar 15, 2023

OK, good to know, since upgrading to 1.68.0 is next on my TODO list after applying this patch to our pkgsrc-wip repository.

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this issue Mar 15, 2023
Specifically, this is related to
rust-lang/rust#108426

and this got referenced from my reported issue at
rust-lang/rust#108117

With this a native build of rust on NetBSD/sparc64
10.0_BETA succeeds.
@jyn514
Copy link
Member

jyn514 commented Mar 27, 2023

Closing as a duplicate of #108426 (comment); 1.68 has already been released and we don't support versions older than the latest stable.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 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) ❄️ O-netbsd Operating system: NetBSD O-SPARC Target: SPARC processors 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

4 participants