google / mlir-hs

Haskell bindings for MLIR
Apache License 2.0
92 stars 16 forks source link

`stack build` issue -- possible local path specificity in `Setup.hs` #21

Closed femtomc closed 3 years ago

femtomc commented 3 years ago

Expected Behavior

Having built LLVM + MLIR from source and added ..build/bin to my path, with access to llvm-config -- I should be able to run stack build and successfully build the project.

Actual Behavior

❯ stack build                                     Dev/mlir-hs main
mlir-hs> configure (lib)
tblgen/hs-generators.cc:36:10: fatal error: mlir/TableGen/Argument.h: No such file or directory
   36 | #include "mlir/TableGen/Argument.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

--  While building package mlir-hs-0.1.0.0 (scroll up to its section to see the error) using:
      /home/mccoy/Dev/mlir-hs/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/mccoy/.stack/snapshots/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/pkgdb --package-db=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/pkgdb --libdir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/lib --bindir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/bin --datadir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/share --libexecdir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/libexec --sysconfdir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/etc --docdir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/doc/mlir-hs-0.1.0.0 --htmldir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/doc/mlir-hs-0.1.0.0 --haddockdir=/home/mccoy/Dev/mlir-hs/.stack-work/install/x86_64-linux-tinfo6/425db5574a825305e370501fc2b13af8630b37876fd22c900ad31438145b6b0c/8.10.4/doc/mlir-hs-0.1.0.0 --dependency=Cabal=Cabal-3.2.1.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.14.1.0 --dependency=bytestring=bytestring-0.10.12.0 --dependency=containers=containers-0.6.2.1 --dependency=directory=directory-1.3.6.0 --dependency=filepath=filepath-1.4.2.1 --dependency=inline-c=inline-c-0.9.1.4-2xfcSMu20nLGOzvS94xHVu --dependency=lens=lens-4.19.2-7Q00MKR54DVFFru2tZkQiv --dependency=mtl=mtl-2.2.2 --dependency=raw-strings-qq=raw-strings-qq-1.1-CnHDj5KA9CM15ZkVQP2bmF --dependency=transformers=transformers-0.5.6.2 --exact-configuration --ghc-option=-fhide-source-paths
    Process exited with code: ExitFailure 1

Steps to Reproduce the Problem

  1. Build LLVM + MLIR on HEAD -- using
git clone https://github.com/llvm/llvm-project
cd llvm-project
mkdir build
cmake -G Ninja ../llvm \
   -DLLVM_ENABLE_PROJECTS=mlir \
   -DLLVM_BUILD_EXAMPLES=ON \
   -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_ENABLE_ASSERTIONS=ON \
   -DCMAKE_C_COMPILER=clang \
   -DCMAKE_CXX_COMPILER=clang++ \
   -DLLVM_ENABLE_LLD=ON
cmake --build .
export PATH="$(pwd)/bin:$PATH"
  1. stack build

Specifications

mccoy in pop-os in toy-hs on  main via △ v3.18.4
❯ neofetch                                         Dev/toy-hs main
             /////////////                mccoy@pop-os
         /////////////////////            ------------
      ///////*767////////////////         OS: Pop!_OS 21.04 x86_64
    //////7676767676*//////////////       Kernel: 5.11.0-7620-gene
   /////76767//7676767//////////////      Uptime: 28 mins
  /////767676///*76767///////////////     Packages: 2349 (dpkg)
 ///////767676///76767.///7676*///////    Shell: zsh 5.8
/////////767676//76767///767676////////   Resolution: 1920x1080
//////////76767676767////76767/////////   Terminal: /dev/pts/4
///////////76767676//////7676//////////   CPU: AMD Ryzen 9 3900XT
////////////,7676,///////767///////////   GPU: NVIDIA GeForce RTX
/////////////*7676///////76////////////   Memory: 1465MiB / 32077M
///////////////7676////////////////////
 ///////////////7676///767////////////
  //////////////////////'////////////
   //////.7676767676767676767,//////
    /////767676767676767676767/////
      ///////////////////////////
         /////////////////////
             /////////////
femtomc commented 3 years ago

Edit: I fixed this by following the runner configuration in CI -- important to install and not just cmake --build . so that mlir includes gets copied to include.