简体   繁体   中英

LLVM runs into a linker error after upgrade

I have a Haskell stack project where I have been using the llvm-hs library for building a compiler which emits LLVM IR. I had been working with LLVM version 8.0.0 so far. Recently due to a Python upgrade in my system the LLVM version got bumped to 8.0.1.

When I attempt to do stack build I get the following error -

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)

It seems from the above that ld is looking for -L/usr/local/Cellar/llvm-8/8.0.0/lib/llvm-8/lib whereas on my system I currently have the version for 8.0.1. How do I point ld to the correct path?

I am running MacOS Mojave. stack version 2.3.1. Thanks

I was capable of solving this by adding the following to my .bash_profile

export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/llvm-8/8.0.1/lib/llvm-8/lib"

Hope this helps if someone ran into the same problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM