[Mlir-commits] [mlir] [Build] Adding find_package for pybind (PR #153579)

Zhuoran Yin llvmlistbot at llvm.org
Thu Aug 14 07:02:17 PDT 2025


https://github.com/jerryyin created https://github.com/llvm/llvm-project/pull/153579

LLVM build occasionally fail on not being able to find the pybind package. Adding this help LLVM find it and fix the build failure for me.

>From 2c4bde6e4ef310c87907983d468445ea1bd055f5 Mon Sep 17 00:00:00 2001
From: jerryyin <zhuoryin at amd.com>
Date: Thu, 14 Aug 2025 14:00:22 +0000
Subject: [PATCH] Adding find_package for pybind

---
 mlir/cmake/modules/AddMLIRPython.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index c14e614ed7d92..4354af8792f33 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -661,6 +661,7 @@ function(add_mlir_python_extension libname extname)
   # sources that must be compiled in accordance with pybind11 needs (RTTI and
   # exceptions).
   if(NOT DEFINED ARG_PYTHON_BINDINGS_LIBRARY OR ARG_PYTHON_BINDINGS_LIBRARY STREQUAL "pybind11")
+    find_package(pybind11 REQUIRED)
     pybind11_add_module(${libname}
       ${ARG_SOURCES}
     )



More information about the Mlir-commits mailing list