Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Question] Cannot link with Auth on Linux

Đang mở
#1,721 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cmake, cpp

Hướng nghiên cứu

Bắt đầu với CMakeLists.txt và demo.cpp được cung cấp, sau đó tái hiện bản build Linux bằng Firebase SDK 12.7.0 và kiểm tra lệnh linker được tạo ra. Theo dõi các target firebase_app và firebase_auth cùng các symbol chưa được phân giải của chúng; issue được hoàn tất khi demo tối thiểu được liên kết thành công mà không có tham chiếu chưa được định nghĩa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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;
}
Ngôn ngữ chính
C++
Star
326
Fork
138
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-cpp-sdk

Tất cả issue của firebase/firebase-cpp-sdk

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.