I am a novice and want to deploy the program written to Centos server.
Find the information and say, execute the following command.
rustup target add x86_64-unknown-linux-musl # First time only
cargo build --release --target x86_64-unknown-linux-musl
When I execute it, the following error appears:
xxxx@xx rust_hello % cargo build --target x86_64-unknown-linux-musl --release
Compiling rust_hello v0.1.0 (/Volumes/data/rust_hello)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-nostartfiles" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "-L" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps/rust_hello-2cb0146f93d23d46.rust_hello.bxpzb21w-cgu.0.rcgu.o" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps/rust_hello-2cb0146f93d23d46.rust_hello.bxpzb21w-cgu.1.rcgu.o" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps/rust_hello-2cb0146f93d23d46.rust_hello.bxpzb21w-cgu.2.rcgu.o" "-o" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps/rust_hello-2cb0146f93d23d46" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps/rust_hello-2cb0146f93d23d46.2pxdl82tzlmdajwy.rcgu.o" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/Volumes/data/rust_hello/target/x86_64-unknown-linux-musl/release/deps" "-L" "/Volumes/data/rust_hello/target/release/deps" "-L" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-f4ca16729b67f4dd.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-400395ea2841002a.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-b0533ea0af675dc9.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-e9d03d8a1cf7a110.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-fe8cb29709d122d4.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-09ef970e0d183722.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-1a8801c99e79f10f.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-886c89b28e5e0865.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-dcf93364faa2ceaa.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-75081e895819d734.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-6c4598f129413e8a.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-d3a472b733fbfd21.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-2f23acd805819d02.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-d2b457edb67a2174.rlib" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-fc65d219541fe932.rlib" "-Wl,--end-group" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-f4df6b79d8e73f02.rlib" "-Wl,-Bdynamic" "/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: clang: warning: argument unused during compilation: '-static-pie' [-Wunused-command-line-argument]
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
error: could not compile `rust_hello`
To learn more, run the command again with --verbose.