facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
Build fails when i build for iOS in XCode due to missing library
Checklist
- [x] I've updated to the latest released version of the SDK
- [x] I've searched for existing GitHub issues
- [x] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [x] I've read the Code of Conduct
- [x] This issue is not security related and can safely be disclosed publicly on GitHub
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
- Unity Editor Version:
2019.2.7
- Unity SDK Version:
7.19.2
- Installation Platform & Verison:
[iOS|
version9.0 and higher
Goals
I want the build to succeed
Expected Results
I want to archive my game in XCode
Actual Results
When I'm building in XCode the build fails due to missing libraries FBSDKShareKit
Steps to Reproduce
I download the Facebook SDK for Unity v7.19.2 and import that package in Unity 2019.2.7 and then add sample code in my Start() in Unity class when the game starts. And then i make a build for iOS which succeed, then i open the build in XCode and i want to archive the game but it fails due to missing library FBSDKShareKit in class "FBUnitySDKDelegate.h" line 19.
Same Error
I get the same error too.
Same Error, Unity 2019.3
Same Here, Unity 2019.3 I tried to roll back to the previous SDK version but 999+ warnings, 93 errors.
I have this exact problem. I do my Unity build on a Windows machine and my Xcode compile on a hosted Mac in Azure DevOps.
Also, I have tried several older versions of the SDK without any effect. I tried doing a pod install and the impact of that was that it moved the error a little bit further down the road - it became a linker error instead of a compiler error.
Can you try running pod install
in the exported project?
Also, I have tried several older versions of the SDK without any effect. I tried doing a pod install and the impact of that was that it moved the error a little bit further down the road - it became a linker error instead of a compiler error.
What's the link error?
From @KylinChang:
What's the link error?
I've tried many things but the one that converted the error to a linker error was this:
'/usr/local/lib/ruby/gems/2.6.0/bin/pod install --project-directory=/Users/runner/runners/2.169.1/work/1/AppleAppStoreXCodeProject'
The linker error was 'ld: library not found for -lFBSDKCoreKit'.
It came after some warnings:
ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FBSDKCoreKit' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FBSDKLoginKit' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FBSDKShareKit' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FirebaseCore' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FirebaseCoreDiagnostics' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FirebaseInstanceID' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/FirebaseMessaging' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/GoogleDataTransport' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/GoogleDataTransportCCTSupport' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/GoogleUtilities' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/PromisesObjC' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/Protobuf' ld: warning: directory not found for option '-L/Users/runner/Library/Developer/Xcode/DerivedData/Unity-iPhone-dhogmexjygvcffaxtqxkhvbrsvoj/Build/Products/Release-iphoneos/nanopb' ld: library not found for -lFBSDKCoreKit
I don't know how common my case is, though. The Unity compile occurs on a Windows box because that's where I have Unity. The XCode compile occurs on a hosted mac within an Azure DevOps pipeline because that's where I have access to a mac.
@KylinChang asked:
Can you try running
pod install
in the exported project?
I did. I tried it against several different places in the exported folder. Most of the time, it generated a new .xcworkspace that no longer contained signing information. I could compile the resulting .xcworkspace but, since it lacked all the signing info, I couldn't produce a meaningful package from it.
@KylinChang Do you have the information you need? @codelazarus Have you found any way to make this work?
I was having this issue as well but came across this thread which helped.
I just needed to check Podfile Generation
in the iOS Resolver Settings in Assets > External Dependency Manager > iOS Resolver > Settings
Hope this helps anyone else as well
@brogan89 I have the same settings than you. I can build but I get the exception on unity: FileNotFoundException: Could not find file "......Libraries/RegisterMonoModules.h" Do you get this?
@brogan89 I have the same settings than you. I can build but I get the exception on unity: FileNotFoundException: Could not find file "......Libraries/RegisterMonoModules.h" Do you get this?
I did not get this sorry no. I use Unity Cloud Build so I'm assuming they have everything set up on build servers. But at a guess it looks like a mono issue. Ensure Mono is installed on machine
@brogan89 I have the same settings than you. I can build but I get the exception on unity: FileNotFoundException: Could not find file "......Libraries/RegisterMonoModules.h" Do you get this?
Hi, to fix it, just add the empty file with such name and path into the Unity setup folder. After first build you get the error in xCode: smth like there is no such header file. Just remove this include.
Just to let you know that I have the exact same issue with : Unity Editor Version: 2020.1.4 Facebook SDK Version: 7.21.2
I could build perfectly before importing the FB SDK, now I can't with the same "missing library FBSDKShareKit in class "FBUnitySDKDelegate.h" line 19."
Already checked, the Podfile Generation was enable by default.
FileNotFoundException: Could not find file "/Users/jens/Documents/AMS/DevBranch/Client/Game/Game/Podfile". System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:232) System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:144) (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool) System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:240) System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:221) System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:202) System.IO.StreamReader..ctor (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:182) (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string) System.IO.File.ReadAllText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:550) Facebook.Unity.Editor.XCodePostProcess.PostProcessBuild_iOS (UnityEditor.BuildTarget target, System.String buildPath) (at <9f12adda19004bfebbea312055e90c78>:0) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at
from this log, can know it's beacuse "Facebook.Unity.Editor.XCodePostProcess.PostProcessBuild_iOS"
but i havnt fixed it
It is actually an annoying bug because some CI treats it as error and fail.
Still facing it with SDK 11.0
Same problem here. Unity 2020.1.13. FB SDK 11.0. I have Podfile Generation enabled. Cocoapods Integration: Xcode Project. I also runned commands "sudo gem install cocoapods" and "pod setup".
I'd like to add that I had a problem importing the plugin. I have Play Games plugin (https://github.com/playgameservices/play-games-plugin-for-unity) in my game as well. Dependency Manager had some difficulties with both of the plugins. But I finally solved it.
Stupid SDK. Spent hours fixing the bug but no luck.
Check if there are any Cocoapods error in Unity after build has finished. Sometimes Cocoapods won't generate the .xcworkspace
file in the Xcode project folder because of these errors and you might accidentally open the .xcodeproj
file. Make sure .xcworkspace
is generated and you are opening that.
For us (Unity 2020.3.14, FB SDK 11.0), none of the above worked since we were actually doing all of these things already, but manually updating the pods dependencies to 11.1 did result in working builds (as recommended in this thread https://github.com/facebook/facebook-sdk-for-unity/issues/578).