[Mlir-commits] [mlir] [mlir][python] declare `_PyClassMethod_New` undefined at link time (PR #121597)
Marius Brehler
llvmlistbot at llvm.org
Fri Jan 3 13:06:18 PST 2025
================
@@ -686,6 +686,12 @@ function(add_mlir_python_extension libname extname)
endif()
target_compile_options(${libname} PRIVATE ${eh_rtti_enable})
+ if(APPLE)
+ # NanobindAdaptors.h uses PyClassMethod_New to build `pure_subclass`es but nanobind
+ # doesn't declare this API as undefined in its linker flags. So we need to declare it as such
+ # for downstream users that do not do something like -undefined dynamic_lookup
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-U -Wl,_PyClassMethod_New")
+ endif()
----------------
marbre wrote:
Should this be moved into the `elseif(ARG_PYTHON_BINDINGS_LIBRARY STREQUAL "nanobind")` block above?
https://github.com/llvm/llvm-project/pull/121597
More information about the Mlir-commits
mailing list