From 31e7cd31c144fdfa84f072257436213bc67d1b17 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 10:49:23 +0700 Subject: [PATCH] make sure that mimalloc.o is *always* first, no matter if $_ENV['LIBS'] is set --- src/SPC/util/SPCConfigUtil.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 5dd86490..1a8547e6 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -102,15 +102,17 @@ class SPCConfigUtil $libs = "-lphp {$libs} -lc"; } + $allLibs = getenv('LIBS') . ' ' . $libs; + // mimalloc must come first if (str_contains($libs, BUILD_LIB_PATH . '/mimalloc.o')) { - $libs = BUILD_LIB_PATH . '/mimalloc.o ' . str_replace(BUILD_LIB_PATH . '/mimalloc.o', '', $libs); + $allLibs = BUILD_LIB_PATH . '/mimalloc.o ' . str_replace(BUILD_LIB_PATH . '/mimalloc.o', '', $allLibs); } return [ 'cflags' => trim(getenv('CFLAGS') . ' ' . $cflags), 'ldflags' => trim(getenv('LDFLAGS') . ' ' . $ldflags), - 'libs' => trim(getenv('LIBS') . ' ' . $libs), + 'libs' => trim($allLibs), ]; }