godotengine/build-containers

Build failure with Mono 6.12.0.144 and backported Apple M1 support using `_builtin_available(macOS 11, *)`

akien-mga opened this issue · 2 comments

We already solved this in chat back in May and in #80, but opening this issue to document it in a searchable way (as I was updating #80 and couldn't remember right away why those changes had been done, so this will serve as documentation for future self).

When I tried to build Mono 6.12.0.144 with recent osxcross and Xcode 12.4, I ran into an linker error for this code:
https://github.com/mono/mono/blob/35bf914659f88753c1c080c125164fc878645c74/mono/utils/mono-codeman.c#L670

Undefined symbols for architecture x86_64:
  "___isPlatformVersionAtLeast", referenced from:

Here's the discussion we had on Rocket.Chat with @bruvzg: https://chat.godotengine.org/channel/rendering?msg=LzakC8HR2SQDCFGQn

Eventually we opened an issue upstream and found that it could be solved by compiling compiler-rt: tpoechtrager/osxcross#278

Some other findings from the discussion which might warrant changes to our build scripts:

  • Mono has MACOS_VERSION_MIN and IOS_VERSION_MIN Makefile defines which we don't set currently, and they default to versions older than what we target as min in Godot. This might be worth updating.
  • For iOS we don't use Mono's Makefiles directly though as we go through godot-mono-builds, so this should be set instead: https://github.com/godotengine/godot-mono-builds/blob/c3a9d311bcb49ccb498a722f451ac6845b52c97e/ios.py#L509
  • If we change macOS builds to use godot-mono-builds, there doesn't seem to be an equivalent option, needs review.

Is this what is needed in the godot-mono-builds scripts?
godotengine/godot-mono-builds#45

NOTE: I haven't tested those changes as I don't have a osxcross build environment set up.

That looks good, I'll give it a try tomorrow.