Closed
Description
I cloned the Rust repo with the intention of building rustc for cross-compilation to the riscv64gc-unknown-linux-musl
target. I did the following:
$x.py setup
- selected the "codegen" option- Edited the
config.toml
file to append:
[target.riscv64gc-unknown-linux-musl]
ar = "riscv64-unknown-linux-musl-ar"
linker = "riscv64-unknown-linux-musl-gcc"
cc = "riscv64-unknown-linux-musl-gcc"
cxx = "riscv64-unknown-linux-musl-g++"
musl-root = "/home/tjc/riscv64-linux-musl-cross/riscv64-linux-musl"
./x.py build --target x86_64-unknown-linux-gnu --target riscv64gc-unknown-linux-musl
This failed; the end of the output is as follows:
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
[snip]
Finished release [optimized] target(s) in 43.27s
Building crtbegin.o and crtend.o
running: "riscv64-unknown-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv64gc" "-mabi=lp64d" "-mcmodel=medany" "-std=c11" "-DCRT_HAS_INITFINI_ARRAY" "-DEH_USE_FRAME_REGISTRY" "-o" "/home/tjc/rust2/build/riscv64gc-unknown-linux-musl/native/crt/crtbegin.o" "-c" "/home/tjc/rust2/src/llvm-project/compiler-rt/lib/crt/crtbegin.c"
cargo:warning=cc1: fatal error: /home/tjc/rust2/src/llvm-project/compiler-rt/lib/crt/crtbegin.c: No such file or directory
cargo:warning=compilation terminated.
exit status: 1
error occurred: Command "riscv64-unknown-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv64gc" "-mabi=lp64d" "-mcmodel=medany" "-std=c11" "-DCRT_HAS_INITFINI_ARRAY" "-DEH_USE_FRAME_REGISTRY" "-o" "/home/tjc/rust2/build/riscv64gc-unknown-linux-musl/native/crt/crtbegin.o" "-c" "/home/tjc/rust2/src/llvm-project/compiler-rt/lib/crt/crtbegin.c" with args "riscv64-unknown-linux-musl-gcc" did not execute successfully (status code exit status: 1).
Build completed unsuccessfully in 0:02:32
After I executed git submodule update --init
and retried the build command, the LLVM submodule was checked out and the build was able to make progress. It seems like this should be done automatically. I'm not sure if the issue is specific to this target or if it's happening with other cross-compilation targets.
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Makes things more difficult for new or seasoned contributors to RustCategory: This is a bug.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Target: The musl libcRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)