Opened 3 years ago
Closed 2 years ago
#64059 closed defect (fixed)
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)
Change History (11)
Changed 3 years ago by gctwnl
Attachment: | main.log.zip added |
---|
comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | monterey arm64 added |
---|---|
Owner: | set to MarcusCalhoun-Lopez |
Status: | new → assigned |
comment:2 Changed 3 years 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 3 years 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 3 years ago by mojca (Mojca Miklavec)
Cc: | mojca added |
---|
comment:5 Changed 3 years 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
comment:6 Changed 2 years ago by mojca (Mojca Miklavec)
I desperately needed a functional binary, so I tried to create a -devel subport which successfully built for me on M1 without any patches: https://github.com/macports/macports-ports/pull/14952
It's not in ideal shape yet, but maybe some brainstorming together will eventually help us come up with a better solution.
comment:7 Changed 2 years ago by mojca (Mojca Miklavec)
The problem quoted above can apparently be solved with
use_autoconf yes autoconf.cmd autoreconf -ivf
I reported this upstream and they'll try to check whether they could update their tools.
Now, building version 6.12.0.122 with autoreconf
doesn't really help: there's a segmentation fault somewhere in the build process. But note that the official page now lists 6.12.0.179 as the latest version, and a binary download of the stable version will give you that one.
The sources for that version on the other hand only fly to preview/
(upstream isn't sure why, they'll investigate).
I was checking what HB does and it doesn't seem like they would be using any heavy duty patches, so I thought that maybe 6.12 might work as well.
From what I understood, the only reason why mono isn't releasing a newer official stable version is because tons of other dependencies need to be updated as well, and with Microsoft migrating to dotnet 6 as a replacement for Mono, there's no longer so much demand and no longer any such strong checks as there used to be.
comment:8 Changed 2 years ago by mojca (Mojca Miklavec)
Building a newer version from the "preview" branch requires patching our patches, so I couldn't do a quick test yet to check whether it's passing.
comment:9 Changed 2 years ago by Mojca Miklavec <mojca@…>
comment:10 Changed 2 years ago by mojca (Mojca Miklavec)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I made a mistake of forgetting to squash/finalize the commits and properly referencing this ticket after a long wait for feedback. But the problem should be fixed now.
main.log from MacPorts containing the error.