why "cannot find Scrt1.o: No such file or directory" ?
I found " Scrt1.o crti.o " in “buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot/usr/lib”
➜ hello git:(master) ✗ cargo build --target mipsel-unknown-linux-gnu --verbose
Compiling hello v0.1.0 (/home/owen/workspace/hello)
Running `rustc --edition=2018 --crate-name core src/bin/core.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=117fe321f7998b78 -C extra-filename=-117fe321f7998b78 --out-dir /home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps --target mipsel-unknown-linux-gnu -C ar=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-ar -C linker=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-gcc -C incremental=/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/incremental -L dependency=/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps -L dependency=/home/owen/workspace/hello/target/debug/deps -C link-arg=-L/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot -C link-arg=--sysroot=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot -C link-arg=-lrt -C link-arg=-mabi=32 -C link-arg=-fno-pic -C link-arg=-EL -C link-arg=-std=gnu99 -C link-arg=-ffunction-sections -C link-arg=-msoft-float -C target-feature=+crt-static -C link-arg=-fPIC`
error: linking with `/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-gcc` failed: exit code: 1
|
= note: "/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.10l8zmd7jx83dpt6.rcgu.o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.1i673xi8911u4d3u.rcgu.o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.1lx0dmvgebiy0m37.rcgu.o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.281h1xoc72hpygwr.rcgu.o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.3zqmdy2oirzkn3rk.rcgu.o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.aevfcy3ij1uagpv.rcgu.o" "-o" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps/core-117fe321f7998b78.1a8xrfrbeg0cvvql.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps" "-L" "/home/owen/workspace/hello/target/debug/deps" "-L" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libstd-af9362ed5d81a840.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libpanic_unwind-4d55a38564aae54a.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libbacktrace_sys-f8521075e248b627.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libunwind-7c91ffdc8da860d3.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/librustc_demangle-0ad27b9879d551d3.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/liblibc-588f18eae3ea58be.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/liballoc-4ebf5caee903d98f.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/librustc_std_workspace_core-8895b32baedb08c6.rlib" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libcore-6a9d233d01acc350.rlib" "-Wl,--end-group" "/home/owen/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-gnu/lib/libcompiler_builtins-851bb3b5f6c4db49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-L/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot" "--sysroot=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot" "-lrt" "-mabi=32" "-fno-pic" "-EL" "-std=gnu99" "-ffunction-sections" "-msoft-float" "-fPIC"
= note: /home/owen/workspace/ingenic_x2000/tools/toolchains/mips-gcc720-glibc229/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/bin/ld: cannot find Scrt1.o: No such file or directory
/home/owen/workspace/ingenic_x2000/tools/toolchains/mips-gcc720-glibc229/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: Could not compile `hello`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name core src/bin/core.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=117fe321f7998b78 -C extra-filename=-117fe321f7998b78 --out-dir /home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps --target mipsel-unknown-linux-gnu -C ar=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-ar -C linker=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-gcc -C incremental=/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/incremental -L dependency=/home/owen/workspace/hello/target/mipsel-unknown-linux-gnu/debug/deps -L dependency=/home/owen/workspace/hello/target/debug/deps -C link-arg=-L/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot -C link-arg=--sysroot=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot -C link-arg=-lrt -C link-arg=-mabi=32 -C link-arg=-fno-pic -C link-arg=-EL -C link-arg=-std=gnu99 -C link-arg=-ffunction-sections -C link-arg=-msoft-float -C target-feature=+crt-static -C link-arg=-fPIC` (exit code: 1)
hello world project config:
.cargo/config
# soldier100
[build]
target = "mipsel-unknown-linux-gnu"
[target.mipsel-unknown-linux-gnu]
linker = "/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-gcc"
ar = "/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/bin/mips-linux-gnu-ar"
rustflags = [
"-C",
"link-arg=-L/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot",
"-C",
"link-arg=--sysroot=/home/owen/workspace/ingenic_x2000/buildroot/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot",
"-C",
"link-arg=-lrt",
"-C",
"link-arg=-mabi=32",
"-C",
"link-arg=-fno-pic",
"-C",
"link-arg=-EL",
"-C",
"link-arg=-std=gnu99",
"-C",
"link-arg=-ffunction-sections",
"-C",
"link-arg=-msoft-float",
"-C",
"target-feature=+crt-static",
"-C",
"link-arg=-fPIC",
]
rust-toolchain.toml
[toolchain]
# buildroot/package/rust/rust.mk use rustc version 1.33.0; so i add it*emphasized text*
channel = "1.33.0-x86_64-unknown-linux-gnu"