Opened 6 months ago

Last modified 2 months ago

#64059 assigned defect

mono will not install on macOS 12 on M1 hardware

Reported by: gctwnl Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: monterey arm64 Cc: mojca (Mojca Miklavec)
Port: mono

Description

I'm working on a brand new Mac that has macOS 12.0.1 installed. I installed a fresh MacPorts package for Monterey, then proceeded to upgrade the ports that had apparently been moved over to my new machine by Migration Assistant.

mono fails to compile.

Attachments (1)

main.log.zip (15.2 KB) - added by gctwnl 6 months ago.
main.log from MacPorts containing the error.

Download all attachments as: .zip

Change History (6)

Changed 6 months ago by gctwnl

Attachment: main.log.zip added

main.log from MacPorts containing the error.

comment:1 Changed 6 months ago by ryandesign (Ryan Schmidt)

Keywords: monterey arm64 added
Owner: set to MarcusCalhoun-Lopez
Status: newassigned

comment:2 Changed 5 months ago by NitigyaS (Nitigya)

I am facing the same error for

:debug:clean Starting logging for mono @6.12.0.122_0
:debug:sysinfo macOS 12.0.1 (darwin/21.1.0) arch arm
:debug:sysinfo MacPorts 2.7.1
:debug:sysinfo Xcode 13.2
:debug:sysinfo SDK 12
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 12.0
...skipping...
:info:build                                         ^~~~
:info:build mono-context.c:450:11: error: no member named '__r' in 'struct __darwin_arm_thread_state64'
:info:build         memcpy (&UCONTEXT_REG_R0 (my_uc), &mctx->regs, sizeof (host_mgreg_t) * 12);
:info:build         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./mono-sigcontext.h:384:72: note: expanded from macro 'UCONTEXT_REG_R0'
:info:build         #define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__r[0])
:info:build                                                                               ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/secure/_string.h:63:62: note: expanded from macro 'memcpy'
:info:build                 __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
:info:build                                                            ~~~~~~~~~~~~~~~~^~~~~
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/secure/_common.h:38:55: note: expanded from macro '__darwin_obsz0'
:info:build #define __darwin_obsz0(object) __builtin_object_size (object, 0)
:info:build                                                       ^~~~~~
:info:build mono-context.c:452:10: error: no member named '__fs' in 'struct __darwin_mcontext64'
:info:build         memcpy (UCONTEXT_REG_VFPREGS (my_uc), &mctx->fregs, sizeof (double) * 16);
:info:build         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./mono-sigcontext.h:398:81: note: expanded from macro 'UCONTEXT_REG_VFPREGS'
:info:build         #define UCONTEXT_REG_VFPREGS(ctx) (double*)(((ucontext_t*)(ctx))->uc_mcontext->__fs.__r)
:info:build                                                                                        ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/secure/_string.h:63:27: note: expanded from macro 'memcpy'
:info:build                 __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
:info:build                                         ^~~~
:info:build mono-context.c:452:10: error: no member named '__fs' in 'struct __darwin_mcontext64'
:info:build         memcpy (UCONTEXT_REG_VFPREGS (my_uc), &mctx->fregs, sizeof (double) * 16);
:info:build         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./mono-sigcontext.h:398:81: note: expanded from macro 'UCONTEXT_REG_VFPREGS'
:info:build         #define UCONTEXT_REG_VFPREGS(ctx) (double*)(((ucontext_t*)(ctx))->uc_mcontext->__fs.__r)
:info:build                                                                                        ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/secure/_string.h:63:62: note: expanded from macro 'memcpy'
:info:build                 __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
:info:build                                                            ~~~~~~~~~~~~~~~~^~~~~
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/secure/_common.h:38:55: note: expanded from macro '__darwin_obsz0'
:info:build #define __darwin_obsz0(object) __builtin_object_size (object, 0)
:info:build                                                       ^~~~~~
:info:build 6 errors generated.
:info:build make[5]: *** [libmonoutils_la-mono-context.lo] Error 1
:info:build make[5]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122/mono/utils'
:info:build make[4]: *** [all-recursive] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122/mono/utils'
:info:build make[3]: *** [all] Error 2
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122/mono/utils'
:info:build make[2]: *** [all-recursive] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122/mono'
:info:build make[1]: *** [all-recursive] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mono/mono/work/mono-6.12.0.122" && /usr/bin/make -j8 -w all
:info:build Exit code: 2
:error:build Failed to build mono: command execution failed
:debug:build Error code: CHILDSTATUS 2063 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"

comment:3 Changed 5 months ago by davidben (David Benjamin)

I ran into this as well, and can reproduce this building from the tarball directly. It looks like UCONTEXT_REG_R0 is getting expanded from here:

https://github.com/mono/mono/blob/mono-6.12.0.122/mono/utils/mono-sigcontext.h#L384

Yet presumably this is the right expansion for aarch64:

https://github.com/mono/mono/blob/mono-6.12.0.122/mono/utils/mono-sigcontext.h#L466

Looks like the immediate problem is the config.sub, or some other part of autotools, shipped in the Mono tarball is too old and is guessing a target triple of arm-apple-darwin21.2.0 instead of aarch64-apple-darwin21.2.0. If I autoreconf -fvi, I get a little further along in the build, though it seems to break later on for some bootstrapping reason. ./configure --build=aarch64-apple-darwin21.2.0 similarly avoids the outdated config.sub but runs into the bootstrapping problem.

Given the latest release doesn't yet include https://github.com/mono/mono/pull/20166, this is perhaps not expected to work yet. https://github.com/mono/mono/pull/20166#discussion_r745633487 may also become an issue.

comment:4 Changed 2 months ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:5 Changed 2 months ago by mojca (Mojca Miklavec)

It looks as if HomeBrew managed to patch it to a sufficient extent?

https://github.com/Homebrew/homebrew-core/commit/38464dff41172272d0e6651ba2277cc11332bf0c

Note: See TracTickets for help on using tickets.