Rustup:从Linux到Windows i686的错误交叉编译

时间:2017-02-26 06:15:33

标签: linux windows rust rust-cargo

安装了哪些组件

i686-pc-windows-gnu (installed)
i686-unknown-linux-gnu (installed)
x86_64-pc-windows-gnu (installed)
x86_64-unknown-linux-gnu (default)

Rust版

rustc 1.17.0-nightly (08230775a 2017-02-24)
binary: rustc
commit-hash: 08230775a026c955873ba557e624b7f665661f37
commit-date: 2017-02-24
host: x86_64-unknown-linux-gnu
release: 1.17.0-nightly
LLVM version: 3.9

〜/ .cargo /配置

[target.x86_64-pc-windows-gnu]
linker = "/usr/bin/x86_64-w64-mingw32-gcc"

[target.i686-pc-windows-gnu]
linker = "/usr/bin/i686-w64-mingw32-gcc"

对于x86_64-pc-windows-gnu编译是可以的

$ cargo rustc --target=x86_64-pc-windows-gnu --release -- -C link-args=-mwindows
   Compiling ttt v0.1.0 (file:///tmp/ttt)
    Finished release [optimized] target(s) in 1.21 secs

但是对于i686-pc-windows-gnu错误(输出太长)https://gist.github.com/bc4254bdd78195e83842682d3a432688

Mingw版

Using built-in specs. COLLECT_GCC=i686-w64-mingw32-g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/6.3.1/lto-wrapper Target: i686-w64-mingw32 Configured with: /build/mingw-w64-gcc/src/gcc/configure --prefix=/usr --libexecdir=/usr/lib --target=i686-w64-mingw32 --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-threads=posix --enable-fully-dynamic-string --enable-libstdcxx-time=yes --with-system-zlib --enable-cloog-backend=isl --enable-lto --disable-dw2-exceptions --enable-libgomp --disable-multilib --enable-checking=release Thread model: posix gcc version 6.3.1 20170109 (GCC)

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,我用Arnaz87中的this insight解决了问题。

将此防锈标志添加到〜/ .cargo / config

[target.i686-pc-windows-gnu]
rustflags = "-C panic=abort"