环境:
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc
version is rustc 1.52.1 (9bc8c42bb 2021-05-09)
项目依赖:
[dependencies] actix-web = "3.3.2" quickxml_to_serde = "0.4.3" serde_json = "1.0.68"
错误:
cargo build --release --target=x86_64-unknown-linux-musl --verbose
Fresh unicode-xid v0.2.2
Compiling cfg-if v1.0.0
Running rustc --crate-name cfg_if --edition=2018 /Users/lgy/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no -C metadata=3659865723c6761c -C extra-filename=-3659865723c6761c --out-dir /Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Users/lgy/Documents/xmlassint/target/release/deps --cap-lints allow
Fresh autocfg v1.0.1
Fresh version_check v0.9.3
Compiling slab v0.4.4
Compiling lazy_static v1.4.0
Compiling futures-sink v0.3.17
Running rustc --crate-name slab --edition=2018 /Users/lgy/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/slab-0.4.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=48837676366b2903 -C extra-filename=-48837676366b2903 --out-dir /Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Users/lgy/Documents/xmlassint/target/release/deps --cap-lints allow
Running rustc --crate-name lazy_static /Users/lgy/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/lazy_static-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no -C metadata=dbe72fc09fa72228 -C extra-filename=-dbe72fc09fa72228 --out-dir /Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Users/lgy/Documents/xmlassint/target/release/deps --cap-lints allow
Running rustc --crate-name futures_sink --edition=2018 /Users/lgy/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/futures-sink-0.3.17/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=2dc84c3d7f760b38 -C extra-filename=-2dc84c3d7f760b38 --out-dir /Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Users/lgy/Documents/xmlassint/target/release/deps --cap-lints allow
error[E0463]: can't find crate for core
|
= note: the x86_64-unknown-linux-musl
target may not be installed
error[E0463]: can't find crate for core
|
= note: the x86_64-unknown-linux-musl
target may not be installed
error: aborting due to previous error
For more information about this error, try rustc --explain E0463
.
error: aborting due to previous error
For more information about this error, try rustc --explain E0463
.
error: could not compile lazy_static
.
Caused by:
process didn't exit successfully: rustc --crate-name lazy_static /Users/lgy/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/lazy_static-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no -C metadata=dbe72fc09fa72228 -C extra-filename=-dbe72fc09fa72228 --out-dir /Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/lgy/Documents/xmlassint/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Users/lgy/Documents/xmlassint/target/release/deps --cap-lints allow
(exit code: 1)
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for std
|
= note: the x86_64-unknown-linux-musl
target may not be installed
error[E0463]: can't find crate for std
|
= note: the x86_64-unknown-linux-musl
target may not be installed
error: aborting due to previous error
For more information about this error, try rustc --explain E0463
.
error: aborting due to previous error
For more information about this error, try rustc --explain E0463
.
error: build failed
评论区
写评论建议使用 cross做交叉编译
cargo install cross
cross build --target x86_64-unknown-linux-musl
the x86_64-unknown-linux-musl target may not be installed
直接docker编译省时省力。