From 53a53262483517fca0b23cdf7f0eb2c2a56d9995 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Wed, 10 Apr 2024 09:18:42 +0200 Subject: [PATCH] mimalloc: avoid mimalloc override By default mimalloc is built to override default allocation functions. So it is used also by v8. This change avoid the mimalloc override to keep the native stdlib functions. --- Makefile | 24 +++++++++++++----------- build.zig | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 61283568..42ee34f7 100644 --- a/Makefile +++ b/Makefile @@ -186,23 +186,25 @@ install-jsruntime: @cd vendor/jsruntime-lib && \ make install -install-mimalloc-dev: +.PHONY: _build_mimalloc +_build_mimalloc: @cd vendor/mimalloc && \ - mkdir -p out && \ + mkdir -p out/include && \ + cp include/mimalloc.h out/include/ && \ cd out && \ - cmake -DCMAKE_BUILD_TYPE=Debug .. && \ - make mimalloc-static && \ + cmake -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) .. && \ + make + +install-mimalloc-dev: _build_mimalloc +install-mimalloc-dev: OPTS=-DCMAKE_BUILD_TYPE=Debug +install-mimalloc-dev: + @cd vendor/mimalloc/out && \ mv libmimalloc-debug.a libmimalloc.a -install-mimalloc: - @cd vendor/mimalloc && \ - mkdir -p out && \ - cd out && \ - cmake .. && \ - make mimalloc-static +install-mimalloc: _build_mimalloc clean-mimalloc: - rm -fr vendor/mimalloc/lib/* + @rm -fr vendor/mimalloc/lib/* ## Init and update git submodule install-submodule: diff --git a/build.zig b/build.zig index e2e1a9c0..c5b8be86 100644 --- a/build.zig +++ b/build.zig @@ -155,7 +155,7 @@ fn common( // link mimalloc step.addObjectFile(.{ .path = "vendor/mimalloc/out/libmimalloc.a" }); - step.addIncludePath(.{ .path = "vendor/mimalloc/include" }); + step.addIncludePath(.{ .path = "vendor/mimalloc/out/include" }); } fn linkNetSurf(step: *std.build.LibExeObjStep) void {