ttys3 / utterances-cmt

this repo holds comments for utterances
0 stars 0 forks source link

post/rust/rust-cross-compile-for-windows-target-under-linux/ #1

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Rust Cross Compile for Windows target under Linux :: /dev/ttyS3 — 回首向来萧瑟处 也无荒野也无灯

Environment OS: Fedora 33 (Workstation Edition) x86_64 CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz x86_64 rustc: 1.49.0 (e1884a8e3 2020-12-2) cargo: 1.49.0 (d00d64df9 2020-12-05) Requirements # Install build dependencies sudo dnf install -y mingw64-gcc sudo dnf install -y mingw64-winpthreads-static # Add Windows Rust target rustup target add x86_64-pc-windows-gnu rustup toolchain install stable-x86_64-pc-windows-gnu Building cargo new hello cd hello cargo build --target x86_64-pc-windows-gnu 交叉编译默认的he

https://ttys3.dev/post/rust/rust-cross-compile-for-windows-target-under-linux/

ttys3 commented 3 years ago

不涉及额外的C库还好,如果有需要链接 *-sys 这种crate,然后这个crate的build.rs又没有提供类似 LIBXXX_SYS_STATIC=1 的选项,就比较蛋疼