Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译报错 #94

Closed
dark5net opened this issue Nov 13, 2022 · 4 comments
Closed

编译报错 #94

dark5net opened this issue Nov 13, 2022 · 4 comments

Comments

@dark5net
Copy link

  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

@cn-kali-team
Copy link
Collaborator

我没猜错你应该在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安装看这里

https://docs.rs/openssl/0.10.42/openssl/#automatic

@dark5net
Copy link
Author

我没猜错你应该在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安装看这里

https://docs.rs/openssl/0.10.42/openssl/#automatic

我直接在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

@cn-kali-team
Copy link
Collaborator

报错里有提示,执行下面命令后就可以了

rustup target add i686-pc-windows-gnu

@cn-kali-team
Copy link
Collaborator

没啥问题我就先关闭了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants