Skip to content

Commit d59e286

Browse files
committed
Use dynamic symbol resolution for libmpi_caf on macOS
Unfortunately mpi_caf.c now calls into libgfortran for the random seed functionality. It would be nice to avoid this if possible, but it's stateful so I doubt that it would be possible. Any code that links to the library should be Fortran code and/or pull in libgfortran.
1 parent 31f7f18 commit d59e286

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mpi/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ set_target_properties ( caf_mpi
8080
# VERSION ${PROJECT_VERSION}
8181
)
8282

83+
# Unfortunately caf_mpi.c calls a function directly from libgfortran and this can be resolved later
84+
if(APPLE)
85+
set_target_properties ( caf_mpi
86+
PROPERTIES
87+
LINK_FLAGS "-undefined dynamic_lookup"
88+
)
89+
endif()
90+
8391
# Create a symlink in the include dir
8492
if(UNIX)
8593
add_custom_command(TARGET caf_mpi

0 commit comments

Comments
 (0)