about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-03-11 16:03:28 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-03-14 14:56:48 -0700
commit6ccf03c843fc252a58055e71b2057aaa42cdb464 (patch)
tree7461d44b3ff1e9853cebc2a9a6d9dc2d34600959
parent01118928fc2b280e96189ed394af749d65cbcffe (diff)
downloadrust-6ccf03c843fc252a58055e71b2057aaa42cdb464.tar.gz
rust-6ccf03c843fc252a58055e71b2057aaa42cdb464.zip
rustbuild: Fix 32-bit Windows build
Unfortunately on i686-pc-windows-gnu LLVM's answer to `--host-target` is
`x86_64-pc-windows-gnu` even though we're building in a 32-bit shell as well as
compiling 32-bit libraries. For now use Cargo's `HOST` environment variable to
determine whether we're doing a cross compilation or not.
-rw-r--r--src/librustc_llvm/build.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 59164161b3d..dcfb518ba79 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -47,14 +47,20 @@ fn main() {
     // the host platform. This only really works if the host LLVM and target
     // LLVM are compiled the same way, but for us that's typically the case.
     //
-    // We detect this cross compiling situation by asking llvm-config what it's
-    // host-target is. If that's not the TARGET, then we're cross compiling.
-    // This generally just means that we can't trust all the output of
-    // llvm-config becaues it might be targeted for the host rather than the
-    // target.
+    // We *want* detect this cross compiling situation by asking llvm-config
+    // what it's host-target is. If that's not the TARGET, then we're cross
+    // compiling. Unfortunately `llvm-config` seems either be buggy, or we're
+    // misconfiguring it, because the `i686-pc-windows-gnu` build of LLVM will
+    // report itself with a `--host-target` of `x86_64-pc-windows-gnu`. This
+    // tricks us into thinking we're doing a cross build when we aren't, so
+    // havoc ensues.
+    //
+    // In any case, if we're cross compiling, this generally just means that we
+    // can't trust all the output of llvm-config becaues it might be targeted
+    // for the host rather than the target. As a result a bunch of blocks below
+    // are gated on `if !is_crossed`
     let target = env::var("TARGET").unwrap();
-    let host = output(Command::new(&llvm_config).arg("--host-target"));
-    let host = host.trim();
+    let host = env::var("HOST").unwrap();
     let is_crossed = target != host;
 
     let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc",