Skip to content

Native bootstrap for RISC-V on Gentoo Linux (failure) #83970

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

Closed
dlan17 opened this issue Apr 7, 2021 · 7 comments
Closed

Native bootstrap for RISC-V on Gentoo Linux (failure) #83970

dlan17 opened this issue Apr 7, 2021 · 7 comments
Labels
C-bug Category: This is a bug. O-linux Operating system: Linux O-riscv Target: RISC-V architecture T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dlan17
Copy link

dlan17 commented Apr 7, 2021

Trying to do the native rust bootstrap on Gentoo Linux for RISC-V ARCH, but fail at 'compiler_builtins' crate.

I tried this code:
both tried & failed for rust-1.50.0 and 1.51.0, same error

the downstream bug report can be found here:
https://bugs.gentoo.org/747460

the full build log for 1.51.0:
https://bugs.gentoo.org/attachment.cgi?id=698247

any suggestion for how I could further debug this? or could someone shed some lights on this ..

==== snip of error logs ===

Did not run successfully: signal: 11
rustc exited with signal: 11
"/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "compiler_builtins" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/vendor/compiler_bui
ltins/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "codegen-units=10000" "-C" "debuginfo=0" "--cfg" "f
eature=\"c\"" "--cfg" "feature=\"cc\"" "--cfg" "feature=\"compiler-builtins\"" "--cfg" "feature=\"core\"" "--cfg" "feature=\"default\"" "--cfg" "feature=\"rustc-dep-of-std\"" "-C" "metadata=bd9daff102317ab4" "-C" "extra-filename=-bd9daf
f102317ab4" "--out-dir" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps" "--target" "riscv64gc-unknown-linux-gnu" "-C" "linker=riscv6
4-unknown-linux-gnu-gcc" "-L" "dependency=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps" "-L" "dependency=/var/notmpfs/portage/dev-l
ang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/release/deps" "--extern" "core=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unk
nown-linux-gnu/release/deps/librustc_std_workspace_core-154d9dce115223e5.rmeta" "--cap-lints" "allow" "-Zmacro-backtrace" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Cforce-unwind-tables=yes" "-Z" "binary-dep-depinfo" "
-L" "native=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/build/compiler_builtins-dee9282c2b696383/out" "--cfg" "feature=\"unstable\"" "-
-cfg" "__absvdi2=\"optimized-c\"" "--cfg" "__absvsi2=\"optimized-c\"" "--cfg" "__absvti2=\"optimized-c\"" "--cfg" "__addvdi3=\"optimized-c\"" "--cfg" "__addvsi3=\"optimized-c\"" "--cfg" "__addvti3=\"optimized-c\"" "--cfg" "__clzdi2=\"op
timized-c\"" "--cfg" "__clzsi2=\"optimized-c\"" "--cfg" "__clzti2=\"optimized-c\"" "--cfg" "__cmpdi2=\"optimized-c\"" "--cfg" "__cmpti2=\"optimized-c\"" "--cfg" "__ctzdi2=\"optimized-c\"" "--cfg" "__ctzsi2=\"optimized-c\"" "--cfg" "__ct
zti2=\"optimized-c\"" "--cfg" "__divdc3=\"optimized-c\"" "--cfg" "__divsc3=\"optimized-c\"" "--cfg" "__divxc3=\"optimized-c\"" "--cfg" "__extendhfsf2=\"optimized-c\"" "--cfg" "__ffsti2=\"optimized-c\"" "--cfg" "__int_util=\"optimized-c\
"" "--cfg" "__muldc3=\"optimized-c\"" "--cfg" "__mulsc3=\"optimized-c\"" "--cfg" "__mulvdi3=\"optimized-c\"" "--cfg" "__mulvsi3=\"optimized-c\"" "--cfg" "__mulvti3=\"optimized-c\"" "--cfg" "__mulxc3=\"optimized-c\"" "--cfg" "__negdf2=\"
optimized-c\"" "--cfg" "__negdi2=\"optimized-c\"" "--cfg" "__negsf2=\"optimized-c\"" "--cfg" "__negti2=\"optimized-c\"" "--cfg" "__negvdi2=\"optimized-c\"" "--cfg" "__negvsi2=\"optimized-c\"" "--cfg" "__negvti2=\"optimized-c\"" "--cfg" 
"__paritydi2=\"optimized-c\"" "--cfg" "__paritysi2=\"optimized-c\"" "--cfg" "__parityti2=\"optimized-c\"" "--cfg" "__popcountdi2=\"optimized-c\"" "--cfg" "__popcountsi2=\"optimized-c\"" "--cfg" "__popcountti2=\"optimized-c\"" "--cfg" "_
_powixf2=\"optimized-c\"" "--cfg" "__subvdi3=\"optimized-c\"" "--cfg" "__subvsi3=\"optimized-c\"" "--cfg" "__subvti3=\"optimized-c\"" "--cfg" "__truncdfhf2=\"optimized-c\"" "--cfg" "__truncdfsf2=\"optimized-c\"" "--cfg" "__truncsfhf2=\"
optimized-c\"" "--cfg" "__ucmpdi2=\"optimized-c\"" "--cfg" "__ucmpti2=\"optimized-c\"" "--cfg" "apple_versioning=\"optimized-c\"" "-l" "static=compiler-rt" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/var/notmpfs
/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1" "-C" "panic=abort" "--remap-path-prefix" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src=/rustc/1.51.0" "-Z" "force-unstable-
if-unmarked"
-------------
error: could not compile `compiler_builtins`

Caused by:
  process didn't exit successfully: `/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/bootstrap/debug/rustc --crate-name compiler_builtins /var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/vendor/compi
ler_builtins/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=10000 -C debuginfo=0 --cfg 'feature="c"' --cfg 'fea
ture="cc"' --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=bd9daff102317ab4 -C extra-filename=-bd9daff102317ab4 --out-dir /var/notmpfs/portage/dev-lang/
rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps --target riscv64gc-unknown-linux-gnu -C linker=riscv64-unknown-linux-gnu-gcc -L dependency=/var/notmpfs/portage/dev-
lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps -L dependency=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/release/deps --extern core=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps/librustc_std_workspace_core-154d9dce115223e5.rmeta --cap-lints allow -Zmacro-backtrace -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes -Cforce-unwind-tables=yes -Z binary-dep-depinfo -L native=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/build/compiler_builtins-dee9282c2b696383/out --cfg 'feature="unstable"' --cfg '__absvdi2="optimized-c"' --cfg '__absvsi2="optimized-c"' --cfg '__absvti2="optimized-c"' --cfg '__addvdi3="optimized-c"' --cfg '__addvsi3="optimized-c"' --cfg '__addvti3="optimized-c"' --cfg '__clzdi2="optimized-c"' --cfg '__clzsi2="optimized-c"' --cfg '__clzti2="optimized-c"' --cfg '__cmpdi2="optimized-c"' --cfg '__cmpti2="optimized-c"' --cfg '__ctzdi2="optimized-c"' --cfg '__ctzsi2="optimized-c"' --cfg '__ctzti2="optimized-c"' --cfg '__divdc3="optimized-c"' --cfg '__divsc3="optimized-c"' --cfg '__divxc3="optimized-c"' --cfg '__extendhfsf2="optimized-c"' --cfg '__ffsti2="optimized-c"' --cfg '__int_util="optimized-c"' --cfg '__muldc3="optimized-c"' --cfg '__mulsc3="optimized-c"' --cfg '__mulvdi3="optimized-c"' --cfg '__mulvsi3="optimized-c"' --cfg '__mulvti3="optimized-c"' --cfg '__mulxc3="optimized-c"' --cfg '__negdf2="optimized-c"' --cfg '__negdi2="optimized-c"' --cfg '__negsf2="optimized-c"' --cfg '__negti2="optimized-c"' --cfg '__negvdi2="optimized-c"' --cfg '__negvsi2="optimized-c"' --cfg '__negvti2="optimized-c"' --cfg '__paritydi2="optimized-c"' --cfg '__paritysi2="optimized-c"' --cfg '__parityti2="optimized-c"' --cfg '__popcountdi2="optimized-c"' --cfg '__popcountsi2="optimized-c"' --cfg '__popcountti2="optimized-c"' --cfg '__powixf2="optimized-c"' --cfg '__subvdi3="optimized-c"' --cfg '__subvsi3="optimized-c"' --cfg '__subvti3="optimized-c"' --cfg '__truncdfhf2="optimized-c"' --cfg '__truncdfsf2="optimized-c"' --cfg '__truncsfhf2="optimized-c"' --cfg '__ucmpdi2="optimized-c"' --cfg '__ucmpti2="optimized-c"' --cfg 'apple_versioning="optimized-c"' -l static=compiler-rt` (exit code: 254)
warning: build failed, waiting for other jobs to finish...

Did not run successfully: signal: 11
rustc exited with signal: 11
"/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "libc" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/vendor/libc/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "codegen-units=1" "-C" "debuginfo=0" "--cfg" "feature=\"align\"" "--cfg" "feature=\"rustc-dep-of-std\"" "--cfg" "feature=\"rustc-std-workspace-core\"" "-C" "metadata=043964802a47f292" "-C" "extra-filename=-043964802a47f292" "--out-dir" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps" "--target" "riscv64gc-unknown-linux-gnu" "-C" "linker=riscv64-unknown-linux-gnu-gcc" "-L" "dependency=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps" "-L" "dependency=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/release/deps" "--extern" "rustc_std_workspace_core=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1-std/riscv64gc-unknown-linux-gnu/release/deps/librustc_std_workspace_core-154d9dce115223e5.rmeta" "--cap-lints" "allow" "-Zmacro-backtrace" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Cforce-unwind-tables=yes" "-Z" "binary-dep-depinfo" "--cfg" "freebsd11" "--cfg" "libc_priv_mod_use" "--cfg" "libc_union" "--cfg" "libc_const_size_of" "--cfg" "libc_align" "--cfg" "libc_core_cvoid" "--cfg" "libc_packedN" "--cfg" "libc_cfg_target_vendor" "--cfg" "libc_thread_local" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1" "--remap-path-prefix" "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src=/rustc/1.51.0" "-Z" "force-unstable-if-unmarked"
@dlan17 dlan17 added the C-bug Category: This is a bug. label Apr 7, 2021
@eggyal
Copy link
Contributor

eggyal commented Apr 7, 2021

@rustbot label: +A-rustbuild +T-compiler +O-linux +O-riscv

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) O-linux Operating system: Linux O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 7, 2021
@dlan17
Copy link
Author

dlan17 commented Apr 21, 2021

@almindor @Disasm
ping, do you have any suggestion regarding this? I'd really appreciate your help..

@almindor
Copy link

Sorry, I've been out of the RiscV loop for a while now, this looks like a core issue with Rustc/core tho. compiler_builtins not compiling.

I don't see much from the cause tho, could you try running this with a debugger? I understand this might be difficult given this is a stage1 recompile. Signal 11 is SEGFAULT during compilation which points to a bigger issue.

@Disasm
Copy link
Contributor

Disasm commented Apr 21, 2021

@dlan17 I'd also suggest running the last command under gdb. Also check that you have enough RAM.

@dlan17
Copy link
Author

dlan17 commented Apr 22, 2021

@almindor @Disasm
thanks for your comments, I don't think it's the problem of lacking RAM, I've both tested on sifive unleashed board (8GB mem) and qemu virtual machine (with 20GB mem), same error

I'm trying to debug with gdb, but can't get useful backtrace info, not sure if there is anything I missed..
or is the problem that the stage1 rustc is built as release version? [1]

also I need to set extra ENVs variables to run the error command manually, please help checking if ever I did this correctly? [2]

[1] c Sysroot { compiler: Compiler { stage: 1, host: TargetSelection { triple: "riscv64gc-unknown-linux-gnu", file: None } } }
Copy "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage0-rustc/riscv64gc-unknown-linux-gnu/release/rustc-main" to "/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/bin/rustc"

[2] check the script and full gdb log here: https://dev.gentoo.org/~dlan/riscv/logs/run_rust.txt

basically the script is something like this
#!/bin/bash

export RUSTC_REAL=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/bin/rustc
export RUST_BACKTRACE=full
export RUSTC_STAGE=1
export RUSTC_SYSROOT=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1
export RUSTC_LIBDIR=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/lib
export LD_LIBRARY_PATH=/var/notmpfs/portage/dev-lang/rust-1.51.0/work/rustc-1.51.0-src/build/riscv64gc-unknown-linux-gnu/stage1/lib
export RUSTC_BOOTSTRAP=1

${RUST_LAST_COMMAND}

@istankovic
Copy link
Contributor

@dlan17 is this still relevant? Could you please check with latest rust?

@dlan17
Copy link
Author

dlan17 commented Nov 3, 2023

yes, it works for me now, I have several machines with rust-1.66.0, 1.71.1, 1.73.0 installed, thanks for ping this

@dlan17 dlan17 closed this as completed Nov 3, 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. O-linux Operating system: Linux O-riscv Target: RISC-V architecture T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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

6 participants