Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Question] Cannot link with Auth on Linux

Aperta
#1,721 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cmake, cpp

Direzione di ricerca

Inizia con i CMakeLists.txt e demo.cpp forniti, quindi riproduci la build Linux con Firebase SDK 12.7.0 e ispeziona il comando del linker generato. Traccia i target firebase_app e firebase_auth e i relativi simboli non risolti; il problema è risolto quando il demo minimale viene collegato correttamente senza riferimenti indefiniti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage new type: question
[REQUIRED] Please fill in the following fields:
  • Pre-built SDK from the website or open-source from this repo: YES
  • Firebase C++ SDK version: 12.7.0
  • Main Firebase Components in concern: Auth
  • Other Firebase Components in use: App
  • Platform you are using the C++ SDK on: Linux
  • Platform you are targeting: Desktop
[REQUIRED] Please describe the question here:

I'm trying out the SDK on Linux, and while I accomplished creating a basic demo with the app module, I'm not able to link properly the auth module using the prebuilt libs.

The error I'm getting is a lot of undefined references and I'm not sure why. Shouldn't they be available in the provided .a files?

[main] Building folder: /home/david/data_ssd/Dev/CPP/firebase-demo/build 
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /home/david/data_ssd/Dev/CPP/firebase-demo/build --config Debug --target all -j 14 --
[build] [ 50%] Linking CXX executable firebase-demo
[build] /usr/bin/ld: /home/david/Downloads/firebase_cpp_sdk_12.7.0/firebase_cpp_sdk/libs/linux/x86_64/cxx11/libfirebase_auth.a(9b788918c2ba0e0ffaefa78515169526_auth_desktop.cc.o): in function `firebase::auth::Auth::DestroyPlatformAuth(firebase::auth::AuthData*)':
[build] auth_desktop.cc:(.text+0x3ace): undefined reference to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)'
[build] /usr/bin/ld: auth_desktop.cc:(.text+0x3ae3): undefined reference to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)'
[build] /usr/bin/ld: auth_desktop.cc:(.text+0x3af5): undefined reference to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)'
[build] /usr/bin/ld: auth_desktop.cc:(.text+0x3b0a): undefined reference to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)'
[build] /usr/bin/ld: auth_desktop.cc:(.text+0x3b1f): undefined reference to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)'
[build] /usr/bin/ld: /home/david/Downloads/firebase_cpp_sdk_12.7.0/firebase_cpp_sdk/libs/linux/x86_64/cxx11/libfirebase_auth.a(9b788918c2ba0e0ffaefa78515169526_auth_desktop.cc.o):auth_desktop.cc:(.text+0x3b34): more undefined references to `firebase::internal::FunctionRegistry::UnregisterFunction(firebase::internal::FunctionId)' follow
[build] /usr/bin/ld: /home/david/Downloads/firebase_cpp_sdk_12.7.0/firebase_cpp_sdk/libs/linux/x86_64/cxx11/libfirebase_auth.a(9b788918c2ba0e0ffaefa78515169526_auth_desktop.cc.o): in function `firebase::auth::Auth::DestroyPlatformAuth(firebase::auth::AuthData*)':
[build] auth_desktop.cc:(.text+0x3c91): undefined reference to `firebase::app::secure::UserSecureManager::~UserSecureManager()'
[build] /usr/bin/ld: /home/david/Downloads/firebase_cpp_sdk_12.7.0/firebase_cpp_sdk/libs/linux/x86_64/cxx11/libfirebase_auth.a(9b788918c2ba0e0ffaefa78515169526_auth_desktop.cc.o): in function `firebase::auth::InitializeUserDataPersist(firebase::auth::AuthData*)':
[build] auth_desktop.cc:(.text+0x58e8): undefined reference to `firebase::internal::CreateAppIdentifierFromOptions[abi:cxx11](firebase::AppOptions const&)'
[build] /usr/bin/ld: auth_desktop.cc:(.text+0x594b): undefined reference to `firebase::app::secure::UserSecureManager::~UserSecureManager()'
...
[build] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[build] gmake[2]: *** [CMakeFiles/firebase-demo.dir/build.make:99: firebase-demo] Error 1
[build] gmake[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/firebase-demo.dir/all] Error 2
[build] gmake: *** [Makefile:91: all] Error 2
[proc] The command: /usr/bin/cmake --build /home/david/data_ssd/Dev/CPP/firebase-demo/build --config Debug --target all -j 14 -- exited with code: 2
[driver] Build completed: 00:00:00.227
[build] Build finished with exit code 2

Demo below:

CMakeLists.txt
cmake_minimum_required(VERSION 3.10.0)
project(firebase-demo VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(FIREBASE_SDK_PATH "/home/david/Downloads/firebase_cpp_sdk_12.7.0/firebase_cpp_sdk")
set(TARGET_EXE_NAME "firebase-demo")

add_subdirectory(${FIREBASE_SDK_PATH} firebase_sdk)

add_executable(${TARGET_EXE_NAME} demo.cpp)

set(FIREBASE_LIBS
    firebase_app
    firebase_auth
)


target_link_libraries(${TARGET_EXE_NAME} PUBLIC ${FIREBASE_LIBS})
target_include_directories(${TARGET_EXE_NAME} INTERFACE "${FIREBASE_SDK_PATH}/include")
demo.cpp
#include "firebase/app.h"
#include "firebase/auth.h"

int main() {
  firebase::App *app = firebase::App::Create(firebase::AppOptions());
  firebase::auth::Auth *auth = firebase::auth::Auth::GetAuth(app);
  return 0;
}
Lingua principale
C++
Stelle
326
Fork
138
Merge medio
1g 12h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-cpp-sdk

Tutte le issue di firebase/firebase-cpp-sdk

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.