summaryrefslogtreecommitdiff
path: root/xmake/rules/python
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-10 00:39:41 +0800
committerruki <[email protected]>2022-08-10 00:39:41 +0800
commitbb0ac095bacb21f69777eb9e1a31b23b0c8daaa0 (patch)
tree2c4226937e2124ddc0a106337c6348c65e6dc313 /xmake/rules/python
parent9fb7818d79fb4974495c1af64ded65a283b80f37 (diff)
fix python.library for macosx
Diffstat (limited to 'xmake/rules/python')
-rw-r--r--xmake/rules/python/xmake.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/rules/python/xmake.lua b/xmake/rules/python/xmake.lua
index d5649638b..01fe83c59 100644
--- a/xmake/rules/python/xmake.lua
+++ b/xmake/rules/python/xmake.lua
@@ -39,4 +39,22 @@ rule("python.library")
target:set("extension", ".pyd")
end
end
+ -- fix segmentation fault for macosx
+ -- @see https://github.com/xmake-io/xmake/issues/2177#issuecomment-1209398292
+ if target:is_plat("macosx") then
+ target:add("shflags", "-undefined dynamic_lookup", {force = true})
+ local pybind11 = target:pkg("pybind11")
+ if pybind11 then
+ local links = pybind11:get("links")
+ if links then
+ local links_without_python = {}
+ for _, link in ipairs(links) do
+ if not link:startswith("python") then
+ table.insert(links_without_python, link)
+ end
+ end
+ pybind11:set("links", links_without_python)
+ end
+ end
+ end
end)