From: Matthias Geiger Date: Wed, 10 Jun 2026 19:09:40 +0000 (+0200) Subject: Add patch to build with system mimalloc (Closes: #1138822) X-Git-Tag: archive/raspbian/3.2+dfsg-5+rpi1^2~25 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=da251cbb2edd574111d26e0e88027fa335e0aaa8;p=solvespace.git Add patch to build with system mimalloc (Closes: #1138822) --- diff --git a/debian/patches/06-Build-with-system-mimalloc.patch b/debian/patches/06-Build-with-system-mimalloc.patch new file mode 100644 index 0000000..afbd37b --- /dev/null +++ b/debian/patches/06-Build-with-system-mimalloc.patch @@ -0,0 +1,67 @@ +From: Matthias Geiger +Date: Wed, 10 Jun 2026 21:06:54 +0200 +Subject: Build with system mimalloc + +--- + CMakeLists.txt | 20 +------------------- + src/CMakeLists.txt | 2 +- + src/slvs/CMakeLists.txt | 2 +- + 3 files changed, 3 insertions(+), 21 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c299dc0..9ded6f1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -216,25 +216,7 @@ if(ENABLE_GUI OR ENABLE_CLI) + add_subdirectory(libdxfrw) + endif() + +-message(STATUS "Using in-tree mimalloc") +-set(MI_OVERRIDE OFF CACHE BOOL "") +-set(MI_BUILD_SHARED OFF CACHE BOOL "") +-set(MI_BUILD_OBJECT OFF CACHE BOOL "") +-set(MI_BUILD_TESTS OFF CACHE BOOL "") +-if(EMSCRIPTEN) +- # HACK: We only use mimalloc for the temporary heap, not as a general purpose +- # allocator. However, the Emscripten port of mimalloc assumes that it is used +- # as the system allocator, and depends on the slow emmalloc allocator. +- # We do not want to enable emmalloc, as that would slow down allocations all +- # over the place, so we must either use mimalloc as the system allocator as +- # well, or override its definitions to just use the existing system allocator. +- # The latter option is the least intrusive change from a stability standpoint, +- # so for now that's what we do here. We can try to convert to mimalloc wholsale +- # and remove this hack if we find the need to do so in the future. +- set(MI_EXTRA_CPPDEFS "emmalloc_free=free;emmalloc_memalign=memalign" CACHE INTERNAL "") +-endif() +-add_subdirectory(extlib/mimalloc EXCLUDE_FROM_ALL) +-set(MIMALLOC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/mimalloc/include) ++find_package(mimalloc CONFIG) + + if(NOT FORCE_VENDORED_Eigen3) + find_package(Eigen3 CONFIG) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3af2075..9451ec6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -36,7 +36,7 @@ target_link_libraries(slvs_deps INTERFACE + ${ZLIB_LIBRARY} + ${PNG_LIBRARY} + ${FREETYPE_LIBRARY} +- mimalloc-static) ++ mimalloc) + + if(NOT USE_QT_GUI OR ENABLE_CLI) + target_include_directories(slvs_deps SYSTEM INTERFACE ${CAIRO_INCLUDE_DIRS}) +diff --git a/src/slvs/CMakeLists.txt b/src/slvs/CMakeLists.txt +index d931f8f..7f5e9e4 100644 +--- a/src/slvs/CMakeLists.txt ++++ b/src/slvs/CMakeLists.txt +@@ -5,7 +5,7 @@ add_library(slvs-interface INTERFACE) + target_sources(slvs-interface INTERFACE lib.cpp) + target_compile_definitions(slvs-interface INTERFACE -DLIBRARY) + target_include_directories(slvs-interface INTERFACE ${CMAKE_SOURCE_DIR}/include) +-target_link_libraries(slvs-interface INTERFACE slvs-solver mimalloc-static) ++target_link_libraries(slvs-interface INTERFACE slvs-solver mimalloc) + + if(ENABLE_PYTHON_LIB) + add_custom_command( diff --git a/debian/patches/series b/debian/patches/series index ca5e28a..cca5e35 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ 03_use_system_threejs.patch 04_use_system_unifont.patch 05-Adjust-extlib-include-path.patch +06-Build-with-system-mimalloc.patch