facebook-sdk-for-unity icon indicating copy to clipboard operation
facebook-sdk-for-unity copied to clipboard

Build fails when i build for iOS in XCode due to missing library

Open codelazarus opened this issue 4 years ago • 22 comments

Checklist

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| version 9.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. Screen Shot 2020-05-24 at 9 45 01

codelazarus avatar May 24 '20 16:05 codelazarus

Same Error

baksarbed avatar May 25 '20 07:05 baksarbed

I get the same error too.

restricted-mode4 avatar May 26 '20 14:05 restricted-mode4

Same Error, Unity 2019.3

wagenheimer avatar May 28 '20 05:05 wagenheimer

Same Here, Unity 2019.3 I tried to roll back to the previous SDK version but 999+ warnings, 93 errors.

WizardingStudios avatar May 31 '20 20:05 WizardingStudios

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.

MaxGuernseyIII avatar Jun 07 '20 16:06 MaxGuernseyIII

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.

MaxGuernseyIII avatar Jun 07 '20 16:06 MaxGuernseyIII

Can you try running pod install in the exported project?

KylinChang avatar Jun 11 '20 21:06 KylinChang

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?

KylinChang avatar Jun 11 '20 21:06 KylinChang

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.

MaxGuernseyIII avatar Jun 12 '20 05:06 MaxGuernseyIII

@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.

MaxGuernseyIII avatar Jun 12 '20 05:06 MaxGuernseyIII

@KylinChang Do you have the information you need? @codelazarus Have you found any way to make this work?

MaxGuernseyIII avatar Jun 17 '20 03:06 MaxGuernseyIII

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

image

Hope this helps anyone else as well

brogan89 avatar Jun 19 '20 02:06 brogan89

@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?

pistoleta avatar Jun 19 '20 16:06 pistoleta

@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 avatar Jun 19 '20 19:06 brogan89

@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.

Riderrr avatar Jul 02 '20 12:07 Riderrr

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.

LaCreArthur avatar Sep 04 '20 07:09 LaCreArthur

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"
image

but i havnt fixed it

zhangjianshuai avatar Feb 20 '21 08:02 zhangjianshuai

It is actually an annoying bug because some CI treats it as error and fail.

iyakov avatar Mar 22 '21 15:03 iyakov

Still facing it with SDK 11.0

dinukapj avatar Aug 04 '21 03:08 dinukapj

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.

xxluky avatar Aug 07 '21 21:08 xxluky

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.

chandujr avatar Sep 01 '21 10:09 chandujr

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).

jcox-playq avatar Sep 09 '21 18:09 jcox-playq