Build fails on armv5te target

Hi, I am trying to install mono-runtime on my Debian Stable (bookworm) NAS which runs the armel (armv5te) architecture. During install of the distro deb package I got a crash with the following error:

r4_conv_to_r8 R47 <- R44
* Assertion: should not be reached at decompose.c:1894

To investigate, I started a clean debian bookworm container on the same device and tried to build mono-runtime from source.

sudo docker run --name monodebian -it arm32v5/debian /bin/bash

Then I started the build using the following commands:

# apt update
# apt-get install git autoconf libtool automake build-essential gettext cmake python3 curl libtool libtool-bin
# mkdir /opt/mono
# cd /opt
# curl -O https://download.mono-project.com/sources/mono/mono-6.12.0.199.tar.xz
# tar -xvf mono-6.12.0.199.tar.xz
# cd mono-6.12.0.199
# ./configure --prefix=/opt/mono
# make

After a while, logs show the same error:

Make log
...
Making all in runtime
make[2]: Entering directory '/opt/mono-6.12.0.199/runtime'
cp ../data/config etc/mono/config
if test -d "/opt/mono-6.12.0.199/support"; then \
        sed 's,target="$mono_libdir/libMonoPosixHelper.so",target="/opt/mono-6.12.0.199/support/libMonoPosixHelper.la",' etc/mono/config > etc/mono/config.tmp \
         && mv etc/mono/config.tmp etc/mono/config \
         ; \
else \
        echo "Unknown directory '/opt/mono-6.12.0.199/support'" && false; \
fi
if test -d "/opt/mono-6.12.0.199/mono/native"; then \
        sed 's,target="$mono_libdir/libmono-native.so",target="/opt/mono-6.12.0.199/mono/native/libmono-native.la",' etc/mono/config > etc/mono/config.tmp \
         && mv etc/mono/config.tmp etc/mono/config \
         ; \
else \
        echo "Unknown directory '/opt/mono-6.12.0.199/mono/native'" && false; \
fi
if test -d "/opt/mono-6.12.0.199/mono/btls/build-shared"; then \
        sed 's,target="$mono_libdir/libmono-btls-shared.so",target="/opt/mono-6.12.0.199/mono/btls/build-shared/libmono-btls-shared.so",' etc/mono/config > etc/mono/config.tmp \
         && mv etc/mono/config.tmp etc/mono/config \
         ; \
else \
        echo "Unknown directory '/opt/mono-6.12.0.199/mono/btls/build-shared'"; \
fi
if test -n ""; then \
        sed 's,target="libgdiplus.so.0",target="",' etc/mono/config > etc/mono/config.tmp \
         && mv etc/mono/config.tmp etc/mono/config \
         ; \
