-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
[iOS] Fix dotnet export. #84945
[iOS] Fix dotnet export. #84945
Conversation
baaa08f
to
b99b5c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't test this since I don't have a macOS device, but the code looks good to me. Maybe @shana can also review this.
@@ -195,7 +195,7 @@ public static void CompileAssembliesForiOS(ExportPlugin exporter, bool isDebug, | |||
bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator | |||
string versionMinName = isSim ? "iphonesimulator" : "iphoneos"; | |||
string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS"; | |||
const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting | |||
const string versionMin = "12.0"; // TODO: Turn this hard-coded version into an exporter setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not using the AotBuilder
class, it's a remnant from Godot 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove unused classes (not in this PR), they can always be brought back from the Git history if needed in the future.
@@ -194,7 +194,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long | |||
BundleOutputs = false, | |||
IncludeDebugSymbols = publishConfig.IncludeDebugSymbols, | |||
RidOS = OS.DotNetOS.iOSSimulator, | |||
UseTempDir = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm testing this right now, and the problem is not the temp dir output, the problem is that the xcframework command should not be including the library argument that's pointing to the temp dir. The simulator dylib should be already lipo'd into the non-simulator dylib, so there should be no references to the simulator dylib anymore. This might look like it fixes things, but it's not the correct fix here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simulator dylib should be already lipo'd into the non-simulator dylib
This is impossible, simulator lib can't be lipoed with non simulator lib since both contain arm64 code, that's the only season xcframeworks exist in a first place (merging libs for the different platform but the same architecture).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mispoke, the x64 and arm64 simulator dylibs are lipo'd together, and the lipo result is what we want, not the separate dylibs. This is not where the fix should be, the fix is where the lipo happens for iOS, where the output paths are adjusted for creating the framework.
This is the correct fix for the problem where the xcframework fails to be created properly: https://github.com/godotengine/godot/compare/master...shana:godot:fix-ios-dotnet-export?diff=unified
Could you add a comment on this line that this is a temporary fix with a link to this PR, so we don't forget to fix it up properly?
I made a test build from this PR to help testing, especially if we can find someone who still has Xcode < 15 to verify that makes things work for Xcode 15 didn't break assumptions for older versions: https://downloads.tuxfamily.org/godotengine/testing/4.2-beta6-pr84945/ It's a build from latest |
I think I have also found the reason for another issue (#82729 (review)) which is preventing full archive/IPA export from the editor, and only allowing exporting Xcode project. The AOT xcframework have the same name as the main Godot library ( |
b99b5c4
to
a92511f
Compare
@@ -361,7 +361,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long | |||
} | |||
|
|||
var xcFrameworkPath = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, publishConfig.BuildConfig, | |||
$"{GodotSharpDirs.ProjectAssemblyName}.xcframework"); | |||
$"{GodotSharpDirs.ProjectAssemblyName}_aot.xcframework"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reference, this is the only changed line in the last push. Added to fix name conflict (#82729 (review)) and should not have any effect on the rest of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran into the same export problem with the naming conflict, it's an Xcode 15 thing, apparently. This fixes it 👍
@bruvzg @akien-mga @raulsntos I pushed a more long term fix for the temp paths breaking the xcframework generation (https://github.com/godotengine/godot/compare/master...shana:godot:fix-ios-dotnet-export?diff=unified), but not using temp dirs for any of the iOS exports is a safe fix right now, even if it does generate more garbage, so 👍 for my side. |
I can confirm this also works fine (in place of |
Thanks everyone for the quick turnaround! |
Fixes #83628
xcframework
build..xarchive
and.ipa
(with "Export Project Only" unchecked).