Xcode build failure due to Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider - xcode

Building failed with Xcode 13beta for React Native 0.64.2 project. It is on macOS Big Sur. The detail of error is:
Undefined symbols for architecture x86_64:
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What configuration change is needed to eliminate the error?

Create an empty swift file (####.swift) from Xcode in the main project which located Appdelegate.h file. This worked for my React Native project after Xcode version 13 update.

Try creating a new Swift empty file (it's not necessary to create a Bridging Header).

Adding libswiftWebKit.tbd into Link Binary With Libraries build phase in XCode helped to solve the problem:
enter image description here

Related

Undefined Symbol when building in Xcode

I have recently got this problem when building for IOS. First time I got it I was able to restore an old version from Plastic backup and then restore each version until recent and the problem was gone. Now that does not work.
I have been googling a lot but do not understand how to solve this problem and would appreciate some help.
I also have not found a description what U3CPrivateImplementationDetailsU3E ... is.
The errors is:
Undefined symbol: _U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____499E4F5C84E20C7347E10100E0EC90C1945EA21C7C80809E4F7F474179B39DF6_12_FieldInfo_var
and
Undefined symbol: _U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____9DA6B2C4638D1DC7611B7F458BBFE7FD49FE1B36B67239B00B8A051F4E49558F_22_FieldInfo_var
Here is the Xcode log screenshot with the error part also in text below:
Undefined symbols for architecture arm64:
"_U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____499E4F5C84E20C7347E10100E0EC90C1945EA21C7C80809E4F7F474179B39DF6_12_FieldInfo_var", referenced from:
_Parser__cctor_m56CB9BAD206C2D94D0AC23E6E618F2AD736051E9 in libGameAssembly.a(hfu1rd9b20qx.o)
"_U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____9DA6B2C4638D1DC7611B7F458BBFE7FD49FE1B36B67239B00B8A051F4E49558F_22_FieldInfo_var", referenced from:
_XsdDateTime__cctor_m4F12859B35713836F38CE50985C1492A7EC4D441 in libGameAssembly.a(hfu1rd9b20qx.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: _U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____499E4F5C84E20C7347E10100E0EC90C1945EA21C7C80809E4F7F474179B39DF6_12_FieldInfo_var
Undefined symbol: _U3CPrivateImplementationDetailsU3E_tBAB6DC40B1709E21296656960228A17F1BE57FD7____9DA6B2C4638D1DC7611B7F458BBFE7FD49FE1B36B67239B00B8A051F4E49558F_22_FieldInfo_var
Build target Unity-iPhone of project Unity-iPhone with configuration ReleaseForRunning
/Users/xxxx/Dropbox/Unity3D/_CONTENT/MyApp/ExecutableIOS/Unity-iPhone.xcodeproj: warning: Building with bitcode is deprecated. Please update your project and/or target settings to disable bitcode. (in target 'Unity-iPhone' from project 'Unity-iPhone')
/Users/xxxx/Dropbox/Unity3D/_CONTENT/MyApp/ExecutableIOS/Unity-iPhone.xcodeproj: Building with bitcode is deprecated. Please update your project and/or target settings to disable bitcode.
UPDATE
I deleted Unity executable folder and it seems to solve the problem. However, anyone knows what the problem is?

Failed to add Firebase Database.framework without Cocoapods

I'm trying to add firebase's Database.framework without Cocoapods, but have compilation error
Undefined symbols for architecture arm64:
"_kFIRDefaultAppName", referenced from:
+[FIRDatabase databaseForApp:] in FirebaseDatabase(FIRDatabase.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error
Does anyone know which framework I should add too? Thanks
So from this question Use of unresolved identifier 'FIRDatabase' when using Firebase , I can see that FirebaseDatabase depends on FirebaseAnalytics. After add all FirebaseAnalytics framework into the project, everthing works as expected. Hope this helps others too

_SecTrustEvaluate linking error with Google Cardboard Unity3d SDK

I am trying to run the demo project that comes with the Unity3d package for Google cardboard, but I keep getting this error when I build in xCode.
Undefined symbols for architecture arm64:
"_SecTrustEvaluate", referenced from:
l155 in libvrunity.a(GTMSessionFetcher.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am running Unity 5.2.0f3 and Xcode 6.4. The only things I have in my project are the CardboardSDK and the demo project both downloaded from here: https://developers.google.com/cardboard/unity
Has anyone run into this problem before or know how to fix it?!
You need to add the Security.framework in order for it to build.

Unity project. Undefined symbols for architecture armv7

I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps

Xcode 4.5 and Phonegap 2.0 reference issue

Yesterday I updated new Xcode 4.5, and I got an error in my build and I am not sure how can I even fix this.
Everything works fine if I build in simulator, but when I try to build for Archive for example, i get this:
ld: warning: ignoring file /Users/corotchi/Library/Developer/Xcode/DerivedData/NJR_IR-ftjwhrqtxwedihfjrbjikbqqttkx/Build/Products/Release-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (armv7s): /Users/corotchi/Library/Developer/Xcode/DerivedData/NJR_IR-ftjwhrqtxwedihfjrbjikbqqttkx/Build/Products/Release-iphoneos/libCordova.a
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_CDVURLProtocol", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and more errors bellow, which are the same
Everything worked fine until u updated the Xcode, I had another issue before where I read the formums that I have to remove the "ARMV6" from the build settings, cause it is not supported anymore in new IOS, and after that I get this reference issue.
I appreciate any help,
THanks!!!!
Remove armv7s from Valid Architectures from both your project and Cordova(phonegap) project. Also set iOS Deployment target 4.3 or above in both project and Cordova(phonegap) project. After that Clean and Clean Build Folder. This will solve the problem.
If you also take out armv7s from the build settings, you should get it to build for you.
Edit: As per below: Fix can be found here via PhoneGap: https://issues.apache.org/jira/browse/CB-1360
This is a bug already fixed at Cordova 2.2.0
https://issues.apache.org/jira/browse/CB-1360
Change the Buid setting ---> Architecture ---> Build Active Architecture only ---> Yes
This solved my issue for using old cordova versions in new Xcode 5

Resources