2shady4u / godot-sqlite

GDExtension wrapper for SQLite (Godot 4.x+)
MIT License
895 stars 79 forks source link

App validation errors when submitting to App Store on Xcode 15.4 #181

Open Pulstarter opened 1 month ago

Pulstarter commented 1 month ago

Environment:

Issue description: When trying to upload a release app to App Store, validation fails with these errors:

Asset validation failed This bundle is invalid. The bundle at path Payload/sqlite.app/Frameworks/libgdsqlite.ios.template_release.arm64.framework has an invalid CFBundleIdentifier 'com.gdextension.framework.libgdsqlite.ios.template_release.arm64' There are invalid characters(characters that are not dots, hyphen and alphanumerics) that have been replaced with their code point 'com.gdextension.framework.libgdsqlite.ios.template\u005frelease.arm64' CFBundleIdentifier must be present, must contain only alphanumerics, dots, hyphens and must not end with a dot. [see the Core Foundation Keys at https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102070-TPXREF105] (ID: e8319f15-7e57-4937-a351-36c53c0433dc)

Asset validation failed Invalid Bundle. The bundle sqlite.app/Frameworks/libgdsqlite.ios.template_release.arm64.framework does not support the minimum OS Version specified in the Info.plist. (ID: 38532462-c628-4c17-9cf3-d706966b604c)

Steps to reproduce: 1.- Create new app in Godot 4.2.2 and make an empty scene for testing. 2.- Install godot-sqlite plugin from the AssetLib and activate. 3.- Export the app with IOS preset just filling App Store Team ID and Bundle Indentifier. 4.- Uncheck "Export with debug" 5.- Open the exported projects in Xcode and exec "Product -> Archive" 6.- When finish, press "Validate App" in the archives section.

Minimal reproduction project: Just a new Godot 4.2.2 Project.

Additional context The MinimumOSVersion in the global project is 12.0, but if we read this file:

/sqlite/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.framework/Info.plist

we can find that this key is 10.0

MinimumOSVersion 10.0
2shady4u commented 1 month ago

Hello @Pulstarter

There are two possibilities:

2shady4u commented 1 month ago

Hello 😄 I rebuild the iOS libraries using the latest macos runner: https://github.com/2shady4u/godot-sqlite/actions/runs/9981544572

Could you check if that binary works better?

Pulstarter commented 1 month ago

Thanks a lot for your effort and your package. However the result is the same. I have updated these files:

MD5 (libgdsqlite.ios.template_release.arm64.dylib) = b77482b71642b51a099656a8e85f24a1 MD5 (libgdsqlite.ios.template_debug.arm64.dylib) = 16fcfbf8959fbb453cfee5858b2ae101

And the messages are the same. I test to do not embed and sign the libdgsqlite.ios.template_release.arm64.framework in Xcode -> General -> Sqliteapp -> Frameworks, Libraries and Embedded Content, and the validation pass, but the app crashes at startup with an error. I know that it does not mean anything, but I paste it anyway :-D

