Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt + firebase C++ SDK linking issues on iOS
Forum Updated to NodeBB v4.3 + New Features

Qt + firebase C++ SDK linking issues on iOS

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on last edited by kuzulis
    #1

    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();
        Q_UNUSED(fapp);
        return a.exec();
    }
    

    and a project file is:

    QT -= gui
    CONFIG += c++11 console
    CONFIG -= app_bundle
    
    # Check for GOOGLE_FIREBASE_SDK environment variable.
    ENV_GOOGLE_FIREBASE_SDK = $$(GOOGLE_FIREBASE_SDK)
    # Or define GOOGLE_FIREBASE_SDK path here.
    GOOGLE_FIREBASE_SDK =
    
    isEmpty(ENV_GOOGLE_FIREBASE_SDK) {
        isEmpty(GOOGLE_FIREBASE_SDK) {
            message("GOOGLE_FIREBASE_SDK" environment variable not detected!)
        }
    }
    
    INCLUDEPATH += $$(GOOGLE_FIREBASE_SDK)
    INCLUDEPATH += $$(GOOGLE_FIREBASE_SDK)/include
    
    SOURCES += \
            main.cpp
    
    FCM_LIBS_PATH = $$(GOOGLE_FIREBASE_SDK)/frameworks/ios/universal
    message("FCM_LIBS_PATH = $$FCM_LIBS_PATH")
    
    LIBS += -F$$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:

    • qtcloudmessaging: https://github.com/qt/qtcloudmessaging
    • QtFirebase: https://github.com/Larpon/QtFirebase

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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pets
      wrote on last edited by pets
      #2

      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?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kuzulis
        Qt Champions 2020
        wrote on last edited by
        #3

        but here Firebase works without problems

        Where is "here" ?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved