LLVM Discussion Forums

Problem Building flang (Unknown CMake command "mlir_tablegen")

Dear all,
I am trying to built flang but I get the cmake error:
Unknown CMake command “mlir_tablegen”.
I followed the 5 steps of the docs:

  1. git clone https://github.com/llvm/llvm-project.git
  2. cd llvm-project
  3. mkdir build
  4. cd build
  5. cmake -G “Unix Makefiles” -DLLVM_ENABLE_PROJECTS=flang -DCMAKE_INSTALL_PREFIX=/usr/local/opt …/llvm

I had no problem building clang. Am I doing something wrong?
Thanks for your help.

I believe you’ll need to include ‘mlir’ in your list of LLVM_ENABLE_PROJECTS: -DLLVM_ENABLE_PROJECTS="mlir;flang". Unfortunately CMake’s caching is very stubborn, so you may need to completely remove your build directory and re-run the CMake command for the changes to take hold. Hope this helps!

Thanks for your help modocache, your answer solves my problem.
Best regards

1 Like