![]() ![]() “cross testing”, cross can test crates for architectures other than i686 and x86_64.cross provides an environment, cross toolchain and cross compiled libraries, that produces the most portable binaries. ![]() cross will provide all the ingredients needed for cross compilation without touching your system installation.All the required tools are in virtualized environment so you don't need to install additional packages for your machine. There is Docker based solution called cross. To open cmd.exe in current directory in file explorer, right click with shift on empty place in window and choose Open command window here.īacktraces with mingw should work now - if not use msvc If you want to see the console output when running exe files, you may run them from cmd.exe. Then copy directory target/x86_64-pc-windows-gnu/debug/examples/ to your Windows machine and run exe files. rs) doneĬargo build will put binaries in target/x86_64-pc-windows-gnu/debug/examples/Ĭopy needed files: cp /tmp/SDL2-2.0.4/x86_64-w64-mingw32/bin/SDL2.dll target/x86_64-pc-windows-gnu/debug/examples/Ĭp assets/sine.wav target/x86_64-pc-windows-gnu/debug/examples/ Or stop after first fail: echo for i in examples/* do & cargo build -target=x86_64-pc-windows-gnu -verbose -example $(basename $i. īuild examples at once cargo build -target=x86_64-pc-windows-gnu -verbose -examples Let's cross-compile examples from rust-sdl2 project from Ubuntu to Windows x86_64 There is option to static-compile sdl but it didn't work for me.Īlso mixer is not included when used with bundled. This fails for me with: Running `rustc -crate-name animation examples/animation.rs -color always -crate-type bin -emit=dep-info,link -C debuginfo=2 -cfg 'feature="default"' -C metadata=006e668c6384c29b -C extra-filename=-006e668c6384c29b -out-dir /home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/examples -target x86_64-pc-windows-gnu -C ar=x86_64-w64-mingw32-gcc-ar -C linker=x86_64-w64-mingw32-gcc -C incremental=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/incremental -L dependency=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps -L dependency=/home/roman/projects/rust-sdl2/target/debug/deps -extern bitflags=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/libbitflags-2c7b3e3d10e1e0dd.rlib -extern lazy_static=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/liblazy_static-a80335916d5ac241.rlib -extern libc=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/liblibc-387157ce7a56c1ec.rlib -extern num=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/libnum-18ac2d75a7462b42.rlib -extern rand=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/librand-7cf254de4aeeab70.rlib -extern sdl2=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/libsdl2-3f37ebe30a087396.rlib -extern sdl2_sys=/home/roman/projects/rust-sdl2/target/x86_64-pc-windows-gnu/debug/deps/libsdl2_sys-3edefe52781ad7ef.rlib -L native=/home/roman/.cargo/registry/src/-1ecc6299db9ec823/winapi-x86_64-pc-windows-gnu-0.4.0/lib`Įrror: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1 $ cargo test -target "$ARCH-pc-windows-gnu" $ cargo build -release -target "$ARCH-pc-windows-gnu" Then you can use Cargo like this: $ # Build Check the list of files for the mingw-w64 package(s) (GCC and binutils) in your distribution. ![]() Note: the exact paths can vary based on your distribution. If you're using Cargo, you can tell Cargo where to look for ar and the linker by adding this to ~/.cargo/config (where $ARCH is the architecture you use): ![]() However, according to Arch Linux's wiki page on Rust, you could copy the compiled libraries from the Windows packages in the download directory (note that there are i686 and x86-64 packages) in the appropriate place on your system (in /usr/lib/rustlib or /usr/local/lib/rustlib, depending on where Rust is installed), install mingw-w64-gcc and Wine and you should be able to cross-compile. The Rust distribution only provides compiled libraries for the host system. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |