Closed
Description
trying to compile a project for riscv64gc-unknown-linux-musl
using cargo build --target riscv64gc-unknown-linux-musl -Zbuild-std=core,std,panic_abort
will result in cargo reporting not being able to find value SYS_clone3
while building the std:
error[E0425]: cannot find value `SYS_clone3` in this scope
--> /home/blackdragon2447/.rustup/toolchains/nightly-2022-02-13-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/weak.rs:202:17
|
202 | concat_idents!(SYS_, $name),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `SYS_clone`
|
::: /home/blackdragon2447/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.116/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs:239:1
|
239 | pub const SYS_clone: ::c_long = 220;
| ------------------------------------ similarly named constant `SYS_clone` defined here
|
::: /home/blackdragon2447/.rustup/toolchains/nightly-2022-02-13-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/process/process_unix.rs:165:9
|
165 | / raw_syscall! {
166 | | fn clone3(cl_args: *mut clone_args, len: libc::size_t) -> libc::c_long
167 | | }
| |_________- in this macro invocation
|
= note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0425`.
error: could not compile `std` due to previous error
i do have rustflags setup specifying the correct c toolchain for the target in ~/.cargo/config.toml
:
[target.riscv64gc-unknown-linux-musl]
rustflags = [
"-L/home/blackdragon2447/x-tools/riscv64-unknown-linux-musl/riscv64-unknown-linux-musl/sysroot/lib",
"-L/home/blackdragon2447/x-tools/riscv64-unknown-linux-musl/lib/gcc/riscv64-unknown-linux-musl/11.2.0/",
"-L/home/blackdragon2447/x-tools/riscv64-unknown-linux-musl/riscv64-unknown-linux-musl/sysroot/usr/lib",
"-C", "link-args=-lc",
"-C", "prefer-dynamic",
"-C", "target-feature=-crt-static"
]
ar = "riscv64-unknown-linux-musl-ar"
linker = "riscv64-unknown-linux-musl-gcc"
Meta
rustc --version --verbose
:
rustc 1.60.0-nightly (5d8767cb2 2022-02-12)
binary: rustc
commit-hash: 5d8767cb229b097fedb1dd4bd9420d463c37774f
commit-date: 2022-02-12
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/blackdragon2447/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
--------------------------------------
riscv64gc-unknown-linux-gnu
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.60.0-nightly (5d8767cb2 2022-02-12)