rust-lang / rust-lang/rust

rustc SIGSEGV on RISC-V when building simple Hello World on Ubuntu in stable and nightly version

Open
#157,749 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-crash needs-triage O-riscv T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Hello.

I ran in a rustc error while running cargo build --release on a Ubuntu 24.4 .0.
I tried to experiment with rust on RISC-V, i installed the build-essential bevor installing rust.
I installed the Stable Version and encountered an error while compiling the basic Hello World program which i get by running
cargo init in a directory. For the compile i ran cargo build --release and encountered a SIGSEGV. I tested the exact same way with the exact version on a Debian 12 x86_64 system and encountered no issue. I also checked if the nightly version listed below encounters the same issue, yes it does. I will attach the stacktrace, version and system information below, hope thats everything you need, if anything is missing please let me know.

RISC-V

Version Stable

rustc --version --verbose
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: riscv64gc-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.2

cargo --version --verbose
cargo 1.96.0 (30a34c682 2026-05-25)
release: 1.96.0
commit-hash: 30a34c6821b57de0aaec83a901aca39f88f6778c
commit-date: 2026-05-25
host: riscv64gc-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.19.0-DEV (sys:0.4.87+curl-8.19.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Ubuntu 24.4.0 (noble) [64-bit]

Version Nightly

rustc --version --verbose
rustc 1.98.0-nightly (485ec3fbc 2026-06-10)
binary: rustc
commit-hash: 485ec3fbcc12fa14ef6596dabb125ad710499c9e
commit-date: 2026-06-10
host: riscv64gc-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

cargo --version --verbose
cargo 1.98.0-nightly (0b1123a48 2026-06-01)
release: 1.98.0-nightly
commit-hash: 0b1123a48825309b697312b44fdb64b3df00c958
commit-date: 2026-06-01
host: riscv64gc-unknown-linux-gnu
libgit2: 1.9.4 (sys:0.21.0 vendored)
libcurl: 8.20.0-DEV (sys:0.4.88+curl-8.20.0 vendored ssl:OpenSSL/3.6.2)
ssl: OpenSSL 3.6.2 7 Apr 2026
os: Ubuntu 24.4.0 (noble) [64-bit]

x86_64 Debian

Version Stable

rustc --version --verbose                                                                                     
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.2

cargo --version --verbose                                                                                      
cargo 1.96.0 (30a34c682 2026-05-25)
release: 1.96.0
commit-hash: 30a34c6821b57de0aaec83a901aca39f88f6778c
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.19.0-DEV (sys:0.4.87+curl-8.19.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Debian 12.0.0 (bookworm) [64-bit]

Stacktrace

Stable

cargo build --release
   Compiling rust-test6 v0.1.0 (/home/<user>/rust-test6)
error: rustc interrupted by SIGSEGV, printing backtrace

/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(+0xdddcb4)[0x3fa8e59cb4]
linux-vdso.so.1(__vdso_rt_sigreturn+0x0)[0x3fb43da800]
/lib/riscv64-linux-gnu/libc.so.6(syscall+0x1c)[0x3fa7fb3eac]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(_RNvMNtNtNtNtCs5MV44isskXG_3std3sys4sync5mutex5futexNtB2_5Mutex14lock_contended+0x96)[0x3fa8c93408]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(_RNvMNtNtNtNtCs5MV44isskXG_3std3sys4sync7condvar5futexNtB2_7Condvar4wait+0xaa)[0x3faf2ae8d0]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(+0x72142a6)[0x3faf2902a6]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(+0x72159ec)[0x3faf2919ec]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(+0x7216b9a)[0x3faf292b9a]
/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-93dfc950481021c5.so(+0x725792e)[0x3faf2d392e]
/lib/riscv64-linux-gnu/libc.so.6(+0x710d6)[0x3fa7f630d6]
/lib/riscv64-linux-gnu/libc.so.6(+0xc3934)[0x3fa7fb5934]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=268435456
error: could not compile `rust-test6` (bin "rust-test6")

Caused by:
  process didn't exit successfully: `/home/<user>/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/rustc --crate-name rust_test6 --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=243 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=b6b00c2a189442ed -C extra-filename=-07eeaa4a9ec4e703 --out-dir /home/<user>/rust-test6/target/release/deps -C strip=debuginfo -L dependency=/home/<user>/rust-test6/target/release/deps` (signal: 11, SIGSEGV: invalid memory reference)

Nightly

cargo build --release
   Compiling rust-test6-nightly v0.1.0 (/home/<user>/rust-test6-nightly)
error: rustc interrupted by SIGSEGV, printing backtrace

/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(+0xd7a3ee)[0x3fa86b83ee]
linux-vdso.so.1(__vdso_rt_sigreturn+0x0)[0x3fb3f42800]
/lib/riscv64-linux-gnu/libc.so.6(syscall+0x1c)[0x3fa7875eac]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(_RNvMNtNtNtNtCs1cDhzN1Mo2y_3std3sys4sync5mutex5futexNtB2_5Mutex14lock_contended+0x96)[0x3fa852e98c]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(_RNvMNtNtNtNtCs1cDhzN1Mo2y_3std3sys4sync7condvar5futexNtB2_7Condvar4wait+0xaa)[0x3faed8a8c8]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(+0x74303ca)[0x3faed6e3ca]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(+0x742f81c)[0x3faed6d81c]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(+0x742f9a2)[0x3faed6d9a2]
/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-620f3b43f6d4b7eb.so(+0x7471a0e)[0x3faedafa0e]
/lib/riscv64-linux-gnu/libc.so.6(+0x710d6)[0x3fa78250d6]
/lib/riscv64-linux-gnu/libc.so.6(+0xc3934)[0x3fa7877934]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=268435456
error: could not compile `rust-test6-nightly` (bin "rust-test6-nightly")

Caused by:
  process didn't exit successfully: `/home/<user>/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/rustc --crate-name rust_test6_nightly --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=121 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=de074db0159cd67e -C extra-filename=-10b8e939ad9d89b7 --out-dir /home/<user>/rust-test6-nightly/target/release/deps -C strip=debuginfo -L dependency=/home/<user>/rust-test6-nightly/target/release/deps` (signal: 11, SIGSEGV: invalid memory reference)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The failure occurs in rustc invoked by cargo build --release for src/main.rs on riscv64gc-unknown-linux-gnu; start by reproducing the minimal cargo init project on Ubuntu and comparing the stable and nightly stack traces with the x86_64 result. Done means the same Hello World release build completes without SIGSEGV on RISC-V.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust, ubuntu
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.