llvm-hs / llvm-hs

Haskell bindings for LLVM
511 stars 120 forks source link

llvm/Config/llvm-config.h: No such file or directory #417

Open RyanBrewer317 opened 1 year ago

RyanBrewer317 commented 1 year ago

Hi. I'm getting the following error when I run cabal build with LLVM 9.0.1:

...
Failed to build llvm-hs-9.0.1.
Build log (
/home/ryan/.cabal/logs/ghc-8.8.4/llvm-hs-9.0.1-387a262b1a2fee6442de5ddd81ca87b0cdbe77b6016fcb2faa55497e839a23bf.log
):
[1 of 1] Compiling Main             ( /home/ryan/Downloads/llvm-project/build/saber/dist-newstyle/tmp/src-78869/llvm-hs-9.0.1/dist/setup/setup.hs, /home/ryan/Downloads/llvm-project/build/saber/dist-newstyle/tmp/src-78869/llvm-hs-9.0.1/dist/setup/Main.o )
Linking /home/ryan/Downloads/llvm-project/build/saber/dist-newstyle/tmp/src-78869/llvm-hs-9.0.1/dist/setup/setup ...
Configuring llvm-hs-9.0.1...
Preprocessing library for llvm-hs-9.0.1..
compiling dist/build/LLVM/Internal/FFI/InstructionDefs_hsc_make.c failed (exit code 1)
rsp file was: "dist/build/LLVM/Internal/FFI/hsc2hscall79018-0.rsp"
command was: /usr/bin/x86_64-linux-gnu-gcc -c dist/build/LLVM/Internal/FFI/InstructionDefs_hsc_make.c -o dist/build/LLVM/Internal/FFI/InstructionDefs_hsc_make.o -fuse-ld=gold -D__GLASGOW_HASKELL__=808 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Isrc -I/home/ryan/Downloads/llvm-project/llvm/include -Idist/build/src -I/home/ryan/Downloads/llvm-project/llvm/include -Wno-variadic-macros -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Idist/build/autogen -Idist/build/global-autogen -include dist/build/autogen/cabal_macros.h -I/home/ryan/.cabal/store/ghc-8.8.4/primitive-0.7.4.0-311f49621cc4331b03338c8d2dbdb828b918644a6a973cf14bc58930db9dbcdc/lib//include -I/usr/lib/ghc/bytestring-0.10.10.1/include -I/usr/lib/ghc/base-4.13.0.0/include -I/usr/lib/ghc/integer-gmp-1.0.2.0/include -I/usr/lib/ghc/include -I/usr/lib/ghc/include/
error: InstructionDefs.hsc:21:10: fatal error: llvm/Config/llvm-config.h: No such file or directory
compilation terminated.
...

The weird thing is that llvm/Config/llvm-config.hs does exist. To be more precise, my folder structure is the following:

llvm-project
 - build
 -- include
 --- llvm
 ---- Config
 ----- llvm-config.h
 ----- ...
 ---- ...
 -- ...
 -- myProject

and then I'm calling cabal build within myProject. I'm on Ubuntu 22.04.2 LTS, Dell XPS 13 7390. I feel obligated to note that this comes after much struggling to get llvm9.0.1 and getting cabal to use it. I'm sure that llvm-hs has accepted 9.0.1 because this comes after many "this is the wrong llvm version" error messages.