From 0afe0d9dbea36b8e03f8236999d3198d6415e5ae Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Fri, 15 Nov 2024 16:09:46 -0600 Subject: [PATCH] use static linking on linux Signed-off-by: Jade Abraham --- CMakeLists.txt | 10 ++++++++-- third-party/mimalloc/Makefile | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) 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