-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS and iOS arch build behavior does not match Godot upstream #1633
Comments
I just tested exports on macOS. When using feature tags, in-editor it tries to load the binary for the matching architecture (i.e. This means that if we want to move to building the arches separately, we need to either patch godot-upstream to handle arch-separate binary exports, or |
I think universal builds will be completely deprecated soon as apple stop supporting intel Mac. As far as I understand modern "frameworks" format should support using different libraries for different architectures, and Apple is trying really hard to force everyone to use frameworks for everything. I don't think it's worth doing the lipo part in the godot-cpp build system because that won't include any third party dependency (which the user would likely have to lipo manually like we do for webrtc-native). In the end, I think the solution is to start defaulting to arm64 (or auto-detect if building from macOS directly), and update the examples to use a multi-arch framework (we should confirm this is actually doable, I don't have a Mac, and I'm not an Apple fan as you've probably guessed, so I can't really verify any of this as their documentation is close to non-existent). |
Deprecated perhaps, but while Apple's support is a decent guideline for what Godot should support, there are still a lot of intel macs in circulation (and will be for a while). (speaking of which, this may be a good question to add for the next Godot user survey...)
If I understand correctly, you're hoping we can find a way to bundle the frameworks with separate binaries for separate arches? I'm not sure that's possible, but I'm also not deeply familiar with framework bundles in the first place. Apple seems to prefer creating universal bundles. I don't see anything wrong with doing a |
I'm not sure how that would help, the GH artifacts are not supposed to be used by extension developers, but yeah, we can totally add the lipo step there.
Yeah, I think that's fine. We don't have to necessarily remove the "universal" option, we can just change the default (but I'm not against removal) |
Ah, i'm just proposing to do that for releases (ie. The GitHub runner). For local builds non-universal binaries are of course totally fine. And yeah i agree there's no reason to remove the universal build option! I'm happy to take on the next steps. Building arches on the GitHub runner separately can be done now (edit: actually godotengine/godot-cpp-template#55 should be addressed first). Changing the default to use the local arch should probably wait until godotengine/godot#98809 is merged, just to avoid somebody accidentally creating a non exportable build. |
Again, not sure why you call them releases, the artifacts are not released in any way. |
I guess that's correct, though I'm not sure what else the artifacts would be used for? I use the github runner from godot-cpp-template to create binaries for my GDExtension, which I can publish as a release. Does that clear it up? |
Mostly for debugging CI issues themselves.
Yeah, I think it makes sense to have that for the godot-cpp-template since I assume people will rely on the CI file from that repository as a template for CI builds. |
Let me know if you need help on the CMake side of things, I can help mirror whatever the process outcome is. |
We recently found in a discussion that godot-cpp arch build behavior does not match Godot upstream.
In particular, godot-cpp defaults to building universal binaries (which passes the appropriate flags to the compiler to build both). The gdextension usually loads the same binary for both
arm64
andx86_64
(as per godot-cpp-template).Godot, on the other hand, builds
arm64
andx86_64
separately and joins them afterwards withlipo
. It does not support a 'universal' arch target.One problem with the
universal
approach used by godot-cpp is that for universal builds, no architecture-specific build flags can be passed to the compilers (such as-mavx
), because then the other architecture won't build (e.g.-mavx
is not arm64 compatible). Notably, godot-cpp already supports compiling for the arches separately.Changing the default behavior would affect all current macOS compatible godot-cpp extensions, because they will (likely) build with the default
universal
target right now (as per godot-cpp-template). We will have to figure out whether a change to separate the binaries will affect exports, especially for universal macOS apps.We discussed this briefly at the last GDExtension meeting, and would like to have input on this before proceeding (especially from @Faless).
The text was updated successfully, but these errors were encountered: