Releases: ookiineko-cygport/rust
Test build
Branch: mingw-host
Supported Targets: x86_64-pc-cygwin
(cross), x86_64-pc-windows-gnu
(host, only used for building rustc and running build-time build.rs
scripts)
It is also possible to make this toolchain link against msys-2.0.dll
instead of cygwin1.dll
, for how to do this please see this gist
Requires Windows (also support Linux hosts but you need to build from source), MSYS2 and mingw-w64-x86_64-cygwin-gcc
package from msys2-cygwin (unofficial)
Host Runtime Dependencies:
Build Dependencies:
- mingw-w64-x86_64-autotools
- mingw-w64-x86_64-cc
- mingw-w64-x86_64-cmake
- mingw-w64-x86_64-curl
- mingw-w64-x86_64-libffi
- mingw-w64-x86_64-libssh2
- mingw-w64-x86_64-ninja
- mingw-w64-x86_64-openssl
- mingw-w64-x86_64-python
- mingw-w64-x86_64-zlib
- mingw-w64-x86_64-cygwin-binutils
- mingw-w64-x86_64-cygwin-gcc
NOTE: when using, please add bin/
to PATH
Clone / Configure / Build Commands:
git clone https://github.com/ookiineko-cygport/rust -b mingw-host && cd rust
git submodule update --init --depth=1 --recursive
# IMPORTANT: msys git quirk
export GIT_DIR=/dev/null
MSYS2_ARG_CONV_EXCL="--prefix;--sysconfdir;--localstatedir" \
./configure --prefix=${MINGW_PREFIX}/lib/cygwin-rust \
--sysconfdir=${MINGW_PREFIX}/lib/cygwin-rust/etc \
--localstatedir=${MINGW_PREFIX}/lib/cygwin-rust/var/lib \
--build=x86_64-pc-windows-gnu \
--host=x86_64-pc-windows-gnu \
--target="x86_64-pc-cygwin,x86_64-pc-windows-gnu" \
--release-channel=nightly \
--enable-ninja --enable-extended --tools="rustfmt,cargo,src" \
--disable-llvm-static-stdcpp --disable-codegen-tests \
--disable-docs --disable-compiler-docs \
--set="llvm.targets=X86" --set="llvm.experimental-targets=" \
--set="target.x86_64-pc-cygwin.cc=x86_64-pc-cygwin-cc" \
--set="target.x86_64-pc-cygwin.cxx=x86_64-pc-cygwin-c++" \
--set="target.x86_64-pc-cygwin.ar=x86_64-pc-cygwin-ar" \
--set="target.x86_64-pc-cygwin.linker=x86_64-pc-cygwin-cc"
DESTDIR=result python x.py install -i --stage 2
you may want export PKG_CONFIG_x86_64_pc_cygwin=x86_64-pc-cygwin-pkg-config.bat CMAKE_TOOLCHAIN_FILE_x86_64_pc_cygwin=${MINGW_PREFIX}/share/cygwin/toolchain-x86_64-pc-cygwin.cmake
to allow rust to pick up cygwin packages provided by msys2-cygwin
make sure to unset certain variables which might break cross-compiling by default: unset PKG_CONFIG_PATH PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH
also put these in your ~/.cargo/config
to use some 3rd party crates (required if you want to build Rust STD or the toolchain)
[patch.crates-io]
libc_0_2_135 = { git = 'https://github.com/ookiineko-cygport/libc.git', package = 'libc', branch = '0.2.135' }
libc_0_2_148 = { git = 'https://github.com/ookiineko-cygport/libc.git', package = 'libc', branch = '0.2.148' }
libc_0_2_152 = { git = 'https://github.com/ookiineko-cygport/libc.git', package = 'libc', branch = '0.2.152' }
libc_0_2_153 = { git = 'https://github.com/ookiineko-cygport/libc.git', package = 'libc', branch = '0.2.153' }
cc_1_0_77 = { git = 'https://github.com/ookiineko-cygport/cc-rs.git', package = 'cc', branch = '1.0.77' }
cc_1_0_83 = { git = 'https://github.com/ookiineko-cygport/cc-rs.git', package = 'cc', branch = '1.0.83' }
compiler_builtins = { git = 'https://github.com/ookiineko-cygport/compiler-builtins.git' }
getrandom0_2_0 = { git = 'https://github.com/ookiineko-cygport/getrandom.git', package = 'getrandom', branch = '0.2.0' }
getrandom0_2_10 = { git = 'https://github.com/ookiineko-cygport/getrandom.git', package = 'getrandom', branch = '0.2.10' }
getrandom0_2_12 = { git = 'https://github.com/ookiineko-cygport/getrandom.git', package = 'getrandom', branch = '0.2.12' }
socket2 = { git = 'https://github.com/ookiineko-cygport/socket2.git' }
psm = { git = 'https://github.com/ookiineko-cygport/stacker.git' }
mio = { git = 'https://github.com/ookiineko-cygport/mio.git' }
tokio = { git = 'https://github.com/ookiineko-cygport/tokio.git' }
libloading_0_7_1 = { git = 'https://github.com/ookiineko-cygport/rust_libloading.git', package = 'libloading', branch = '0.7.1' }
libloading_0_7_3 = { git = 'https://github.com/ookiineko-cygport/rust_libloading.git', package = 'libloading', branch = '0.7.3' }
openssl-src = { git = 'https://github.com/ookiineko-cygport/openssl-src-rs.git' }
os_info = { git = 'https://github.com/ookiineko-cygport/os_info.git' }
cmake = { git = 'https://github.com/ookiineko-cygport/cmake-rs.git' }
ctest2 = { git = 'https://github.com/ookiineko-cygport/ctest2.git' }