diff --git a/CMakeLists.txt b/CMakeLists.txt index 5af15b88f2e3..eb2ebdad571c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -369,8 +369,14 @@ if (CHPL_HOST_MEM STREQUAL "mimalloc") message(FATAL_ERROR "Invalid CHPL_HOST_MIMALLOC value: ${CHPL_HOST_MIMALLOC}") endif() - target_link_libraries(ChplFrontend PRIVATE mimalloc) - target_link_libraries(ChplFrontendShared PRIVATE mimalloc) + # static linking results in much faster compile times, but casues crashes on Mac + if (APPLE) + target_link_libraries(ChplFrontend PRIVATE mimalloc) + target_link_libraries(ChplFrontendShared PRIVATE mimalloc) + else() + target_link_libraries(ChplFrontend PRIVATE mimalloc-static) + target_link_libraries(ChplFrontendShared PRIVATE mimalloc-static) + endif() endif() # Adjust the install rpath for chpl and chpldoc diff --git a/third-party/mimalloc/Makefile b/third-party/mimalloc/Makefile index cbe806a80ba1..9477371cb2bd 100644 --- a/third-party/mimalloc/Makefile +++ b/third-party/mimalloc/Makefile @@ -16,7 +16,7 @@ CHPL_MIMALLOC_CFG_OPTIONS += \ # if host, build shared, otherwise just build static ifeq ($(strip $(CHPL_MAKE_HOST_TARGET)),--host) -CHPL_MIMALLOC_CFG_OPTIONS += -DMI_BUILD_SHARED=ON -DMI_BUILD_STATIC=OFF +CHPL_MIMALLOC_CFG_OPTIONS += -DMI_BUILD_SHARED=ON -DMI_BUILD_STATIC=ON else CHPL_MIMALLOC_CFG_OPTIONS += -DMI_BUILD_SHARED=OFF -DMI_BUILD_STATIC=ON endif