[Trilinos-Users] PyTrilinos does not build with Clang on Mac OS X Mountain Lion
Jonathan Guyer
guyer at nist.gov
Mon Jun 17 06:50:50 MDT 2013
My Mac OS X laptop was recently forcibly upgraded from 10.6.8 to 10.8.4 and I've spent the intervening weeks trying to get things working again. I offer a solution below for the problems I ran into with PyTrilinos.
In the past, what I settled on is described at
http://matforge.org/fipy/wiki/InstallFiPy/MacOSX/SnowLeopard#Trilinos10.6.4
but this process failed to link due to missing symbols from the Python library (I tried unsuccessfully with Trilinos 10.6.4, 11.0.3, and 11.2.3). Make output here:
https://gist.github.com/guyer/5796578
Careful comparison of the link command against what was generated by my last good build determined that "-undefined dynamic_lookup" was missing.
I find that this patch on 11.2.3 is enough to get things to link and pass FiPy's tests (I patched the same construct in Sundance, too, although I haven't tested that):
{{{
diff -u -r a/packages/PyTrilinos/src/CMakeLists.txt b/packages/PyTrilinos/src/CMakeLists.txt
--- a/packages/PyTrilinos/src/CMakeLists.txt 2013-04-25 13:15:58.000000000 -0400
+++ b/packages/PyTrilinos/src/CMakeLists.txt 2013-06-16 08:18:49.000000000 -0400
@@ -62,7 +62,7 @@
# to the pytrilinos library and PyTrilinos extension modules
SET(EXTRA_LINK_ARGS "${CMAKE_SHARED_LINKER_FLAGS}")
IF(APPLE)
- IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ IF((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
SET(EXTRA_LINK_ARGS "${EXTRA_LINK_ARGS} -undefined dynamic_lookup")
ENDIF()
ENDIF(APPLE)
diff -u -r a/packages/Sundance/python/src/CMakeLists.txt b/packages/Sundance/python/src/CMakeLists.txt
--- a/packages/Sundance/python/src/CMakeLists.txt 2013-04-25 13:16:10.000000000 -0400
+++ b/packages/Sundance/python/src/CMakeLists.txt 2013-06-16 08:59:04.000000000 -0400
@@ -4,7 +4,7 @@
# to the pytrilinos library and PyTrilinos extension modules
SET(EXTRA_LINK_ARGS "")
IF(APPLE)
- IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ IF((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
APPEND_SET(EXTRA_LINK_ARGS "-undefined dynamic_lookup")
ENDIF()
ENDIF(APPLE)
}}}
More information about the Trilinos-Users
mailing list