dyld`:
    0x1b11decd0 <+0>:  mov    x16, #0x209
    0x1b11decd4 <+4>:  svc    #0x80
->  0x1b11decd8 <+8>:  b.lo   0x1b11decf8               ; <+40>
    0x1b11decdc <+12>: pacibsp 
    0x1b11dece0 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b11dece4 <+20>: mov    x29, sp
    0x1b11dece8 <+24>: bl     0x1b1176618               ; cerror_nocancel
    0x1b11decec <+28>: mov    sp, x29
    0x1b11decf0 <+32>: ldp    x29, x30, [sp], #0x10
    0x1b11decf4 <+36>: retab  
    0x1b11decf8 <+40>: ret   

Best regards.

2shady4u commented 1 month ago

Hello @Pulstarter,

Here's another attempt at fixing the issue where I have modified the build system to:

Would it be possible to try with these new binaries? They can be downloaded here: https://github.com/2shady4u/godot-sqlite/actions/runs/10003299615

Pulstarter commented 1 month ago

Hi! I am very sorry to bother your with this, but I don't know how to apply these last binaries to the current project. Do I need to add them in Xcode or in the addons folder?

Thanks

2shady4u commented 1 month ago

Hi! I am very sorry to bother your with this, but I don't know how to apply these last binaries to the current project. Do I need to add them in Xcode or in the addons folder?

Thanks

Hello! It should be in the addons/godot-sqlite/bin/-folder :)

Also you'll have to update the gdsqlite.gdextension-file, see here: https://github.com/2shady4u/godot-sqlite/blob/feature/attempt-ios-fix/demo/addons/godot-sqlite/gdsqlite.gdextension

Pulstarter commented 1 month ago

Hi! Thanks a lot. Unfortunately it does not work, but the error messages are different:

Asset validation failed Unexpected file found in Frameworks. The “sqliteapp.app/Frameworks/libgodot-cpp.ios.template_debug.arm64.a, sqliteapp.app/Frameworks/libgdsqlite.ios.template_release.a” file is in the Frameworks directory, but the Swift runtime libraries are the only files permitted in that directory. Please remove this file and upload a new build. (ID: c6fa5985-b911-4b71-9d03-b29c4f5dc74a)

Asset validation failed Invalid bundle structure. The “sqliteapp.app/Frameworks/libgodot-cpp.ios.template_debug.arm64.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: e2137553-807b-4661-a432-3720a4662110)

Asset validation failed Invalid bundle structure. The “sqliteapp.app/Frameworks/libgdsqlite.ios.template_release.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: 02c54643-e379-4645-b0d4-48239ad8bff0)

If I don't embed them, I get a differente error too when running the app.

Hope it helps

2shady4u commented 1 month ago

Hi @Pulstarter :/

I am at a loss atm... I made a new issue in the godot-cpp repository since they might better know how to help you: https://github.com/godotengine/godot-cpp/issues/1532

Please feel free to add more information or correct me if I wrote something wrong in that issue.

Pulstarter commented 1 month ago

Hi again! First thank you for all the effort. Here's One little update. I have updated the filename for ios on the gdsqlite.gdextension file. I removed the underscore (release_) on both files and now their names are:

ios.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.dylib"
ios.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.release.arm64.dylib"

Now when archive on xcode and test the app only appears this error:

**Invalid Bundle. The bundle sqlitetest.app/Frameworks/libgdsqlite.ios.release.arm64.framework does not support the minimum OS Version specified in the Info.plist. (ID: 4a0d8426-505f-4c40-9e11-7ba4055c06ba)**

I test with both original files and modified ones and the result is the same. I see that on this path:

<export_path>/SqliteTest/sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.release.arm64.framework

there is a file Info.plist with MinimumOSVersion -> 10.0, but on Xcode, minimun version is 12.0.

From here I don't know if you can do that this Info.plist target MinimumOSVersion 12.0 or is a Godot Engine task when exporting.

2shady4u commented 1 month ago

Maybe related: https://github.com/godotengine/godot/pull/84162

Pulstarter commented 1 month ago

Hi! I have tested it on Godot 4.3.beta3 and now it the Min IOS version is configurable in the editor. Now appear another error, but this is more related to the editor rather than the plugin:

ld: file cannot be mmap()ed, errno=22 path=sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.framework/libgdsqlite.ios.debug.arm64 in 'sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.framework/libgdsqlite.ios.debug.arm64' clang: error: linker command failed with exit code 1 (use -v to see invocation)

I see that there is an issue opened with the same problem:

https://github.com/godotengine/godot/issues/90168

So I think this one can be closed because it is not a problem of this plugin.

jgestiot commented 1 month ago

Can someone unsubscribe me from these threads? I have been trying for more than a year without success.

Cheers,

JG

On Sun, 21 Jul 2024 at 05:10, Piet Bronders @.***> wrote:

Hi @Pulstarter https://github.com/Pulstarter :/

I am at a loss atm... I made a new issue in the godot-cpp repository since they might better know how to help you: godotengine/godot-cpp#1532 https://github.com/godotengine/godot-cpp/issues/1532

Please feel free to add more information or correct me if I wrote something wrong in that issue.

— Reply to this email directly, view it on GitHub https://github.com/2shady4u/godot-sqlite/issues/181#issuecomment-2241264814, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOHKZAEMXIDDFO4LFGDG43ZNKYZJAVCNFSM6AAAAABK57RUVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGI3DIOBRGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

2shady4u commented 1 month ago

I think you change this behaviour when you click on the little arrow next to the "Watch" button image

IainBerliner commented 1 month ago

Hi all. I would like to show what I believe the issue to be and demonstrate what (I think) is the correct solution, which I found.

As Pulstarter noted, these are two separate problems, one of which can be solved simply by changing the "template_debug"/"template_release" folder name to "debug"/"release" without the underscore, and updating the file path in the gdsqlite.gdextension file to reflect this.

The other fix seems to be a linker-related issue. The way compiling for iOS works is that there is an SDK version that you compile from, but then a minimum iOS version that you link to, specified by the linker-flag -miphoneos-version-min. If this is not specified the minimum iOS version the binary links to defaults to the SDK version that you compiled with.

You can view the minimum iOS version that is being linked to with the command: "vtool -show libgdsqlite.ios.debug.arm64" on the binary, and this will confirm that the minimum version is not 12.0 like it should be.

BUT the fix is quite simple because linking happens at run-time and thus can be changed retroactively. All you need to do is run the following command on the binary:

"vtool -set-build-version ios 12.0 15.2 -tool -ld 711.0 -output libgdsqlite.ios.debug.arm64 libgdsqlite.ios.debug.arm64"

and you can set the minimum ios version that is linked to be 12.0 instead of 15.2.

A word of caution: this would not work on all binaries or automagically solve compatability issues if a binary uses features specific to a version higher than 12.0. But because this binary doesn't appear to do that, I think this is fine. But, I still haven't tested this on a 12.0 phone/simulator so I'm not going to claim this with 100% certainty.

ANOTHER step that is necessary is changing the minimum os version specified in the Info.plist file beside the binary in the exported project to be 12.0 as well, instead of the default 10.0. If you run the vtool command on the binary but forget to do this, you will still get the same error!

I'm not sure how this repository could be updated so these manual steps are not required, but I think a start would be setting the linker flag '-miphoneos-version-min=12.0' in the SConstruct file. There's the issue that Godot still might set the incorrect version in the generated Info.plist, meaning users will have to manually configure that every time they want to upload an iOS app containing this repository, but I wouldn't know how to solve that. There also remains the other, underscore-related issue causing validation errors, which requires manual-labor to fix.

If for some reason you are targeting a different minimum iOS version other than 12.0, these steps are the same, but substitute 12.0 in the steps for the minimum iOS version you targeting e.g. "13.0".

Hope that helps!

IainBerliner commented 2 weeks ago

FURTHER UPDATE:

I bought one month's worth of access to a real-device testing platform in order to test my app on different phone models (to get the scaling right) and also to ensure there were no compatibility issues (I was worried my workaround for getting this repository's binary to validate might cause issues).

What I discovered is that the "mobile" renderer has a minimum iOS version requirement of 16.0. I did not test the "forward+" renderer but I think this is the same as well. Then, the "compatibility" renderer has a minimum iOS version of 14.1. I couldn't test 14.0 as the real-device testing platform didn't have a phone with this version, all I know is 13.X all resulted in crashes on startup and 14.1+ didn't crash at all with the "compatability" renderer.

BUT in 0 cases were there any compatibility issues due to this code repository while employing the workaround that I have shared here for getting the app validation to work. All the crashes seem to have been due to the various Godot renderers being used on unsupported iOS versions, not this repository failing. My only recommendation would be that if anyone publishes a Godot app on iOS, they should keep in mind the minimum iOS compatibility version of the renderers (which I more or less found through trial-and-error).