MLIR in-source build failure due to example test

At some point, the test.toy of standalone dialect in the example fails.

Failed Tests (1):
  MLIR :: Examples/standalone/test.toy

Testing Time: 3.99s
  Unsupported:  312
  Passed     : 1718
  Failed     :    1
FAILED: tools/mlir/test/CMakeFiles/check-mlir /Users/kaisasaki/dev/llvm-project/build/tools/mlir/test/CMakeFiles/check-mlir
cd /Users/kaisasaki/dev/llvm-project/build/tools/mlir/test && /opt/homebrew/Frameworks/Python.framework/Versions/3.11/bin/python3.11 /Users/kaisasaki/dev/llvm-project/build/./bin/llvm-lit -sv /Users/kaisasaki/dev/llvm-project/build/tools/mlir/test
ninja: build stopped: subcommand failed.

When we try to build MLIR with an in-source manner, as shown in the getting started guide, it conflicts with the build cache we are now in.

/opt/homebrew/Cellar/cmake/3.26.3/bin/cmake /Users/kaisasaki/dev/llvm-project/mlir/examples/standalone -G "Ninja"  -DCMAKE_CXX_COMPILER=/Library/Developer/CommandLineTools/usr/bin/c++  -DCMAKE_C_COMPILER=/Library/Developer/CommandLineTools/usr/bin/cc   -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/Users/kaisasaki/dev/llvm-project/build/lib/cmake/mlir  -DLLVM_USE_LINKER=  -DPython3_EXECUTABLE="/opt/homebrew/opt/python@3.11/bin/python3.11"
CMake Error: The source "/Users/kaisasaki/dev/llvm-project/mlir/examples/standalone/CMakeLists.txt" does not match the source "/Users/kaisasaki/dev/llvm-project/llvm/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Does the latest test not pass with the in-source build?


  • OS: macOS Ventura 13.3.1
  • Arch: M1 Max
  • Compiler: Apple clang version 14.0.3 (clang-1403.

It is a problem with Mac only, there is a patch up for review to fix it: ⚙ D148058 Patch StandalonePlugin CMake for MacOS

1 Like

Thanks for letting me know!