On 9/10/10 8:58 AM, Robert Kern wrote:

Ah, I see the problem. PYTHON_LIBRARY is set to /usr/lib/libpython2.6.lib and
this is used directly in the link line. This is not the correct way to link
Python extension module on OS X. As you will see by compiling any extension
module using distutils, the correct way to link an extension module is to omit
the Python library or framework entirely and use "-undefined dynamic_lookup".
This will cause the extension module to look up unresolved symbols in the
process at load time. Since the interpreter itself is necessarily already up an
running by the time the extension module is loaded, it can provide all of the
Python symbols.

I'm afraid I don't have the cmake-fu to make this change.

Spoke too soon. The attached patches to Shiboken and PySide fix the problem for me. I'm not entirely sure they are the right thing to do (in particular, we have ENABLE_MAC flag for PySide but just the generic CMake APPLE flag for Shiboken), but they work for me and should not negatively affect other platforms.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd2146a..efd0648 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,9 +164,17 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     else()
         add_definitions("-DPy_DEBUG")
     endif()
-    set(PYSIDE_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+    if(ENABLE_MAC)
+        set(PYSIDE_PYTHON_LIBRARIES "-undefined dynamic_lookup")
+    else()
+        set(PYSIDE_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+    endif()
 else()
-    set(PYSIDE_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+    if(ENABLE_MAC)
+        set(PYSIDE_PYTHON_LIBRARIES "-undefined dynamic_lookup")
+    else()
+        set(PYSIDE_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+    endif()
 endif()
 
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6338fee..8861161 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,9 +103,17 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     else()
         add_definitions("-DPy_DEBUG")
     endif()
-    set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+    if(APPLE)
+        set(SBK_PYTHON_LIBRARIES "-undefined dynamic_lookup")
+    else()
+        set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+    endif()
 else()
-    set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+    if(APPLE)
+        set(SBK_PYTHON_LIBRARIES "-undefined dynamic_lookup")
+    else()
+        set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+    endif()
     add_definitions("-DNDEBUG")
 endif()
 
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to