Skip to content

Commit

Permalink
use static linking on Mac
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Nov 15, 2024
1 parent 5a40507 commit d297385
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion third-party/mimalloc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d297385

Please sign in to comment.