Open
Description
I'm trying to compile the std
crate using a custom target specification for mips64-unknown-linux-gnu
. I've got stuck a little and I'd appreciate a little help. My specification is a copy of the built-in specification for mips64-unknown-linux-gnuabi64
with the following differences:
- The
data-layout
field has been changed to match the data layout used in clang for the same target. - The
is-builtin
field has been set tofalse
. - The
llvm-target
field has been set tomips64-unknown-linux-gnu
. - The
max-atomic-width
field has been set to32
(it was64
before). - The
target-pointer-width
field has been set to32
to match the data layout.
This is the whole target specification:
{
"arch": "mips64",
"cpu": "mips64r2",
"data-layout": "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128",
"dynamic-linking": true,
"env": "gnu",
"executables": true,
"features": "+mips64r2",
"has-elf-tls": true,
"has-rpath": true,
"is-builtin": false,
"linker-flavor": "gcc",
"linker-is-gnu": true,
"llvm-target": "mips64-unknown-linux-gnu",
"max-atomic-width": 32,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"relro-level": "full",
"target-c-int-width": "32",
"target-endian": "big",
"target-family": "unix",
"target-pointer-width": "32",
"vendor": "unknown"
}
I end up with the following output:
Compiling compiler_builtins v0.0.0 (file:///root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim)
Compiling std v0.0.0 (file:///root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd)
Running `rustc --crate-name build_script_build /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="c"' --cfg 'feature="compiler-builtins"' --cfg 'feature="default"' --cfg 'feature="rustbuild"' -C metadata=90fbb7fd0c7442d5 -C extra-filename=-90fbb7fd0c7442d5 --out-dir /tmp/xargo.606pX8cxT6GH/target/release/build/compiler_builtins-90fbb7fd0c7442d5 -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --extern cc=/tmp/xargo.606pX8cxT6GH/target/release/deps/libcc-786ac8d380309a5a.rlib`
Running `rustc --crate-name build_script_build /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=0e769dbdf5eed459 -C extra-filename=-0e769dbdf5eed459 --out-dir /tmp/xargo.606pX8cxT6GH/target/release/build/std-0e769dbdf5eed459 -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --extern build_helper=/tmp/xargo.606pX8cxT6GH/target/release/deps/libbuild_helper-ca4cc909bb4adcb1.rlib --extern cc=/tmp/xargo.606pX8cxT6GH/target/release/deps/libcc-786ac8d380309a5a.rlib`
Running `/tmp/xargo.606pX8cxT6GH/target/release/build/std-0e769dbdf5eed459/build-script-build`
Running `/tmp/xargo.606pX8cxT6GH/target/release/build/compiler_builtins-90fbb7fd0c7442d5/build-script-build`
warning: ../../libcompiler_builtins/compiler-rt/lib/builtins/divdc3.c:21:1: warning: conflicting types for built-in function '__divdc3'
warning: __divdc3(double __a, double __b, double __c, double __d)
warning: ^
warning: ../../libcompiler_builtins/compiler-rt/lib/builtins/divsc3.c:21:1: warning: conflicting types for built-in function '__divsc3'
warning: __divsc3(float __a, float __b, float __c, float __d)
warning: ^
warning: ../../libcompiler_builtins/compiler-rt/lib/builtins/muldc3.c:21:1: warning: conflicting types for built-in function '__muldc3'
warning: __muldc3(double __a, double __b, double __c, double __d)
warning: ^
warning: ../../libcompiler_builtins/compiler-rt/lib/builtins/mulsc3.c:21:1: warning: conflicting types for built-in function '__mulsc3'
warning: __mulsc3(float __a, float __b, float __c, float __d)
warning: ^
LLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:416> <MCOperand Reg:321>>
error: Could not compile `core`.
Caused by:
process didn't exit successfully: `rustc --crate-name core /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C metadata=59ab99930ed6da97 -C extra-filename=-59ab99930ed6da97 --out-dir /tmp/xargo.606pX8cxT6GH/target/mips64-unknown-linux-gnu/release/deps --target mips64-unknown-linux-gnu -C ar=mips64-buildroot-linux-gnu-ar -C linker=mips64-buildroot-linux-gnu-gcc -L dependency=/tmp/xargo.606pX8cxT6GH/target/mips64-unknown-linux-gnu/release/deps -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --sysroot /root/.xargo -Z force-unstable-if-unmarked` (exit code: 1)
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.606pX8cxT6GH/Cargo.toml" "--target" "mips64-unknown-linux-gnu" "-v" "-p" "std"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
The reason why I'm trying this is that I have an existing Debian system with this target (it's Ubiquiti EdgeRouter) and I'd like to compile a Rust application for this system. It's a big endian MIPS64 system with n32 ABI. Unfortunately, Rust supports only n64.