Reputation: 446
I write crossplatform application using QT Creator(4.1.1) and Qt Framework(5.14.1). I want enable firebase, so I download firebase C++ sdk (latest release) : link Then i try connect it the my project in *.pro - file. Option one - with help frameworks:
QMAKE_LFLAGS += -F$$PWD/fr_universal/ -ObjC \
-framework StoreKit \
-framework firebase_analytics \
-framework firebase
Option two - with help static libs:
LIBS += -ObjC -L$$PWD/universal/ -lfirebase_app -lfirebase_analytics
Also I connect include-files firebase and write simple example code:
#include <firebase/analytics.h>
#include <firebase/app.h>
int main(int argc, char *argv[])
{
firebase::App* contextFirebase(nullptr);
return 0;
}
Compilation fails anyway. Error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRAnalytics", referenced from:
objc-class-ref in firebase_analytics(analytics_ios.mm.o)
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in firebase(app_ios.mm.o)
"_OBJC_CLASS_$_FIROptions", referenced from:
objc-class-ref in firebase(app_ios.mm.o)
"_OBJC_CLASS_$_FIRConfiguration", referenced from:
objc-class-ref in firebase(log_ios.mm.o)
OS: macOS Big Sur 11.1
P.S.:
path to firebase sdk correct
I don't use Cocoapods
I try make simple example for XCode 12.3 - and get identical error
I check static lib firebase with helps command line tool (lipo -info ). Output:
are: armv7 i386 x86_64 arm64
Upvotes: 1
Views: 588
Reputation: 3131
The most important note is that the C++ SDK does not stand on its own, it is reliant on the iOS SDK to run. You can see a breakdown of the needed frameworks at this page or you can look in the readme.md
file to see the required dependencies the binary C++ SDK and the ios_pod/Podfile
to see required versions.
With the FIR prefix, it looks like you're simply missing the Objective-C SDK frameworks. If you were willing to use CocoaPods (which I know might be hard in a QMake project, here's my solution for CMake), it would more or less take care of itself.
Instead, you can try downloading the binary ObjectiveC SDK from this page making sure to match the version for your C++ SDK. If you're using the latest C++ SDK (7.1.1), I can see that the site requires these for Analytics:
(required) firebase.framework
firebase_analytics.framework
pod 'Firebase/Analytics', '7.5.0'
So instead of creating a PodFile
with pod 'Firebase/Analytics', '7.5.0'
in it, you will have to locate the FirebaseAnalytics
folder in the standalone iOS SDK you downloaded (this link takes you directly to 7.5.0). Inside it are all of the dependencies for that feature. In addition, there's a readme that lists dependencies between Firebase features.
So for FirebaseAnalytics, so you should be able to open the FirebaseAnalytics folder and link all the frameworks in there. If you check the readme, these are the dependencies you should see in the folder:
## FirebaseAnalytics
- FirebaseAnalytics.xcframework
- FirebaseCore.xcframework
- FirebaseCoreDiagnostics.xcframework
- FirebaseInstallations.xcframework
- GoogleAppMeasurement.xcframework
- GoogleDataTransport.xcframework
- GoogleUtilities.xcframework
- PromisesObjC.xcframework
- nanopb.xcframework
If you were to add FirebaseCrashlytics, you would then need to drag everything from that folder in addition to everything from FirebaseAnalytics. From the readme:
## FirebaseCrashlytics (~> FirebaseAnalytics)
- FirebaseCrashlytics.xcframework
Upvotes: 1