naithar / godot_ios_plugin

23 stars 7 forks source link

Can't run exported project #1

Closed svprdga closed 3 years ago

svprdga commented 3 years ago

Hi, I'm trying to use this starter kit in order to create an iOS plugin, but I can't run the final exported project.

These are the steps I'm following:

I have two errors when try to run the project:

Building for iOS, but the linked library 'plugin.a' was built for iOS Simulator. (in target 'IosPlugin' from project 'IosPlugin')

The linked library 'IosPlugin.a' is missing one or more architectures required by this target: armv7. (in target 'IosPlugin' from project 'IosPlugin'

Thanks in advance.

naithar commented 3 years ago

Building for iOS, but the linked library 'plugin.a' was built for iOS Simulator. (in target 'IosPlugin' from project 'IosPlugin')

Your .a static library doesn't have required architectures.

You have to build .a for both simulator and device and make fat library out of them. Or you can generate xcframework from resulting .a files. You can also use Scons to generate full set of libraries for simulator (x86_64, arm64) and device (arm64, armv7) and use xcodebuild to generate xcframework - example script

svprdga commented 3 years ago

Ok, I'm trying to use Scons to generate everything,

I have tried: ./scripts/generate_xcframework.sh plugin_example release_debug 3.2 ./scripts/generate_xcframework.sh plugin_example release 3.2 ./scripts/generate_xcframework.sh plugin_example debug 3.2

All the time is failing with:

scons: Reading SConscript files ... No valid target name. scons: Reading SConscript files ... No valid target name. scons: Reading SConscript files ... No valid target name. scons: Reading SConscript files ... No valid target name. fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: ./bin/libplugin_example.x86_64-simulator.release_debug.a (No such file or directory)

naithar commented 3 years ago

Error is pretty much self explanatory. You are passing wrong parameters to Scons through script. You have to modify generate_xcframework.sh for it to work with this repo's Scons file. Currently you are trying to use script specific for official plugins for something else.

For example change scons target=$2 arch=arm64 plugin=$1 version=$3 to scons target=$2 arch=arm64 target_name=$1 version=$3. You should do it for every Scons line in the script.

Also you will have to modify gdip configuration file for it to accept xcframework.

svprdga commented 3 years ago

Great, now it's working, thank you.

anisc commented 2 years ago

Hi, I'm trying to use this starter kit in order to create an iOS plugin, but I can't run the final exported project.

These are the steps I'm following:

* Download the starter kit

* Copy Godot source (3.3.2) in `/godot` folder

* Run `scons platform=iphone target=release` in `/godot` folder

* Run XCode project to generate the library file `libgodot_plugin.a`

* Move `.a` file and `.gdip` file to Godot’s root project `/plugins/ios`

* Export project (with Plugin Example enabled) - Godot detects it as it doesn’t show any errors

* Open exported project in XCode, try to run it in a real device

I have two errors when try to run the project:

Building for iOS, but the linked library 'plugin.a' was built for iOS Simulator. (in target 'IosPlugin' from project 'IosPlugin')

The linked library 'IosPlugin.a' is missing one or more architectures required by this target: armv7. (in target 'IosPlugin' from project 'IosPlugin'

Thanks in advance.

This helped me a lot, probably should be included in the README.