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

The newest nightly breaks static musl builds. #44069

Closed
golddranks opened this issue Aug 24, 2017 · 11 comments
Closed

The newest nightly breaks static musl builds. #44069

golddranks opened this issue Aug 24, 2017 · 11 comments
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@golddranks
Copy link
Contributor

golddranks commented Aug 24, 2017

The newest nightly breaks static musl builds.

This is most likely to be caused by the landing of #40113

Here's a very simple demo: https://github.com/golddranks/rustc_broken_static_demo (Try running build_old.sh and build_new.sh)

The scripts build the hello world program in two environments: one with nightly 2017-08-23 and one with 2017-08-24. The latter contains the PR #40113. The Dockerfile for the image is here: https://github.com/golddranks/rust_musl_docker

The former succeeds, whereas the latter fails with:

     Running `rustc --crate-name rustc_broken_static_demo src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=5a6a9f373ff62f0b -C extra-filename=-5a6a9f373ff62f0b --out-dir /workdir/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -L dependency=/workdir/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/workdir/target/debug/deps`
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "/workdir/target/x86_64-unknown-linux-musl/debug/deps/rustc_broken_static_demo-5a6a9f373ff62f0b.0.o" "-o" "/workdir/target/x86_64-unknown-linux-musl/debug/deps/rustc_broken_static_demo-5a6a9f373ff62f0b" "/workdir/target/x86_64-unknown-linux-musl/debug/deps/rustc_broken_static_demo-5a6a9f373ff62f0b.crate.allocator.o" "-Wl,--gc-sections" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/workdir/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/workdir/target/debug/deps" "-L" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-1873b4d191d228e8.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-655f47aee8a3420b.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-ab5831f4fba53ade.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_system-1c88582d9022c1cc.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-fa52c59d2108c1f8.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-45a286e82269a40e.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-d9d4ae8ab67a6001.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d1d3fb714ff1a835.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_unicode-10859fb08aa219d9.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-da02dfafc4660314.rlib" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-126bb39b1b53af10.rlib" "-l" "unwind" "-static" "-Wl,-Bdynamic" "/root/.rustup/toolchains/nightly-2017-08-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)"
  = note: /usr/bin/ld: cannot find -lunwind
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 24, 2017
@aidanhs
Copy link
Member

aidanhs commented Aug 24, 2017

https://github.com/rust-lang/rust/pull/40113/files#diff-3503e1a05300f03b6ff9df8257913e83

This used to only link to libunwind when building the libunwind crate, now it does it on everything that includes the libunwind crate (I think). Not sure how this passed tests. Maybe it found a path to the musl libunwind.a?

@smaeul
Copy link
Contributor

smaeul commented Aug 24, 2017

s/static-nobundle/static/ should fix it; that was a mistake on my part (crt*.o are copied from musl_root, but libunwind.a is not).

@aidanhs
Copy link
Member

aidanhs commented Aug 24, 2017

I will test that suggestion now.

bors added a commit that referenced this issue Aug 25, 2017
Do not assume libunwind.a is available on musl

Fixes #40113, #44069, and clux/muslrust#16.

libunwind.a is not copied from musl_root, so it must be integrated into the unwind crate.
@alexcrichton
Copy link
Member

Fixed in #44070

@golddranks
Copy link
Contributor Author

Hm, now the newest nightly musl doesn't even download :D

info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
error: component download failed for rust-std-x86_64-unknown-linux-musl

@aidanhs
Copy link
Member

aidanhs commented Aug 26, 2017

@golddranks can you try again? It seems fine to me, here's a terminal transcript I've just run:

~ $ rustup update nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: downloading component 'rustc'
 53.2 MiB /  53.2 MiB (100 %)  23.8 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 84.0 MiB /  84.0 MiB (100 %)  55.7 MiB/s ETA:   0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
 17.9 MiB /  17.9 MiB (100 %)   3.5 MiB/s ETA:   0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-std' for 'x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-gnu updated - rustc 1.21.0-nightly (2aeb5930f 2017-08-25)

~ $ echo 'fn main() {}' > x.rs
~ $ rustc --target x86_64-unknown-linux-musl x.rs
~ $ ./x
~ $ ldd x
        not a dynamic executable
~ $ file x
x: ELF 64-bit LSB  executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=76e65b3d762c26af39227c47141f4f67f7b20a55, not stripped

@golddranks
Copy link
Contributor Author

golddranks commented Aug 26, 2017

Tried again, here's mine:

~ $ rustup update
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2017-08-26, rust version 1.21.0-nightly (2aeb5930f 2017-08-25)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
error: component download failed for rust-std-x86_64-unknown-linux-musl
info: checking for self-updates

  nightly-x86_64-apple-darwin update failed - rustc 1.21.0-nightly (2c0558f63 2017-08-24)

@golddranks
Copy link
Contributor Author

golddranks commented Aug 26, 2017

Could it be a problem with area-based proxies or something? I'm located in Japan, Tokyo. Tried many times and it consistently fails at that item.

@golddranks
Copy link
Contributor Author

Tried with a different network (tethering through mobile), and it still fails. Tried with rustup update nightly which, for a reason unknown to me brought up a more detailed error:

info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
error: component download failed for rust-std-x86_64-unknown-linux-musl
info: caused by: could not download file from 'https://static.rust-lang.org/dist/2017-08-26/rust-std-nightly-x86_64-unknown-linux-musl.tar.xz' to '/Users/um003415/.rustup/downloads/e6108b2fa9ad25cb303e21e216a557e11a2a633586b9856de84064fade0651fc.partial'
info: caused by: error during download
info: caused by: [33] Requested range was not delivered by the server (HTTP server doesn't seem to support byte ranges. Cannot resume.)
info: backtrace:

stack backtrace:
   0:        0x1095998ae - backtrace::backtrace::trace::h44539d42e8c86729
   1:        0x10959a12c - backtrace::capture::Backtrace::new::h5f3de869c0349b3d
   2:        0x1095993d6 - error_chain::make_backtrace::h34ae912053f4a126
   3:        0x109560e86 - download::curl::download::hce069bb0f14d5dd2
   4:        0x10955f240 - download::download_to_path_with_backend::h117f20f63fa75168
   5:        0x1094d8057 - rustup_utils::utils::download_file_with_resume::h523bb0f3a635163f
   6:        0x1094a2a8f - rustup_dist::download::DownloadCfg::download::h11601c9bf443ac0a
   7:        0x10949b7d1 - rustup_dist::manifestation::Manifestation::update::h03e87519f12f2de4
   8:        0x10948611f - rustup_dist::dist::update_from_dist_::h9075ed00e47841fe
   9:        0x1094852d9 - rustup_dist::dist::update_from_dist::h68c861ce5520c639
  10:        0x109448290 - rustup::toolchain::Toolchain::install::h8d5d75e7a0a26413
  11:        0x109449011 - rustup::toolchain::Toolchain::install_from_dist_inner::h271107f0a7dae968
  12:        0x109448ca3 - rustup::toolchain::Toolchain::install_from_dist::hda92f29cbfc4b7a4
  13:        0x10939b46e - rustup_init::rustup_mode::update::hdf1cfff907031852
  14:        0x109388c38 - rustup_init::rustup_mode::main::hd56e0e782a4ea323
  15:        0x1093b4370 - rustup_init::run_rustup::hc3aac5a16c6bde4a
  16:        0x1093b3a39 - rustup_init::main::h07c1d4d8cd7703cf
  17:        0x1095c6daa - __rust_maybe_catch_panic
  18:        0x1095c61b6 - std::rt::lang_start::ha1f4f04346e51ef5

@golddranks
Copy link
Contributor Author

Okay, deleting the partial file fixed the problem. It seems that I found a bug in rustup.

@golddranks
Copy link
Contributor Author

Reported: rust-lang/rustup#1243

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. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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

5 participants