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

aarch64-linux-musl fails to build from bootstrap #54999

Open
awilfox opened this Issue Oct 11, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@awilfox
Copy link

awilfox commented Oct 11, 2018

Hi there. I'm the project lead of Adélie Linux, and we are attempting to port Rust to our distro. We've successfully built Rust on our libre 64-bit PowerPC platform, and used that to generate cross bootstraps for our other architectures.

All of the cross bootstraps work correctly, except arm64, which won't build a native compiler. While building stage1 std artifacts, the following error is seen:

Assembling stage1 compiler (aarch64-foxkit-linux-musl)
Building stage1 std artifacts (aarch64-foxkit-linux-musl -> aarch64-foxkit-linux-musl)
   Compiling cc v1.0.18                                                                                                                                                                                                                                                        
   Compiling core v0.0.0 (file:///usr/src/packages/user/rust/src/rustc-1.29.1-src/src/libcore)
   Compiling unwind v0.0.0 (file:///usr/src/packages/user/rust/src/rustc-1.29.1-src/src/libunwind)
   Compiling panic_unwind v0.0.0 (file:///usr/src/packages/user/rust/src/rustc-1.29.1-src/src/libpanic_unwind)
   Compiling build_helper v0.1.0 (file:///usr/src/packages/user/rust/src/rustc-1.29.1-src/src/build_helper)
thread 'main' panicked at 'cannot access a scoped thread local variable without calling `set` first', vendor/scoped-tls/src/lib.rs:186:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
             at librustc/util/common.rs:53
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:479
   6: std::panicking::begin_panic
             at ./libstd/panicking.rs:409
   7: syntax_pos::symbol::Symbol::as_str
             at ./<panic macros>:3
             at libsyntax_pos/symbol.rs:484
             at libsyntax_pos/symbol.rs:173
   8: syntax::attr::<impl syntax::ast::Attribute>::check_name
             at ./libsyntax_pos/symbol.rs:222
             at libsyntax/ast.rs:76
             at libsyntax/attr/mod.rs:208
   9: <rustc::hir::check_attr::CheckAttrVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
             at librustc/hir/check_attr.rs:62
             at ./libcore/iter/iterator.rs:1783
             at ./libcore/iter/iterator.rs:1559
             at ./libcore/slice/mod.rs:2440
             at ./libcore/iter/iterator.rs:1559
             at ./libcore/iter/iterator.rs:1782
             at librustc/hir/check_attr.rs:62
             at librustc/hir/check_attr.rs:296
  10: rustc::hir::check_attr::check_crate
             at librustc/hir/itemlikevisit.rs:80
             at librustc/hir/mod.rs:699
             at librustc/hir/check_attr.rs:314
  11: rustc::ty::context::TyCtxt::create_and_enter
             at librustc_driver/driver.rs:1263
             at ./librustc/util/common.rs:165
             at ./librustc/util/common.rs:159
             at librustc_driver/driver.rs:1262
             at ./librustc/ty/context.rs:1908
             at ./librustc/ty/context.rs:1876
             at ./librustc/ty/context.rs:1815
             at ./librustc/ty/context.rs:1875
             at ./librustc/ty/context.rs:1907
             at ./librustc/ty/context.rs:1865
             at ./libstd/thread/local.rs:294
             at ./libstd/thread/local.rs:248
             at ./librustc/ty/context.rs:1857
             at ./libstd/thread/local.rs:294
             at ./libstd/thread/local.rs:248
             at ./librustc/ty/context.rs:1849
             at ./librustc/ty/context.rs:1887
             at ./librustc/ty/context.rs:1187
  12: rustc_driver::driver::compile_input
             at librustc_driver/driver.rs:1245
             at librustc_driver/driver.rs:285
  13: rustc_driver::run_compiler
             at librustc_driver/lib.rs:562
             at librustc_driver/lib.rs:483
             at librustc_driver/driver.rs:74
             at ./vendor/scoped-tls/src/lib.rs:155
             at librustc_driver/driver.rs:73
             at librustc_driver/lib.rs:482
             at ./vendor/scoped-tls/src/lib.rs:155
             at ./libsyntax/lib.rs:98
             at ./vendor/scoped-tls/src/lib.rs:155
             at ./libsyntax/lib.rs:97
             at librustc_driver/lib.rs:473
  14: rustc_driver::monitor::{{closure}}
             at librustc_driver/lib.rs:1742
             at librustc_driver/lib.rs:187
             at librustc_driver/lib.rs:1657
  15: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  16: rustc_driver::run
             at ./libstd/panicking.rs:289
             at ./libstd/panic.rs:392
             at librustc_driver/lib.rs:1571
             at librustc_driver/lib.rs:1582
             at librustc_driver/lib.rs:1656
             at librustc_driver/lib.rs:186
  17: rustc_driver::main
             at librustc_driver/lib.rs:1735
  18: std::rt::lang_start::{{closure}}
             at ./libstd/rt.rs:74
  19: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  20: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  21: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  22: main
  23: __libc_start_main
             at src/env/__libc_start_main.c:76
query stack during panic:
end of query stack

error: Could not compile `core`.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/usr/src/packages/user/rust/src/prebuilt/bin/cargo" "build" "--target" "aarch64-foxkit-linux-musl" "-j" "16" "--release" "--locked" "--frozen" "--features" "panic-unwind backtrace" "--manifest-path" "/usr/src/packages/user/rust/src/rustc-1.29.1-src/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1088:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
             at /usr/src/rust/src/libstd/panicking.rs:409
   6: bootstrap::compile::run_cargo
             at bootstrap/compile.rs:1088
   7: <bootstrap::compile::Std as bootstrap::builder::Step>::run
             at bootstrap/compile.rs:106
   8: bootstrap::builder::Builder::ensure
             at bootstrap/builder.rs:1134
   9: <bootstrap::compile::Test as bootstrap::builder::Step>::run
             at bootstrap/compile.rs:332
  10: bootstrap::builder::Builder::ensure
             at bootstrap/builder.rs:1134
  11: <bootstrap::compile::Rustc as bootstrap::builder::Step>::run
             at bootstrap/compile.rs:458
  12: bootstrap::builder::Builder::ensure
             at bootstrap/builder.rs:1134
  13: <bootstrap::compile::Assemble as bootstrap::builder::Step>::run
             at bootstrap/compile.rs:927
  14: bootstrap::builder::Builder::ensure
             at bootstrap/builder.rs:1134
  15: bootstrap::builder::Builder::compiler
             at bootstrap/builder.rs:579
  16: <bootstrap::compile::Std as bootstrap::builder::Step>::make_run
             at bootstrap/compile.rs:56
  17: bootstrap::builder::StepDescription::maybe_run
             at bootstrap/builder.rs:191
  18: bootstrap::builder::StepDescription::run
             at bootstrap/builder.rs:215
  19: bootstrap::builder::Builder::run_step_descriptions
             at bootstrap/builder.rs:571
  20: bootstrap::builder::Builder::execute_cli
             at bootstrap/builder.rs:561
  21: bootstrap::Build::build
             at bootstrap/lib.rs:471
  22: bootstrap::main
             at bootstrap/bin/main.rs:29
  23: std::rt::lang_start::{{closure}}
             at /usr/src/rust/src/libstd/rt.rs:74
  24: std::panicking::try::do_call
  25: __rust_maybe_catch_panic
  26: std::rt::lang_start_internal
  27: std::rt::lang_start
             at /usr/src/rust/src/libstd/rt.rs:74
  28: main
  29: __libc_start_main
             at src/env/__libc_start_main.c:76
failed to run: /usr/src/packages/user/rust/src/rustc-1.29.1-src/build/bootstrap/debug/bootstrap build -j 16
Build completed unsuccessfully in 1:55:57

I'm fairly new to Rust, having just bought the print edition of The Rust Programming Language (2018 ed) on Monday. Therefore, I'm afraid I won't be too much help understanding the complexities of the compiler itself. (One of our contributors is much more knowledgeable about Rust and is the one who helped us generate these toolchains.) If this is beyond the scope of the Rust project, feel free to close this issue and we won't bother you again.

@smaeul

This comment has been minimized.

Copy link
Contributor

smaeul commented Oct 27, 2018

The assertion failure here is in the GLOBALS.with call in syntax_pos. However, there is a call to syntax::with_globals in the backtrace (in frame 13), which is:

pub fn with_globals<F, R>(f: F) -> R
    where F: FnOnce() -> R
{
    let globals = Globals::new();
    GLOBALS.set(&globals, || {
        syntax_pos::GLOBALS.set(&globals.syntax_pos_globals, f)
    })
}

So the call to GLOBALS.with is made in an appropriate context. Since this is architecture-specific, I'm wondering if something is going wrong with TLS access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment