我有一个Haskell stack
项目,在那里我一直在使用llvm-hs
库来构建发出LLVM IR的编译器。到目前为止,我一直在使用LLVM 8.0.0版。最近,由于我系统中的Python升级,LLVM版本升至8.0.1。
当我尝试做stack build
时,出现以下错误-
ld: warning: directory not found for option '-L/usr/local/Cellar/llvm-8/8.0.0/lib/llvm-8/lib'
ld: library not found for -lLLVM-8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
从上面看来,ld正在寻找-L/usr/local/Cellar/llvm-8/8.0.0/lib/llvm-8/lib
,而在我的系统上,我目前的版本是8.0.1。如何将ld
指向正确的路径?
我正在运行MacOS Mojave。堆栈版本2.3.1。谢谢
答案 0 :(得分:2)
我能够通过将以下内容添加到我的.bash_profile
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/llvm-8/8.0.1/lib/llvm-8/lib"
希望如果有人遇到相同的问题,这会有所帮助。