]> git.lizzy.rs Git - rust.git/commitdiff
Add comment about the problem, and use provided path if available
authorroblabla <unfiltered@roblab.la>
Sat, 10 Feb 2018 20:29:10 +0000 (21:29 +0100)
committerroblabla <unfiltered@roblab.la>
Sat, 10 Feb 2018 20:29:10 +0000 (21:29 +0100)
src/bootstrap/native.rs

index bb482813a23fe5791ad71e40c05e353d372799bc..108b0159dce745f28580d5c907b68a26c0bf6b1b 100644 (file)
@@ -155,11 +155,18 @@ fn run(self, builder: &Builder) -> PathBuf {
            .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