godotengine / godot-ios-plugins

MIT License
126 stars 48 forks source link

gamecenter generate_xcframework error when building modules GameKit and simd #56

Open sourencho opened 8 months ago

sourencho commented 8 months ago

I'm trying to build the plugin libraries on a Apple M1 running Sanoma 14.0 and Xcode 15.0 but I run into an error at the generate_xcframework step.

Here are the steps I took:

  1. scons platform=ios target=editor
  2. scons target=editor arch=arm64 simulator=no plugin=gamecenter version=4.1.3
  3. ./scripts/generate_xcframework.sh gamecenter debug 4.0
    ~ godot-ios-plugins git:(master) ✗
    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    g++ -o plugins/gamecenter/game_center_module.o -c -gdwarf-2 -O0 -DDEBUG_MEMORY_ALLOC -DDISABLE_FORCED_INLINE -D_DEBUG -DDEBUG=1 -DDEBUG_ENABLED -DVULKAN_ENABLED -std=gnu++17 -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch arm64 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/ios plugins/gamecenter/game_center_module.cpp
    g++ -o plugins/gamecenter/game_center.o -c -gdwarf-2 -O0 -DDEBUG_MEMORY_ALLOC -DDISABLE_FORCED_INLINE -D_DEBUG -DDEBUG=1 -DDEBUG_ENABLED -DVULKAN_ENABLED -std=gnu++17 -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch arm64 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/ios plugins/gamecenter/game_center.mm
    scons: `bin/libgamecenter.arm64-ios.debug.a' is up to date.
    scons: done building targets.
    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    g++ -o plugins/gamecenter/game_center_module.o -c -gdwarf-2 -O0 -DDEBUG_MEMORY_ALLOC -DDISABLE_FORCED_INLINE -D_DEBUG -DDEBUG=1 -DDEBUG_ENABLED -DVULKAN_ENABLED -std=gnu++17 -fno-aligned-allocation -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch armv7 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/ios plugins/gamecenter/game_center_module.cpp
    g++ -o plugins/gamecenter/game_center.o -c -gdwarf-2 -O0 -DDEBUG_MEMORY_ALLOC -DDISABLE_FORCED_INLINE -D_DEBUG -DDEBUG=1 -DDEBUG_ENABLED -DVULKAN_ENABLED -std=gnu++17 -fno-aligned-allocation -DNEED_LONG_INT -DLIBYUV_DISABLE_NEON -DIOS_ENABLED -DUNIX_ENABLED -DCOREAUDIO_ENABLED -fmodules -fcxx-modules -miphoneos-version-min=10.0 -fobjc-arc -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -fno-exceptions -Wno-ambiguous-macro -Wall -Werror=return-type -arch armv7 -isysroot -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -DPTRCALL_ENABLED -I. -Igodot -Igodot/platform/ios plugins/gamecenter/game_center.mm
    While building module 'GameKit' imported from plugins/gamecenter/game_center_delegate.h:31:
    While building module 'simd' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/GameKit.framework/Headers/GameKit.h:3:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr/include/simd/simd.h:23:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr/include/simd/matrix.h:1105:25: error: use of undeclared identifier 'vzip1q_f32'; did you mean 'vzipq_f32'? [2]
     simd_float4 __r01 = vzip1q_f32(__x0, __x1);
                         ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/arm_neon.h:32079:20: note: 'vzipq_f32' declared here [2]
    __ai float32x4x2_t vzipq_f32(float32x4_t __p0, float32x4_t __p1) {
                    ^
                    ....

Someone posted this on apple forums claiming that the issue is on apple's end, but I wanted to double check here. https://developer.apple.com/forums/thread/740770?login=true&page=1#770668022

nicoformaggio commented 8 months ago

I just saw this on the Godot 4 issue thread but thought I'd respond here as it's more relevant. I have not found a workaround yet as it seems to be an Apple SDK issue because it's to do with the import of GameKit.h.

I also tested this with Godot 3.5 and got the same issue, if I can find a way to rollback the iOS SDK version I might try that and see if it works.

bruvzg commented 8 months ago

https://github.com/godotengine/godot-ios-plugins/blob/fc5952a1400a56aee49f8020aaaca910a98b36fb/scripts/generate_xcframework.sh#L9

Seems like scripts still include armv7, and Xcode 15 doesn't have support for 32-bit iOS anymore. Godot is also built without 32-bit support, so it should be removed.

nicoformaggio commented 8 months ago

Just removed all reference to armv7 in code and it works now! Thank you so much.

sourencho commented 8 months ago

@nicoformaggio oh nice! Can you share your diff so I can fix it on my end too?