File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -155,11 +155,18 @@ impl Step for Llvm {
155155 . define ( "WITH_POLLY" , "OFF" )
156156 . define ( "LLVM_ENABLE_TERMINFO" , "OFF" )
157157 . define ( "LLVM_ENABLE_LIBEDIT" , "OFF" )
158- . define ( "LLVM_OCAML_INSTALL_PATH" , "usr/lib/ocaml" )
159158 . define ( "LLVM_PARALLEL_COMPILE_JOBS" , build. jobs ( ) . to_string ( ) )
160159 . define ( "LLVM_TARGET_ARCH" , target. split ( '-' ) . next ( ) . unwrap ( ) )
161160 . define ( "LLVM_DEFAULT_TARGET_TRIPLE" , target) ;
162161
162+ // By default, LLVM will automatically find OCaml and, if it finds it,
163+ // install the LLVM bindings in LLVM_OCAML_INSTALL_PATH, which defaults
164+ // to /usr/bin/ocaml.
165+ // This causes problem for non-root builds of Rust. Side-step the issue
166+ // by setting LLVM_OCAML_INSTALL_PATH to a relative path, so it installs
167+ // in the prefix.
168+ cfg. define ( "LLVM_OCAML_INSTALL_PATH" ,
169+ env:: var_os ( "LLVM_OCAML_INSTALL_PATH" ) . unwrap_or_else ( || "usr/lib/ocaml" . into ( ) ) ) ;
163170
164171 // This setting makes the LLVM tools link to the dynamic LLVM library,
165172 // which saves both memory during parallel links and overall disk space
You can’t perform that action at this time.
0 commit comments