On Sat, Apr 19, 2025 at 01:45:21PM +0200, Chris Hofstaedtler wrote:
I imagine passing -march=armv8.1-a is also a baseline violation for armhf.
[...]
/usr/bin/cc -DMI_BUILD_RELEASE -DMI_CMAKE_BUILD_TYPE=relwithdebinfo 
-DMI_MALLOC_OVERRIDE -DMI_SHARED_LIB -DMI_SHARED_LIB_EXPORT -Dmimalloc_EXPORTS 
-I/build/reproducible-path/mimalloc-3.0.3+ds/include -g -O2 
-Werror=implicit-function-declaration 
-ffile-prefix-map=/build/reproducible-path/mimalloc-3.0.3+ds=. 
-fstack-protector-strong -fstack-clash-protection -Wformat 
-Werror=format-security -Wall -pedantic -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -g 
-DNDEBUG -std=gnu11 -fPIC -Wall -Wextra -Wno-unknown-pragmas 
-fvisibility=hidden -Wstrict-prototypes -ftls-model=initial-exec 
-fno-builtin-malloc -march=armv8.1-a -MD -MT 
CMakeFiles/mimalloc.dir/src/heap.c.o -MF CMakeFiles/mimalloc.dir/src/heap.c.o.d 
-o CMakeFiles/mimalloc.dir/src/heap.c.o -c 
/build/reproducible-path/mimalloc-3.0.3+ds/src/heap.c
cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU

There are two problems here. Firstly, it misdetects the architecture as arm64 because of the running kernel (this code is new in 3.0.3):

  elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv[89].?|ARM64)$" OR 
CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64" OR "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
    set(MI_ARCH "arm64")
  elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|armv[34567]|ARM)$")
    set(MI_ARCH "arm32")

(That seems to have various other possible consequences; grep for MI_ARCH_ARM64. And of course this sort of checking strategy breaks cross-builds as well.)

Secondly, this code in CMakeLists.txt defeats passing -DMI_OPT_ARCH=OFF from debian/rules:

if(MI_NO_OPT_ARCH)
  set(MI_OPT_ARCH "OFF")
elseif(MI_ARCH STREQUAL "arm64")
  set(MI_OPT_ARCH "ON")  # enable armv8.1-a by default on arm64 unless 
MI_NO_OPT_ARCH is set
endif()

Since the repository is in Salsa's Debian group and the maintainer is in LowThresholdNmu, I've gone ahead and committed the attached patch to git for the second problem. I haven't closed this bug with it yet though since I think the first problem probably needs to be fixed too.

--
Colin Watson (he/him)                              [[email protected]]
>From e8c099e625d296f955cd30bd4df45cd229a39328 Mon Sep 17 00:00:00 2001
From: Colin Watson <[email protected]>
Date: Wed, 13 Aug 2025 00:51:28 +0100
Subject: [PATCH] Build with -DMI_NO_OPT_ARCH=ON rather than -DMI_OPT_ARCH=OFF

The latter is ineffective on systems that the build system thinks are
arm64 (part of #1103589).
---
 debian/changelog | 9 +++++++++
 debian/rules     | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index bc8ee04..cdae5fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+mimalloc (3.0.3+ds-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Build with -DMI_NO_OPT_ARCH=ON rather than -DMI_OPT_ARCH=OFF, since the
+    latter is ineffective on systems that the build system thinks are arm64
+    (part of #1103589).
+
+ -- Colin Watson <[email protected]>  Wed, 13 Aug 2025 00:44:46 +0100
+
 mimalloc (3.0.3+ds-1) unstable; urgency=medium
 
   * Ack NMUs.
diff --git a/debian/rules b/debian/rules
index d22c3ed..a5a55a7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,7 +25,7 @@ override_dh_auto_configure:
 	-DMI_BUILD_OBJECT=OFF \
 	-DMI_BUILD_TESTS=OFF \
 	-DMI_INSTALL_TOPLEVEL=ON \
-	-DMI_OPT_ARCH=OFF \
+	-DMI_NO_OPT_ARCH=ON \
 	-DMI_USE_LIBATOMIC=$(LIBATOMIC) \
 
 override_dh_missing:
-- 
2.50.1

Reply via email to