Muhammad Rafay
Muhammad Rafay

Reputation: 31

Converting *.hs to llvm ir (*.ll) ---- Error: ghc: could not execute: opt --- on macOS Sierra

ghc -fllvm -keep-llvm-files -fforce-recomp hello.hs

[1 of 1] Compiling Main ( hello.hs, hello.o )

: Warning: Couldn't figure out LLVM version! Make sure you have installed LLVM ghc: could not execute: opt

Although the .ll file is generated in the current directory but I still don't get the error.

Upvotes: 1

Views: 738

Answers (1)

Muhammad Rafay
Muhammad Rafay

Reputation: 31

Need to set PATH, CPLUS_INCLUDE_PATH and LD_LIBRARY_PATH

# export PATH=/usr/local/opt/llvm/bin:$PATH
# export CPLUS_INCLUDE_PATH=$(llvm-config --includedir):$CPLUS_INCLUDE_PATH
# export LD_LIBRARY_PATH=$(llvm-config --libdir):$LD_LIBRARY_PATH 

Upvotes: 2

Related Questions