# Dockerfile
FROM alpine:3.8
USER root
ENV USER=root
RUN apk add --no-cache openssl openssl-dev curl gcc
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /tmp
RUN sh -c "source /root/.cargo/env && cargo new --bin app"
WORKDIR /tmp/app
RUN echo 1.46.0 > rust-toolchain
RUN echo 'rand = "*"' >> Cargo.toml
RUN sh -c "source /root/.cargo/env && cargo build"
docker build .
The last step:
Step 11/11 : RUN sh -c "source /root/.cargo/env && cargo build"
---> Running in c554b90561db
info: syncing channel updates for '1.46.0-x86_64-unknown-linux-musl'
info: latest update on 2020-08-27, rust version 1.46.0 (04488afe3 2020-08-24)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Downloading crates ...
Downloaded rand_chacha v0.2.2
Downloaded rand_core v0.5.1
Downloaded getrandom v0.1.14
Downloaded libc v0.2.76
Downloaded ppv-lite86 v0.2.9
Downloaded rand v0.7.3
Downloaded cfg-if v0.1.10
Compiling libc v0.2.76
Compiling getrandom v0.1.14
Compiling cfg-if v0.1.10
Compiling ppv-lite86 v0.2.9
error: failed to run custom build command for `getrandom v0.1.14`
Caused by:
process didn't exit successfully: `/tmp/app/target/debug/build/getrandom-64ae542341c0eb62/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: build failed
The command '/bin/sh -c sh -c "source /root/.cargo/env && cargo build"' returned a non-zero code: 101
Not only crate rand, but replacing rand with log will also have this error:
Updating crates.io index
Downloading crates ...
Downloaded log v0.4.11
Downloaded cfg-if v0.1.10
Compiling log v0.4.11
Compiling cfg-if v0.1.10
error: failed to run custom build command for `log v0.4.11`
Caused by:
process didn't exit successfully: `/tmp/app/target/debug/build/log-ec0bf32b8f3a6724/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
Actually I just need libc = "0.2" to reproduce the issue.
searched nightlies: from nightly-2020-06-19 to nightly-2020-06-21
regressed nightly: nightly-2020-06-20
searched commits: from https://github.com/rust-lang/rust/commit/e55d3f9c5213fe1a25366450127bdff67ad1eca2 to https://github.com/rust-lang/rust/commit/2d8bd9b74dc0cf06d881bac645698ccbcf9d9c5e
regressed commit: https://github.com/rust-lang/rust/commit/63b441aafbf52d6ba789ecc478455800c1a48df9
bisected with cargo-bisect-rustc v0.5.2
Host triple: x86_64-unknown-linux-musl
Reproduce with:
cargo bisect-rustc 2020-06-19 --end 2020-06-21 --without-cargo
Most likely #70740, cc @petrochenkov as reviewer of that PR.
Related issue: #74757
I can't repoduce this on my musl based Gentoo linux system, which use musl 1.2.1.
> cd /tmp
> cargo new app
Created binary (application) `app` package
> cd app
> echo 1.46.0 > rust-toolchain
> echo 'rand = "*"' >> Cargo.toml
> cargo build
info: syncing channel updates for '1.46.0-x86_64-unknown-linux-musl'
info: latest update on 2020-08-27, rust version 1.46.0 (04488afe3 2020-08-24)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Compiling libc v0.2.76
Compiling getrandom v0.1.14
Compiling cfg-if v0.1.10
Compiling ppv-lite86 v0.2.9
Compiling rand_core v0.5.1
Compiling rand_chacha v0.2.2
Compiling rand v0.7.3
Compiling app v0.1.0 (/tmp/app)
Finished dev [unoptimized + debuginfo] target(s) in 10.82s
> ldd target/debug/app
ldd (0x7f321a2c1000)
> file target/debug/app
target/debug/app: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, with debug_info, not stripped
> ./target/debug/app
Hello, world!
Alpine 3.8 use musl 1.1.19 but rust CI use musl 1.1.24, and I'm sure musl don't have any binary forward compatibility (Yestday I try to downgrade musl to 1.1.24 and all programs I compile recently ware broken and show same error (signal: 11, SIGSEGV: invalid memory reference))
Other test in docker:
Alpine 3.8:
info: syncing channel updates for '1.46.0-x86_64-unknown-linux-musl'
info: latest update on 2020-08-27, rust version 1.46.0 (04488afe3 2020-08-24)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Downloading crates ...
Downloaded rand_chacha v0.2.2
Downloaded rand_core v0.5.1
Downloaded cfg-if v0.1.10
Downloaded getrandom v0.1.14
Downloaded ppv-lite86 v0.2.9
Downloaded libc v0.2.76
Downloaded rand v0.7.3
Compiling libc v0.2.76
Compiling getrandom v0.1.14
Compiling cfg-if v0.1.10
Compiling ppv-lite86 v0.2.9
error: failed to run custom build command for `getrandom v0.1.14`
Caused by:
process didn't exit successfully: `/tmp/app/target/debug/build/getrandom-64ae542341c0eb62/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
Alpine 3.9
info: syncing channel updates for '1.46.0-x86_64-unknown-linux-musl'
info: latest update on 2020-08-27, rust version 1.46.0 (04488afe3 2020-08-24)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Downloading crates ...
Downloaded libc v0.2.76
Downloaded ppv-lite86 v0.2.9
Downloaded rand_core v0.5.1
Downloaded cfg-if v0.1.10
Downloaded rand_chacha v0.2.2
Downloaded rand v0.7.3
Downloaded getrandom v0.1.14
Compiling libc v0.2.76
Compiling getrandom v0.1.14
Compiling cfg-if v0.1.10
Compiling ppv-lite86 v0.2.9
Compiling rand_core v0.5.1
Compiling rand_chacha v0.2.2
Compiling rand v0.7.3
Compiling app v0.1.0 (/tmp/app)
Finished dev [unoptimized + debuginfo] target(s) in 33.04s
3.10
info: syncing channel updates for '1.46.0-x86_64-unknown-linux-musl'
info: latest update on 2020-08-27, rust version 1.46.0 (04488afe3 2020-08-24)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Downloading crates ...
Downloaded rand_chacha v0.2.2
Downloaded rand_core v0.5.1
Downloaded cfg-if v0.1.10
Downloaded getrandom v0.1.14
Downloaded libc v0.2.76
Downloaded ppv-lite86 v0.2.9
Downloaded rand v0.7.3
Compiling libc v0.2.76
Compiling getrandom v0.1.14
Compiling cfg-if v0.1.10
Compiling ppv-lite86 v0.2.9
Compiling rand_core v0.5.1
Compiling rand_chacha v0.2.2
Compiling rand v0.7.3
Compiling app v0.1.0 (/tmp/app)
Finished dev [unoptimized + debuginfo] target(s) in 1m 03s
Cool. @jmjoy so the answer is to upgrade alpine to newer version (easy) or just upgrade musl (hard).
This could be closed as won't fix.
Tagged this issue as O-musl, please correct me if that's wrong
Assigning P-medium as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.
Most helpful comment
I can't repoduce this on my musl based Gentoo linux system, which use musl 1.2.1.
Alpine 3.8 use musl 1.1.19 but rust CI use musl 1.1.24, and I'm sure musl don't have any binary forward compatibility (Yestday I try to downgrade musl to 1.1.24 and all programs I compile recently ware broken and show same error (signal: 11, SIGSEGV: invalid memory reference))
Other test in docker:
Alpine 3.8:
Alpine 3.9
3.10