Created
October 17, 2024 12:53
-
-
Save wangjiezhe/b2fa6fcc81733995ef50a4a6c49a31c4 to your computer and use it in GitHub Desktop.
Crossbuild Rust application for Windows on Gentoo Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crossdev -t x86_64-w64-mingw32 | |
# https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows | |
crossdev --genv 'EXTRA_ECONF="--enable-threads=posix"' --init-target --target cross-x86_64-w64-mingw32 | |
echo "cross-x86_64-w64-mingw32/mingw64-runtime libraries idl tools" >> /etc/portage/package.use/cross-x86_64-w64-mingw32 | |
emerge -1 cross-x86_64-w64-mingw32/mingw64-runtime | |
emerge -1 cross-x86_64-w64-mingw32/gcc | |
# https://bugs.gentoo.org/679878 | |
ln -s /var/db/repos/gentoo/sys-devel/rust-std /var/db/repos/crossdev/cross-x86_64-w64-mingw32/ | |
echo 'cross-x86_64-w64-mingw32/rust-std **' >> /etc/portage/package.accept_keywords/rust | |
echo 'export RUSTFLAGS="-C target-cpu=native -C opt-level=3"' >> /etc/portage/env/cross-x86_64-w64-mingw32/rust-std | |
echo 'export ERUST_STD_RTARGET="x86_64-pc-windows-gnu"' >> /etc/portage/env/cross-x86_64-w64-mingw32/rust-std | |
emerge -av cross-x86_64-w64-mingw32/rust-std | |
cd ~/Github | |
git clone https://github.com/unlimitedbacon/stl-thumb.git | |
cargo build --release --target x86_64-pc-windows-gnu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment