Package: libmimalloc3
Version: 3.0.3+ds-1

~# apt-get install --purge context
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
 libmimalloc3 luametatex
The following NEW packages will be installed:
 libmimalloc3 luametatex
The following held packages will be changed:
 context
The following packages will be upgraded:
 context
1 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 99.2 MB of archives.
After this operation, 6,011 kB disk space will be freed.
Do you want to continue? [Y/n]
Get:1 https://deb.debian.org/debian unstable/main amd64 libmimalloc3
amd64 3.0.3+ds-1 [58.1 kB]
Get:2 https://deb.debian.org/debian trixie/main amd64 context all
2024.04.01.20240428+dfsg-2 [97.8 MB]
Get:3 https://deb.debian.org/debian trixie/main amd64 luametatex amd64
2.11.02+really2.11.01+ds-1+b1 [1,344 kB]
Fetched 99.2 MB in 10s (9,876 kB/s)
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
Reading changelogs... Done
apt-listchanges: Do you want to continue? [Y/n]
Selecting previously unselected package libmimalloc3:amd64.
(Reading database ... 470453 files and directories currently installed.)
Preparing to unpack .../libmimalloc3_3.0.3+ds-1_amd64.deb ...
Unpacking libmimalloc3:amd64 (3.0.3+ds-1) ...
Preparing to unpack .../context_2024.04.01.20240428+dfsg-2_all.deb ...
Unpacking context (2024.04.01.20240428+dfsg-2) over
(2021.03.05.20230120+dfsg-1+deb12u1) ...
Selecting previously unselected package luametatex.
Preparing to unpack .../luametatex_2.11.02+really2.11.01+ds-1+b1_amd64.deb ...
Unpacking luametatex (2.11.02+really2.11.01+ds-1+b1) ...
Setting up libmimalloc3:amd64 (3.0.3+ds-1) ...
Setting up luametatex (2.11.02+really2.11.01+ds-1+b1) ...
Setting up context (2024.04.01.20240428+dfsg-2) ...
Processing triggers for auctex (13.2-1) ...
Processing triggers for tex-common (6.19) ...
Running mktexlsr. This may take some time... done.
Running mtxrun --generate. This may take some time...
mtxrun --generate failed. Output has been stored in
/tmp/mtxrun.p2dVjw0e
Please include this file if you report a bug.

dpkg: error processing package tex-common (--configure):
installed tex-common package post-installation script subprocess
returned error exit status 1
Processing triggers for fontconfig (2.15.0-2.3) ...
Processing triggers for libc-bin (2.41-8) ...
Processing triggers for man-db (2.13.1-1) ...
Errors were encountered while processing:
tex-common
E: Sub-process /usr/bin/dpkg returned an error code (1)


The contents of /tmp/mtxrun.p2dVjw0e are:
~# cat /tmp/mtxrun.p2dVjw0e
Illegal instruction


I've taken a look at the mimalloc-3.0.3 source. The setting
MI_OPT_ARCH=OFF in debian/rules appears to
invoke a falsehood if my interpretation of
mimalloc-3.0.3+ds/CMakeLists.txt is correct:

# Compiler and architecture specific flags
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT
CMAKE_SYSTEM_NAME MATCHES "Haiku")
# ^true
 if(MI_OPT_ARCH)
   # ^false - go to continue...
   if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang" AND
CMAKE_OSX_ARCHITECTURES)   # to support multi-arch binaries (#999)
     if("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
       list(APPEND MI_OPT_ARCH_FLAGS "-Xarch_arm64;-march=armv8.1-a")
     endif()
     if("x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
       list(APPEND MI_OPT_ARCH_FLAGS
"-Xarch_x86_64;-march=haswell;-Xarch_x86_64;-mavx2")
     endif()
   # continue...
   elseif(MI_ARCH STREQUAL "x64")
   # ^true. Architecture is x86-64
     set(MI_OPT_ARCH_FLAGS "-march=haswell;-mavx2")    # fast bit scan
(since 2013)
     # ^These flags force Haswell architecture or above and allow the
generation of AVX2 code
   elseif(MI_ARCH STREQUAL "arm64")
     set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a")         # fast atomics
(since 2016)
   endif()
 endif()
endif()

-march other than 'x86-64' should not be used if one intends to
generate universal x86-64 instructions:
<https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html>

-mtune=haswell would be OK.

A quick fix for x86-64 should be to patch this line (maybe upstream?):
set(MI_OPT_ARCH_FLAGS "-march=haswell;-mavx2")    # fast bit scan (since 2013)
with:
set(MI_OPT_ARCH_FLAGS "-mtune=haswell")

(Although I'd probably choose "-mtune=sandybridge" because Sandy
Bridge is still architecturally
similar to present day processors but has some stalls that can be
worked around without unduly impacting
newer processor architectures).

MI_OPT_ARCH=OFF appears to be an insufficient workaround to this
now-closed bug report:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094881>

Regards,
Adam

Reply via email to