about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorroblabla <unfiltered@roblab.la>2018-02-10 21:29:10 +0100
committerroblabla <unfiltered@roblab.la>2018-02-10 21:29:10 +0100
commit3c01dea03e1b4ffbcb665a68bcf228c02497ecdc (patch)
tree9dea27c5d54fab39913e73165362106b5ecd48e3 /src
parentc04d86deeb6d23d8ee4b31abda92bb84c1d17897 (diff)
downloadrust-3c01dea03e1b4ffbcb665a68bcf228c02497ecdc.tar.gz
rust-3c01dea03e1b4ffbcb665a68bcf228c02497ecdc.zip
Add comment about the problem, and use provided path if available
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/native.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index bb482813a23..108b0159dce 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -155,11 +155,18 @@ impl Step for Llvm {
            .define("WITH_POLLY", "OFF")
            .define("LLVM_ENABLE_TERMINFO", "OFF")
            .define("LLVM_ENABLE_LIBEDIT", "OFF")
-           .define("LLVM_OCAML_INSTALL_PATH", "usr/lib/ocaml")
            .define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
            .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
            .define("LLVM_DEFAULT_TARGET_TRIPLE", target);
 
+        // By default, LLVM will automatically find OCaml and, if it finds it,
+        // install the LLVM bindings in LLVM_OCAML_INSTALL_PATH, which defaults
+        // to /usr/bin/ocaml.
+        // This causes problem for non-root builds of Rust. Side-step the issue
+        // by setting LLVM_OCAML_INSTALL_PATH to a relative path, so it installs
+        // in the prefix.
+        cfg.define("LLVM_OCAML_INSTALL_PATH",
+            env::var_os("LLVM_OCAML_INSTALL_PATH").unwrap_or_else(|| "usr/lib/ocaml".into()));
 
         // This setting makes the LLVM tools link to the dynamic LLVM library,
         // which saves both memory during parallel links and overall disk space