Skip to content

Commit 3f901b9

Browse files
authored
Fix macOS Python build error (#399)
Mac seems to use dynamic linking more for making modules than Linux and Windows do. Thus the common python symbols were missing and it requires libpython3.13.dylib for these symbols. If this is a different in the mac "Framework" then cmake should probably include that for the Development.Module component. But this is a workaround in the meantime while we wait for any upstream fixes. Closes #398 Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
1 parent 778502a commit 3f901b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ if (WITH_PYTHON)
6767
find_package(SWIG 4.0)
6868
# Use Python3_ROOT_DIR to help find python3, if the correct location is not
6969
# being found by default.
70-
find_package(Python3 COMPONENTS Interpreter Development.Module)
70+
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
71+
# Workaround for issue https://github.com/google/s2geometry/issues/398
72+
# Macos requires libpython3.13.dylib and does not get it with .Module
73+
find_package(Python3 COMPONENTS Interpreter Development)
74+
else()
75+
find_package(Python3 COMPONENTS Interpreter Development.Module)
76+
endif()
7177
endif()
7278

7379
if (MSVC)

0 commit comments

Comments
 (0)