In https://bugs.debian.org/1103589, I noticed that the upstream CMakeLists.txt was misdetecting the intended host architecture as arm64 due to `CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv[89].?|ARM64)$"`. debhelper's cmake buildsystem sets CMAKE_SYSTEM_PROCESSOR when cross-compiling to armhf, but when not cross-compiling it allows cmake to use its default. According to https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html that falls back to CMAKE_HOST_SYSTEM_PROCESSOR, which is just the output of `uname -m` when building on Linux. For CMAKE_SYSTEM_NAME it doesn't matter since the autodetection is pretty likely to be correct, but it's fairly well-known that `uname -m` is an inappropriate thing to use when configuring package builds. Should debhelper perhaps pass -DCMAKE_SYSTEM_PROCESSOR also in the non-cross-compiling case? Thanks,
Though when I tried to set -DCMAKE_SYSTEM_PROCESSOR=armv7l in the
particular case of mimalloc, it seemed to do nothing; printing the value
of ${CMAKE_SYSTEM_PROCESSOR} from CMakeLists.txt still said "armv8l".
So this debhelper suggestion probably needs more investigation by
somebody who knows more about cmake than I do!
Colin Watson: Hi Colin, Thanks for the suggestion and for the follow up clarifying that more might be needed. Sadly, I am not an expert on this matter, so all I can do for now is tag the bug `moreinfo help`. I have CC'ed the CMake team in case they can help with this. For the CMake team, there is more context in https://bugs.debian.org/1110961#10 not quoted here. Best regards, Niels
Hi, * Niels Thykier <niels@thykier.net> [2025-08-24 09:50]: There is an open wishlist bug [1] about properly mapping Debian architectures to CMake systems and processors. A possible alternative would be the CMAKE_LIBRARY_ARCHITECTURE variable, which is initialized during compiler configuration for C, CXX, and Fortran and has the same value as DEB_HOST_MULTIARCH. Any architecture-specific setup in upstream code could be patched to check that variable instead of CMAKE_SYSTEM_PROCESSOR. Cheers Timo [1] https://bugs.debian.org/930995