[Mlir-commits] [mlir] [MLIR] Fix nanobind linker args on macOS (PR #125733)

Nikhil Kalra llvmlistbot at llvm.org
Tue Feb 4 15:52:12 PST 2025


nikalra wrote:

> But `NanobindAdaptors.h` is a header and so this flag does need to be set on all users of the header not just those building/using the library. Possibly actually this should be an `extern` in the header itself?
> 
> Just curious what issue do you have with the current solution?

Would it be better if I made it a `PUBLIC` link property so that downstream link dependencies also inherited the symbol? They could include the header in isolation, but presumably they'd be linking against the core MLIR Python bindings.

I gave `extern` a shot, but that doesn't work because the symbol is still missing at link time (and we can't link against a Python dylib for the linker to recognize the symbol exists).

I'm not sure what exactly is different between our build setup and the upstream one, but CMAKE_MODULE_LINKER_FLAGS were not getting propagated to the target so we'd fail to link when creating the Python .so. Our Python library is declared with `declare_mlir_python_extension` and executes through the exact flow where the property was getting applied.

https://github.com/llvm/llvm-project/pull/125733


More information about the Mlir-commits mailing list