Facebook-sdk-for-unity: Error while building 7.16.0 on Xcode 10

Created on 13 Jun 2019  ·  21Comments  ·  Source: facebook/facebook-sdk-for-unity

Hi ! It's been two days i'm trying to build for iOS and get stuck with a weird error :

clang: error: no such file or directory: 'iOS' clang: error: no such file or directory: 'Facebook/Frameworks/FacebookSDK/Plugins/iOS/FBSDKCoreKit.framework/FBSDKCoreKit' Command Ld failed with a nonzero exit code

I don't have any missing file, everything is present and I don't really understand, everything works fine on 7.15.0, what could have changed since?

Thanks in advance

Most helpful comment

@KylinChang after updating to 7.16.1, i couldn't build my project because of an error.

ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/xxx/Projects/XCodeProjects/zzz/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
objc-class-ref in libFirebaseCppApp.a(invites_receiver_internal_ios_aa7b75b2efc3269e88f1077e55250e5a.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

But, if i change -all_load to -force_load, it works fine.
I know this is firebase error, but everything works fine on 7.16.0, and having to edit the linker every time i build is not convenient. do you have any idea?

All 21 comments

Hi @daCelky, can you check whether FBSDKCoreKit exists under framework directory in your xcode project? It would be better if you can attach the structure of your FacebookSDK structure under framework directory.

Same issue here. I was using 7.15.1 and updated to 7.16.

I do have the file. below is the screenshot of my directory structure

Screen Shot 2019-06-15 at 2 52 38 PM

Yes everything exists in my framework directory.

Same issue here with 7.16 and Xcode 10.2.1.

I am facing the same issue with facebook sdk version 7.16 and Xcode 10.2.1.

clang: error: no such file or directory: 'Builds/0.0.1/Frameworks/FacebookSDK/Plugins/iOS/FBSDKCoreKit.framework/FBSDKCoreKit'

SDK v7.16.0、Unity 2018.3.0f2、Xcode 10.1(10B61)
Build Xcode project in Windows first, then transfer to Mac
Find a path in Xcode project settings, "Build Settings -> Other Linker Flags", has one line like "D:/XXXFrameworks/FacebookSDK/Plugins/iOS/FBSDKCoreKit.framework/FBSDKCoreKit"
Two questions:
1.It is a Windows path, not in Mac
2.With Unity2018, frameworks paths are simple, FBSDKCoreKit.framework in "Frameworks" directory, not in "Frameworks/FacebookSDK/Plugins/iOS/"

FIX: Change the path to "$(SRCROOT)/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit"

@daCelky does your build folder contain spaces?

@Snowblaze it did, I tried without any space and it succesfully build, how can it be an issue since every other SDKs are building without any problem ?

Finally I have used 7.15. I hope that fb fixed it soon.

@daCelky try to use a command regarding any folder with a space, but without quotation marks, you'll probably get the same error. I'll try to find the cause and make a pull request in a day or two, so that we get it fixed in the next release.

I think it may have to do with the iOS version.  I get this issue on my iPad running 12.3.1.  Not on  my iPhone running 12.2.

Having the same issue... :/

  • Go to XCode-> Targets -> Unity-iPhone -> Build Settings -> Other Linker Flags
  • Double click the values of Other Linker Flags
  • Remove "-force_load" and FBSDKCoreKit Path if they are there

Try to build again.

@jzhudev it solved the building problem, but the "-force_load" is needed for this issue: https://github.com/facebook/facebook-sdk-for-unity/issues/208

edit: removing spaces solved my problem, as mentioned above

@inxidious actually I didn't have this directory issue but issue #261. I'm using XCode 10.2.1 and Unity 2018.2.2.

Hi all, we currently add "-all_load" to avoid the issue of both FB SDK path and #208 . However, if you want to use "-force_load" and have the "no such file or directory" issue, then change the FB SDK path to the correct.

@KylinChang after updating to 7.16.1, i couldn't build my project because of an error.

ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/xxx/Projects/XCodeProjects/zzz/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
objc-class-ref in libFirebaseCppApp.a(invites_receiver_internal_ios_aa7b75b2efc3269e88f1077e55250e5a.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

But, if i change -all_load to -force_load, it works fine.
I know this is firebase error, but everything works fine on 7.16.0, and having to edit the linker every time i build is not convenient. do you have any idea?

@inxidious your solution worked for me. Thanks.

@chkuang-g FYI

@KylinChang any chance you could change your SDK to not do --all_load? This can contribute to SDK bloat as nothing will be deadstripped. In the Firebase SDK (I'm an engineer on the team) we rely upon dead stripping on iOS to only link the components referenced directly by application code or explicitly linked using ---force_load archive, perhaps --force_load could be used for Facebook components instead?

Hey @stewartmiles , in the latest v7.17.2, we already removed the flag and use cocoapods to add FBiOSSDK. Can you switch to use v7.17.2?

If you still want to use v7.16.0, you can use --force_load {PATH_OF_FBSDKCoreKit} instead.

@KylinChang that's great, thanks for the heads up. We don't use Facebook's SDK directly, instead developers include it when they want to authenticate with Facebook and then link that identity with a Firebase auth token. I'm glad this has moved over to using Cocoapods, I hope you're using the iOS Resolver ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

laijingfeng picture laijingfeng  ·  6Comments

manofspirit picture manofspirit  ·  6Comments

naklow12 picture naklow12  ·  6Comments

yasuohasegawa picture yasuohasegawa  ·  4Comments

pvalium picture pvalium  ·  6Comments