fi
cat etc/mono/config
<configuration>
        <dllmap dll="i:cygwin1.dll" target="libc.so.6" os="!windows" />
        <dllmap dll="libc" target="libc.so.6" os="!windows"/>
        <dllmap dll="intl" target="libc.so.6" os="!windows"/>
        <dllmap dll="intl" name="bind_textdomain_codeset" target="libc.so.6" os="solaris"/>
        <dllmap dll="libintl" name="bind_textdomain_codeset" target="libc.so.6" os="solaris"/>
        <dllmap dll="libintl" target="libc.so.6" os="!windows"/>
        <dllmap dll="i:libxslt.dll" target="libxslt.so" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libodbc.so.2" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
        <dllmap dll="oci" target="libclntsh.so" os="!windows"/>
        <dllmap dll="db2cli" target="libdb2_36.so" os="!windows"/>
        <dllmap dll="MonoPosixHelper" target="/opt/mono-6.12.0.199/support/libMonoPosixHelper.la" os="!windows" />
        <dllmap dll="System.Native" target="/opt/mono-6.12.0.199/mono/native/libmono-native.la" os="!windows" />
        <dllmap dll="System.Net.Security.Native" target="/opt/mono-6.12.0.199/mono/native/libmono-native.la" os="!windows" />
        <dllmap dll="System.Security.Cryptography.Native.Apple" target="/opt/mono-6.12.0.199/mono/native/libmono-native.la" os="osx" />
        <dllmap dll="libmono-btls-shared" target="/opt/mono-6.12.0.199/mono/btls/build-shared/libmono-btls-shared.so" os="!windows" />
        <dllmap dll="i:msvcrt" target="libc.so.6" os="!windows"/>
        <dllmap dll="i:msvcrt.dll" target="libc.so.6" os="!windows"/>
        <dllmap dll="sqlite" target="libsqlite.so.0" os="!windows"/>
        <dllmap dll="sqlite3" target="libsqlite3.so.0" os="!windows"/>
        <dllmap dll="libX11" target="libX11.so.6" os="!windows" />
        <dllmap dll="libgdk-x11-2.0" target="libgdk-x11-2.0.so.0" os="!windows"/>
        <dllmap dll="libgdk_pixbuf-2.0" target="libgdk_pixbuf-2.0.so.0" os="!windows"/>
        <dllmap dll="libgtk-x11-2.0" target="libgtk-x11-2.0.so.0" os="!windows"/>
        <dllmap dll="libglib-2.0" target="libglib-2.0.so.0" os="!windows"/>
        <dllmap dll="libgobject-2.0" target="libgobject-2.0.so.0" os="!windows"/>
        <dllmap dll="libgnomeui-2" target="libgnomeui-2.so.0" os="!windows"/>
        <dllmap dll="librsvg-2" target="librsvg-2.so.2" os="!windows"/>
        <dllmap dll="libXinerama" target="libXinerama.so.1" os="!windows" />
        <dllmap dll="libasound" target="libasound.so.2" os="!windows" />
        <dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
        <dllmap dll="libcairo-2.dll" target="$mono_libdir/libcairo.2.dylib" os="osx" />
        <dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
        <dllmap dll="libcups" target="libcups.dylib" os="osx"/>
        <dllmap dll="i:kernel32.dll">
                <dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
                <dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
                <dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
                <dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
        </dllmap>
        <dllmap dll="gdiplus" target="libgdiplus.so.0" os="!windows"/>
        <dllmap dll="gdiplus.dll" target="libgdiplus.so.0"  os="!windows"/>
        <dllmap dll="gdi32" target="libgdiplus.so.0" os="!windows"/>
        <dllmap dll="gdi32.dll" target="libgdiplus.so.0" os="!windows"/>
</configuration>
/bin/bash ../mkinstalldirs _tmpinst/bin
mkdir -p -- _tmpinst/bin
cp mono-wrapper _tmpinst/bin/mono
echo '#! /bin/sh' > _tmpinst/bin/ilasm ; \
r=`pwd`; m=`cd /opt/mono-6.12.0.199/mcs && pwd`; \
echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"$m/ilasm/ilasm.exe"'" "$@"' >> _tmpinst/bin/ilasm ; \
chmod +x _tmpinst/bin/ilasm
echo '#! /bin/sh' > _tmpinst/bin/csc ; \
r=`pwd`; m=`cd /opt/mono-6.12.0.199/mcs && pwd`; \
echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"/opt/mono-6.12.0.199/external/roslyn-binaries/Microsoft.Net.Compilers/3.9.0/csc.exe"'" "$@"' >> _tmpinst/bin/csc ; \
chmod +x _tmpinst/bin/csc
echo '#! /bin/sh' > _tmpinst/bin/mcs ; \
r=`pwd`; m=`cd /opt/mono-6.12.0.199/mcs && pwd`; \
echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"$m/class/lib/net_4_x/mcs.exe"'" "$@"' >> _tmpinst/bin/mcs ; \
chmod +x _tmpinst/bin/mcs
echo '#! /bin/sh' > _tmpinst/bin/al ; \
r=`pwd`; m=`cd /opt/mono-6.12.0.199/mcs && pwd`; \
echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"$m/class/lib/net_4_x/al.exe"'" "$@"' >> _tmpinst/bin/al ; \
chmod +x _tmpinst/bin/al
if test -w /opt/mono-6.12.0.199/mcs; then :; else chmod -R +w /opt/mono-6.12.0.199/mcs; fi
cd /opt/mono-6.12.0.199/mcs && make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='binary_reference_assemblies net_4_x xbuild_12 xbuild_14              ' CC='gcc' all-profiles
mkdir -p -- build/deps
make[6]: mono: No such file or directory
make[6]: *** [build/profiles/build.make:134: build/deps/basic-profile-check.exe] Error 127
*** The runtime 'mono' doesn't appear to be usable.
*** Trying the 'monolite-linux/1A5E0066-58DC-428A-B21C-0AD6CDAE2789' directory.
 r4_conv_to_r8 R47 <- R44
* Assertion: should not be reached at decompose.c:1894


=================================================================
        Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
         (No frames)


=================================================================
        Telemetry Dumper:
=================================================================
Pkilling 0x1966711808x from 0x1995620704x
Entering thread summarizer pause from 0x1995620704x
Finished thread summarizer pause from 0x1995620704x.
Failed to create breadcrumb file (null)/crash_hash_0x456e03398
/opt/mono-6.12.0.199/runtime/etc/../bin/mono-hang-watchdog: 3: exec: /opt/mono-6.12.0.199/tools/mono-hang-watchdog/mono-hang-watchdog: not found

Waiting for dumping threads to resume

=================================================================
        External Debugger Dump:
=================================================================
[New LWP 430]
[New LWP 431]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabi/libthread_db.so.1".
0x76dcbb18 in __GI___wait4_time64 (pid=433, stat_loc=0x7ec01844, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:35
35      ../sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
  Id   Target Id                                 Frame
* 1    Thread 0x76f2c160 (LWP 405) "mono"        0x76dcbb18 in __GI___wait4_time64 (pid=433, stat_loc=0x7ec01844, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:35
  2    Thread 0x767ff400 (LWP 430) "SGen worker" __futex_abstimed_wait_common32 (private=<optimized out>, cancel=<optimized out>, abstime=<optimized out>, op=<optimized out>, expected=<optimized out>, futex_word=<optimized out>) at futex-internal.c:40
  3    Thread 0x7539a400 (LWP 431) "Finalizer"   __futex_abstimed_wait_common32 (private=<optimized out>, cancel=<optimized out>, abstime=<optimized out>, op=<optimized out>, expected=<optimized out>, futex_word=<optimized out>) at futex-internal.c:40

Thread 3 (Thread 0x7539a400 (LWP 431) "Finalizer"):
#0  __futex_abstimed_wait_common32 (private=<optimized out>, cancel=<optimized out>, abstime=<optimized out>, op=<optimized out>, expected=<optimized out>, futex_word=<optimized out>) at futex-internal.c:40
#1  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x8c1874 <finalizer_sem>, expected=1992983016, expected@entry=1, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0, private@entry=9181300, cancel=cancel@entry=true) at futex-internal.c:99
#2  0x76d87404 in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x8c1874 <finalizer_sem>, expected=expected@entry=1, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0) at futex-internal.c:139
#3  0x76d95c1c in do_futex_wait (sem=sem@entry=0x8c1874 <finalizer_sem>, abstime=0x0, clockid=0) at sem_waitcommon.c:116
#4  0x76d95ce0 in __new_sem_wait_slow64 (sem=0x8c1874 <finalizer_sem>, abstime=0x0, clockid=0) at sem_waitcommon.c:284
#5  0x76d95db0 in __new_sem_wait (sem=<optimized out>) at sem_wait.c:42
#6  0x0075d7e4 in mono_os_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x8c1874 <finalizer_sem>) at ../../mono/utils/mono-os-semaphore.h:203
#7  mono_coop_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x8c1874 <finalizer_sem>) at ../../mono/utils/mono-coop-semaphore.h:41
#8  finalizer_thread (unused=unused@entry=0x0) at gc.c:965
#9  0x00718418 in start_wrapper_internal (stack_ptr=0x7539b000, start_info=0x0) at threads.c:1233
#10 start_wrapper (data=0x28579d8) at threads.c:1308
#11 0x76d8b268 in start_thread (arg=0x7539a400) at pthread_create.c:442
#12 0x76e0c3ac in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:74 from /lib/arm-linux-gnueabi/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0x767ff400 (LWP 430) "SGen worker"):
#0  __futex_abstimed_wait_common32 (private=<optimized out>, cancel=<optimized out>, abstime=<optimized out>, op=<optimized out>, expected=<optimized out>, futex_word=<optimized out>) at futex-internal.c:40
#1  __futex_abstimed_wait_common (futex_word=0x8c9848 <work_cond+40>, futex_word@entry=0x0, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0, cancel=cancel@entry=true) at futex-internal.c:99
#2  0x76d87404 in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x0, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at futex-internal.c:139
#3  0x76d8a6b8 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x8c9848 <work_cond+40>, cond=0x8c9820 <work_cond>) at pthread_cond_wait.c:503
#4  ___pthread_cond_wait (cond=0x8c9820 <work_cond>, mutex=0x8c9848 <work_cond+40>) at pthread_cond_wait.c:618
#5  0x007be430 in mono_os_cond_wait (mutex=0x8c97e4 <lock>, cond=0x8c9820 <work_cond>) at ../../mono/utils/mono-os-mutex.h:219
#6  get_work (job=<synthetic pointer>, do_idle=<synthetic pointer>, work_context=<synthetic pointer>, worker_index=<optimized out>) at sgen-thread-pool.c:165
#7  thread_func (data=0x0) at sgen-thread-pool.c:196
#8  0x76d8b268 in start_thread (arg=0x767ff400) at pthread_create.c:442
#9  0x76e0c3ac in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:74 from /lib/arm-linux-gnueabi/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x76f2c160 (LWP 405) "mono"):
#0  0x76dcbb18 in __GI___wait4_time64 (pid=433, stat_loc=0x7ec01844, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:35
#1  0x76dcbcb4 in __GI___wait4 (pid=pid@entry=433, stat_loc=stat_loc@entry=0x7ec0183c, options=options@entry=0, usage=usage@entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:120
#2  0x76dcb840 in __GI___waitpid (pid=pid@entry=433, stat_loc=stat_loc@entry=0x7ec0183c, options=options@entry=0) at waitpid.c:38
#3  0x0056a8ec in dump_native_stacktrace (signal=0x65746165 <error: Cannot access memory at address 0x65746165>, signal@entry=0x802424 "SIGABRT", mctx=0x74736e49, mctx@entry=0x7ec01f40) at mini-posix.c:1113
#4  0x0056aa40 in mono_dump_native_crash_info (signal=signal@entry=0x802424 "SIGABRT", mctx=mctx@entry=0x7ec01f40, info=info@entry=0x7ec02028) at mini-posix.c:1157
#5  0x0053768c in mono_handle_native_crash (signal=0x802424 "SIGABRT", mctx=mctx@entry=0x7ec01f40, info=info@entry=0x7ec02028) at mini-exceptions.c:3423
#6  0x00569bec in sigabrt_signal_handler (_dummy=6, _info=0x7ec02028, context=0x7ec020a8) at mini-posix.c:235
#7  <signal handler called>
#8  __pthread_kill_implementation (threadid=1995620704, signo=6, no_tid=0) at pthread_kill.c:44
#9  0x76d433a0 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#10 0x76d2c104 in __GI_abort () at abort.c:79
#11 0x007e59d4 in monoeg_assert_abort () at goutput.c:57
#12 0x007c6dbc in mono_log_write_logfile (log_domain=<optimized out>, level=G_LOG_LEVEL_ERROR, hdr=<optimized out>, message=0x76f2c160 "\001") at mono-log-common.c:136
#13 0x007e5960 in monoeg_g_logstr (msg=<optimized out>, log_level=G_LOG_LEVEL_ERROR, log_domain=0x0) at goutput.c:151
#14 monoeg_g_logv_nofree (log_domain=log_domain@entry=0x0, log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x2ae4a68 "\340Q\266\002", args=..., args@entry=...) at goutput.c:166
#15 0x007e5c60 in monoeg_assertion_message (format=0x8a9148 "* Assertion: should not be reached at %s:%d\n") at goutput.c:201
#16 0x007e5cd0 in mono_assertion_message_unreachable (file=<optimized out>, line=line@entry=1894) at goutput.c:228
#17 0x005b9e1c in mono_decompose_soft_float (cfg=cfg@entry=0x2ae4a68) at decompose.c:1894
#18 0x0057186c in mini_method_compile (method=method@entry=0x2b651e0, opts=<optimized out>, opts@entry=374417919, domain=domain@entry=0x2824c68, flags=flags@entry=JIT_FLAG_RUN_CCTORS, parts=<optimized out>, parts@entry=0, aot_method_index=<optimized out>, aot_method_index@entry=-1) at mini.c:3742
#19 0x005722f8 in mono_jit_compile_method_inner (method=method@entry=0x2b651e0, target_domain=target_domain@entry=0x2824c68, opt=374417919, opt@entry=45380464, error=error@entry=0x7ec027a0) at mini.c:4071
#20 0x004fe810 in mono_jit_compile_method_with_opt (method=0x2b651e0, opt=45380464, jit_only=9157557, error=0x7ec027a0) at mini-runtime.c:2475
#21 0x004ff9c0 in mono_jit_compile_method (method=<optimized out>, error=<optimized out>) at mini-runtime.c:2525
#22 0x0053acec in common_call_trampoline (regs=0x2b81ea8, code=0x743f3598 "", m=0x2b651e0, vt=0x0, vtable_slot=<optimized out>, error=0x7ec027a0) at mini-trampolines.c:635
#23 0x0053b838 in mono_magic_trampoline (regs=0x7ec02880, code=<optimized out>, arg=0x2b651e0, tramp=<optimized out>) at mini-trampolines.c:775
#24 0x76cfe06c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
[Inferior 1 (process 405) detached]

=================================================================
        Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x76d8d67c):0x76d8d66c  9f 00 01 eb 04 10 a0 e1 0a 20 a0 e1 00 00 00 ef  ......... ......
0x76d8d67c  01 0a 70 e3 00 00 60 82 00 00 a0 93 de ff ff ea  ..p...`.........
0x76d8d68c  08 00 a0 e1 65 e8 ff eb d4 ff ff ea 08 00 a0 e1  ....e...........
0x76d8d69c  23 e8 ff eb be ff ff ea 89 46 02 eb d4 7a 0f 00  #........F...z..

=================================================================
        Managed Stacktrace:
=================================================================
          at <unknown> <0xffffffff>
          at System.Collections.Hashtable:.ctor <0x0002b>
          at System.Resources.ResourceManager:CommonAssemblyInit <0x001ef>
          at System.Resources.ResourceManager:.ctor <0x000eb>
          at Microsoft.CodeAnalysis.CSharp.ErrorFacts:get_ResourceManager <0x000ab>
          at Microsoft.CodeAnalysis.CSharp.ErrorFacts:GetMessage <0x00013>
          at Microsoft.CodeAnalysis.CSharp.CSharpCompiler:PrintLogo <0x00037>
          at Microsoft.CodeAnalysis.CommonCompiler:RunCore <0x00203>
          at Microsoft.CodeAnalysis.CommonCompiler:Run <0x0012f>
          at <>c__DisplayClass1_0:<Run>b__0 <0x00047>
          at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil:RunWithUtf8Output <0x000d3>
          at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc:Run <0x00293>
          at <Module>:invoke_int_string[]_BuildPaths_TextWriter_IAnalyzerAssemblyLoader <0x0010b>
          at Microsoft.CodeAnalysis.CommandLine.BuildClient:RunLocalCompilation <0x000b3>
          at Microsoft.CodeAnalysis.CommandLine.BuildClient:RunCompilation <0x0039b>
          at Microsoft.CodeAnalysis.CommandLine.BuildClient:Run <0x00167>
          at Microsoft.CodeAnalysis.CSharp.CommandLine.Program:MainCore <0x000c7>
          at Microsoft.CodeAnalysis.CSharp.CommandLine.Program:Main <0x0001f>
          at <Module>:runtime_invoke_int_object <0x00127>
=================================================================
Aborted (core dumped)
make[8]: *** [build/profiles/build.make:134: build/deps/basic-profile-check.exe] Error 134
*** The contents of your 'monolite-linux/1A5E0066-58DC-428A-B21C-0AD6CDAE2789' directory may be out-of-date
*** You may want to try 'make get-monolite-latest'
make[8]: *** [build/profiles/build.make:117: do-profile-check-monolite] Error 1
make[7]: *** [build/profiles/build.make:93: do-profile-check] Error 2
make[6]: *** [build/profiles/build.make:129: do-profile-check-monolite] Error 2
make[5]: *** [build/profiles/build.make:93: do-profile-check] Error 2
make[4]: *** [Makefile:58: profile-do--build--all] Error 2
make[3]: *** [Makefile:54: profiles-do--all] Error 2
make[2]: *** [Makefile:703: all-mcs] Error 2
make[2]: Leaving directory '/opt/mono-6.12.0.199/runtime'
make[1]: *** [Makefile:599: all-recursive] Error 1
make[1]: Leaving directory '/opt/mono-6.12.0.199'
make: *** [Makefile:527: all] Error 2

I'm not an expert, but this could possibly be a code generation error in GCC rather than a Mono issue, unfortunately this architecture is uncommon. Do you have any idea how to address this?

Edited by Luca Leonardo Scorcia