Skip to content
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

Exporting an iOS plugin with debug configuration causes symbol not found compile error #91583

Closed
webair opened this issue May 5, 2024 · 4 comments
Labels

Comments

@webair
Copy link
Contributor

webair commented May 5, 2024

Tested versions

v4.2.1.stable.official [b09f793]

System information

Godot v4.2.1.stable - macOS 14.4.0 - Vulkan (Mobile) - integrated Apple M2 - Apple M2 (8 Threads)

Issue description

I'm creating an iOS plugin for Godot based on the project godot-ios-inapp-review-plugin as template. I managed to build the plugin successfully using the 'release' configuration. But unfortunately i am not able to compile the resulting xcode project when exporting with 'debug' configuration. i receive following error:

Undefined symbol: ClassDB::bind_methodfi(unsigned int, MethodBind*, bool, char const*, Variant const**, int)
Linker command failed with exit code 1 (use -v to see invocation)

I tried to resolve the issue but i am a little lost. Has anyone a hint for me?

Steps to reproduce

  • Create a godot project using godot 4.2.1
  • Install export template for ios (Valid 'App Store Team ID' and 'Bundle Identifier' required)
  • Download ios.zip and extract it in root of project
  • In the iOS export settings under plugins activate the 'QrCodeScanner" Plugin
  • Export project using "Export with Debug"
  • Try to compile with exported Xcode project

Minimal reproduction project (MRP)

N/A

@TheOathMan
Copy link

Same issue.

Official ios Plugins was tested with Godot v4.2.2.stable.official, and asset store ones (share plugin)

System:
MacBook Air (13-inch, 2017)
Mac version 12.6.2
Xcode version: Version 14.2

The build failed while building archive in Godot. In Xcode, failed during build (when 'Export Project only' is Enabled from Godot export settings).

The following build commands failed: Ld /Users/main/Library/Developer/Xcode/DerivedData/testingg-gvofzswuhtpjdaeytstoiuocytua/Build/Intermediates.noindex/ArchiveIntermediates/testingg/InstallationBuildProductsLocation/Applications/testingg.app/testingg normal (in target 'testingg' from project 'testingg') (1 failure)

This is while building on Godot. But Xcode gave extra details:

clang: error: no such file or directory: '/Users/main/Desktop/Godot_Builds/forXcode/testingg/ios/plugins/SharePlugin.release.a'

@webair
Copy link
Contributor Author

webair commented May 6, 2024

@TheOathMan I think the share plugin has an other issue. According to the error message it seems like that the static library for SharePlugin.release.a is missing.

Since I am currently focusing on the iOS plugin build process, I may be able to help resolving the issue here.

@TheOathMan
Copy link

TheOathMan commented May 6, 2024

@TheOathMan I think the share plugin has an other issue. According to the error message it seems like that the static library for SharePlugin.release.a is missing.

Since I am currently focusing on the iOS plugin build process, I may be able to help resolving the issue here.

The issue you have and the issue I have are exactly the same but the error messages isn't clear.
When we try to build an ios plugin, we usually include Godot headers. These headers include c++ debug or deprecated declarations that are not implemented in the final build. Specifically from object.h (maybe from other headers as well). So when we include the plugin, and we start the export, the linker starts to look for the implementation for these included declarations but doesn't find them.

Right now, I was able to solve your issues by declaring these macros right before I include object.h:

#define DISABLE_DEPRECATED
#define DEBUG_METHODS_ENABLED

#include "core/object/object.h"

Which will exclude deprecated and include debug declarations. That will solve

Undefined symbol: ClassDB::bind_methodfi(unsigned int, MethodBind*, bool, char const*, Variant const**, int)
Which is a debug method declaration

@webair
Copy link
Contributor Author

webair commented May 6, 2024

@TheOathMan Thanks for clarification! This actually led me to the solution. ;) I simply needed to add the variable GCC_PREPROCESSOR_DEFINITIONS="DEBUG_ENABLED=1" in the xcodebuild commands for the debug builds. So my xcodebuild for debug framework looks like this now:

    xcodebuild clean archive \
        -project "${xcodeproj_dir}" \
        -scheme "${plugin_name}" \
        -archivePath "${out_lib_dir}/ios_debug.xcarchive" \
        -sdk iphoneos \
        SKIP_INSTALL=NO \
        GCC_PREPROCESSOR_DEFINITIONS="DEBUG_ENABLED=1"

Thanks again and hope this helps to resovle your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants