编译报错
dark5net opened this issue · comments
Team dark5 commented
Downloaded 242 crates (20.8 MB) in 2.01s (largest was `openssl-src` at 5.1 MB)
Compiling libc v0.2.126
Compiling proc-macro2 v1.0.40
Compiling quote v1.0.20
Compiling unicode-ident v1.0.1
Compiling syn v1.0.98
Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
error[E0463]: can't find crate for `compiler_builtins`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
root@vultr:~/ObserverWard# cargo build --target i686-pc-windows-msvc.zip --release --all-features
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target i686-pc-windows-msvc.zip --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "i686-pc-windows-msvc.zip". Run `rustc --print target-list` for a list of built-in targets
三米前有蕉皮 commented
我没猜错你应该在linux系统下编译window的版本,这只能用gnu的交叉编译
在linux下编译window的:
cargo build --target i686-pc-windows-gnu --release --all-features
在linux编译类linux的
cargo build --target x86_64-unknown-linux-musl --release --all-features
openssl安装看这里
Team dark5 commented
我没猜错你应该在linux系统下编译window的版本,这只能用gnu的交叉编译 在linux下编译window的:
cargo build --target i686-pc-windows-gnu --release --all-features在linux编译类linux的
cargo build --target x86_64-unknown-linux-musl --release --all-featuresopenssl安装看这里
我直接在Linux下 cargo build --release就可以了,当然这不是编译windows的,不过我用你的命令编译Linux或者windows的都不行。
cargo build --target i686-pc-windows-gnu --release --all-features
Downloaded windows_i686_gnu v0.36.1
Downloaded winapi-i686-pc-windows-gnu v0.4.0
Downloaded 2 crates (3.7 MB) in 0.95s (largest was `winapi-i686-pc-windows-gnu` at 2.9 MB)
Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
|
= note: the `i686-pc-windows-gnu` target may not be installed
= help: consider downloading the target with `rustup target add i686-pc-windows-gnu`
error[E0463]: can't find crate for `compiler_builtins`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
三米前有蕉皮 commented
报错里有提示,执行下面命令后就可以了
rustup target add i686-pc-windows-gnu
三米前有蕉皮 commented
没啥问题我就先关闭了