⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Qt + firebase C++ SDK linking issues on iOS

  • Qt Champions 2020

    Hi all,

    I have following build env:

    • host: OSX 10.12 Sierra
    • XCode 9.2
    • Qt 5.10.1 for iOS
    • QtCreator 4.7.0
    • firebase 5.2

    and try to build my application from QtCreator for iOS with the firebase support, but it fails with following linking errors:

    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_FIRMessaging", referenced from:
          objc-class-ref in firebase_messaging(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
      "_OBJC_CLASS_$_FIRApp", referenced from:
          objc-class-ref in firebase(app_ios_814e1620d4f88024cea4bade26623a67.o)
      "_OBJC_CLASS_$_FIROptions", referenced from:
          objc-class-ref in firebase(app_ios_814e1620d4f88024cea4bade26623a67.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I have simplified my project to following code:

    == main.cpp ==

    #include <QCoreApplication>
    #include <firebase/app.h>
    #include <firebase/messaging.h>
    #include <firebase/util.h>
    int main(int argc, char *argv[])
        QCoreApplication a(argc, argv);
        ::firebase::App *fapp = ::firebase::App::Create();
        return a.exec();

    and a project file is:

    QT -= gui
    CONFIG += c++11 console
    CONFIG -= app_bundle
    # Check for GOOGLE_FIREBASE_SDK environment variable.
    # Or define GOOGLE_FIREBASE_SDK path here.
        isEmpty(GOOGLE_FIREBASE_SDK) {
            message("GOOGLE_FIREBASE_SDK" environment variable not detected!)
    SOURCES += \
    FCM_LIBS_PATH = $$(GOOGLE_FIREBASE_SDK)/frameworks/ios/universal
    message("FCM_LIBS_PATH = $$FCM_LIBS_PATH")
       -framework firebase_messaging \
       -framework firebase \
       -framework Foundation \
       -framework UserNotifications \
       -framework UIKit \
       -framework CoreGraphics

    The firebase SDK contains different frameworks directories for different architectures :

    • ~/firebase_cpp_sdk/frameworks/ios/universal
    • ~/firebase_cpp_sdk/frameworks/ios/amd64
    • ~/firebase_cpp_sdk/frameworks/ios/i386
    • ~/firebase_cpp_sdk/frameworks/ios/x86_64
    • ~/firebase_cpp_sdk/frameworks/ios/armv7

    As I see that error related to 'arm64' architecture, so, I have changed the project file LIBS to use 'arm64' instead of 'universal', but this does not help.

    Also I tried to build the project from the XCode, using qmake's generated xcode.project file, but there are same error.

    I looked on stackoverflow similar issues, but that workarounds does not help:

    1. I tried to remove the /Users/admin/Library/Developer/Xcode/DerivedData directory.
    2. I tried to play with the XCode options "Build Settings -> Build Active Architecture Only -> <yes/no>"

    I looked a code from the following projects:

    But I don't understand why this linker error happens.. Maybe is it a qmake bug?

  • I cannot help you with the problem but here Firebase works without problems. Have you tried to run qmake again, or delete the generated files?

  • Qt Champions 2020

    but here Firebase works without problems

    Where is "here" ?

Log in to reply