Unverified Commit 4d5e3d2b authored by Georg Koppen's avatar Georg Koppen Committed by boklm
Browse files

Bug 25894: Get a Rust cross-compiler for Windows

parent 9af1ea49
......@@ -10,9 +10,7 @@ cd /var/tmp/dist/rust-[% c('var/prev_version') %]-[% c('arch') %]-unknown-linux-
./install.sh --prefix=$distdir-rust-old
export PATH="$distdir-rust-old/bin:$PATH"
[% IF ! c("var/windows") %]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
[% END -%]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
[% IF c("var/osx") %]
# We need to clear `CC` and `LDFLAGS` as they are used for the host platform
......@@ -61,6 +59,16 @@ cd /var/tmp/build/rustc-[% c('version') %]-src
patch -p1 < $rootdir/binaryen.patch
[% END %]
[% IF c("var/windows-i686") %]
# Cross-compiling for Windows 32bit is currently not possible without any
# patches. The reason for that is libstd expecting DWARF unwinding while most
# toolchains on Linux, targeting Windows 32bit, use SjLj unwinding.
# See: https://github.com/rust-lang/rust/issues/12859 for discussion about
# that and https://github.com/rust-lang/rust/pull/49633 for a newer attempt to
# fix this problem.
patch -p1 < $rootdir/panic-abort.patch
[% END %]
mkdir build
cd build
../configure --prefix=$distdir [% c("var/configure_opt") %]
......
......@@ -48,6 +48,13 @@ targets:
- pkg-config
configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-apple-darwin --set=target.x86_64-apple-darwin.cc=x86_64-apple-darwin-clang
windows:
var:
arch_deps:
- libssl-dev
- pkg-config
configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% c("arch") %]-pc-windows-gnu
input_files:
- project: container-image
- project: cmake
......@@ -66,3 +73,5 @@ input_files:
gpg_keyring: rust.gpg
- filename: binaryen.patch
enable: '[% c("var/linux") %]'
- filename: panic-abort.patch
enable: '[% c("var/windows-i686") %]'
From 2fe471643721f3967f1bdf28907b0a7247fdb705 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Thu, 26 Apr 2018 13:18:27 +0000
Subject: [PATCH] Avoid cross-compilation breakage due to unwinding
incompatibilities
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 55d104b182..85330f973b 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -143,7 +143,8 @@ fn main() {
// workaround undefined references to `rust_eh_unwind_resume` generated
// otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
if crate_name == "panic_abort" ||
- crate_name == "compiler_builtins" && stage != "0" {
+ crate_name == "compiler_builtins" && stage != "0" ||
+ target == "i686-pc-windows-gnu" {
cmd.arg("-C").arg("panic=abort");
}
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 9ea5f39b71..bb689120af 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -45,7 +45,6 @@ extern crate getopts;
extern crate term;
#[cfg(any(unix, target_os = "cloudabi"))]
extern crate libc;
-extern crate panic_unwind;
pub use self::TestFn::*;
pub use self::ColorConfig::*;
--
2.17.0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment