Skip to content

MLIR installation doesn't pick up stubgen files #168393

@ftynse

Description

@ftynse

Repro:

 cmake ../llvm-project/llvm                                           \
    -GNinja                                                            \
    -DCMAKE_BUILD_TYPE=Release                                         \
    -DLLVM_ENABLE_PROJECTS="mlir;llvm"                                 \
    -DLLVM_ENABLE_ASSERTIONS=ON                                        \
    -DLLVM_INSTALL_UTILS=ON                                            \
    -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU"                               \
    -DLLVM_ENABLE_BINDINGS=OFF                                         \
    -DLLVM_ENABLE_ZSTD=OFF                                             \
    -DMLIR_INCLUDE_TESTS=OFF                                           \
    -DLLVM_USE_LINKER=lld                                              \
    -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-python-sources" \
    -DMLIR_ENABLE_BINDINGS_PYTHON=ON                                   \
    -DCMAKE_INSTALL_PREFIX=/tmp/llvm-mlir/_mlir_install
ninja install-distribution-stripped

will fail with

CMake Error at cmake_install.cmake:1198 (file):
  file INSTALL cannot find
  "/home/runner/_work/wave/wave/llvm-mlir/_build/tools/mlir/python/type_stubs/_mlir_libs/_mlir/__init__.pyi":
  No such file or directory.
Call Stack (most recent call first):
  /home/runner/_work/wave/wave/llvm-mlir/_build/tools/mlir/cmake_install.cmake:92 (include)
  /home/runner/_work/wave/wave/llvm-mlir/_build/tools/cmake_install.cmake:82 (include)
  /home/runner/_work/wave/wave/llvm-mlir/_build/cmake_install.cmake:132 (include)

Running ninja MLIRPythonModules.extension._mlir.dso._mlir.type_stubs (target name extracted by dumping variables from cmake), seems to fix this. Probably a missing dependency somewhere specific to installation, but I don't see it.

Initially found in https://github.com/iree-org/wave/actions/runs/19373722268/job/55435810302?pr=446

Metadata

Metadata

Assignees

Labels

cmakeBuild system in general and CMake in particularmlir:pythonMLIR Python bindings

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions