firebase / firebase/firebase-ios-sdk

Undefined symbol errors building project with modules using SPM

Open
#14,464 17 comments 0 reactions 0 assignees View on GitHub
api: firestore needs-attention Swift Package Manager
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description

I have a large app that uses many Firebase libraries integrated by CocoaPods. I'm attempting to move to SPM, but I'm running into errors building. My app is consists of many modules (frameworks), some of which use FirebasePerformance and one which uses FirebaseFirestore. I've tried the 4 methods below, all failing:

A) I remove Firebase from CocoaPods (using `pod deintegrate` and then `pod install`), and then include Firebase 11.8.1 using SPM, I link my various modules to Firebase libraries, but while building I get link errors involving undefined symbol errors for many of the abseil symbols used by gRCP. At this point in during the build the frameworks are in a "PackageFrameworks" directory and Xcode is referring to the abseil framework as "abseil_1F63F2923BFCF6_PackageProduct.framework", however, in the "PackageFrameworks" there is also a "absl.framework". If I run the clang command from the command-line and including a reference to the "absl.framework", then the link will work.

There are about 100 errors, here is a sample of some of them:

Undefined symbols for architecture x86_64:

"_AbslInternalSleepFor_lts_20240116", referenced from:
grpc_event_engine::experimental::WorkStealingThreadPool::WorkStealingThreadPoolImpl::DumpStacksAndCrash() in grpc[x86_64][885](work_stealing_thread_pool.o)
grpc_event_engine::experimental::WorkStealingThreadPool::ThreadState::SleepIfRunning() in grpc[x86_64][885](work_stealing_thread_pool.o)
"absl::lts_20240116::CHexEscape(absl::lts_20240116::string_view)", referenced from:
void absl::lts_20240116::functional_internal::InvokeObject(absl::lts_20240116::functional_internal::VoidPtr, absl::lts_20240116::functional_internal::ForwardT::type, absl::lts_20240116::functional_internal::ForwardT::type) in grpc[x86_64][737](status_helper.o)
void absl::lts_20240116::functional_internal::InvokeObject(absl::lts_20240116::functional_internal::VoidPtr, absl::lts_20240116::functional_internal::ForwardT::type, absl::lts_20240116::functional_internal::ForwardT::type) in grpc[x86_64][737](status_helper.o)
void absl::lts_20240116::functional_internal::InvokeObject(absl::lts_20240116::functional_internal::VoidPtr, absl::lts_20240116::functional_internal::ForwardT::type, absl::lts_20240116::functional_internal::ForwardT::type) in grpc[x86_64][737](status_helper.o)
void absl::lts_20240116::functional_internal::InvokeObject(absl::lts_20240116::functional_internal::VoidPtr, absl::lts_20240116::functional_internal::ForwardT::type, absl::lts_20240116::functional_internal::ForwardT::type) in grpc[x86_64][737](status_helper.o)
"absl::lts_20240116::FormatTime(absl::lts_20240116::string_view, absl::lts_20240116::Time, absl::lts_20240116::TimeZone)", referenced from:
grpc_core::AwsRequestSigner::AwsRequestSigner(std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::map, std::__1::allocator>, std::__1::basic_string, std::__1::allocator>, std::__1::less, std::__1::allocator>>, std::__1::allocator, std::__1::allocator> const, std::__1::basic_string, std::__1::allocator>>>>, absl::lts_20240116::Status*) in grpc[x86_64][55](aws_request_signer.o)
grpc_core::AwsRequestSigner::GetSignedRequestHeaders() in grpc[x86_64][55](aws_request_signer.o)
grpc_core::StatusSetTime(absl::lts_20240116::Status*, grpc_core::StatusTimeProperty, absl::lts_20240116::Time) in grpc[x86_64][737](status_helper.o)
"absl::lts_20240116::FormatTime(absl::lts_20240116::Time)", referenced from:
grpc_service_account_jwt_access_credentials::debug_string() in grpc[x86_64][440](jwt_credentials.o)
void absl::lts_20240116::functional_internal::InvokeObject(absl::lts_20240116::functional_internal::VoidPtr, absl::lts_20240116::functional_internal::ForwardT::type, absl::lts_20240116::functional_internal::ForwardT::type) in grpc[x86_64][737](status_helper.o)
grpc_core::experimental::StdoutAuditLogger::Log(grpc_core::experimental::AuditContext const&) in grpc[x86_64][739](stdout_logger.o)
"absl::lts_20240116::IsNotFound(absl::lts_20240116::Status const&)", referenced from:
CustomVerificationFunction(x509_store_ctx_st*, void*) in grpc[x86_64][713](ssl_transport_security.o)
"absl::lts_20240116::SimpleAtod(absl::lts_20240116::string_view, double*)", referenced from:
firebase::firestore::util::JsonReader::DecodeDouble(nlohmann::basic_json, std::__1::allocator>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector>> const&) in FirebaseFirestoreInternal[x86_64][121](json_reader.o)
"absl::lts_20240116::SimpleAtof(absl::lts_20240116::string_view, float*)", referenced from:
grpc_core::json_detail::LoadFloat::LoadInto(std::__1::basic_string, std::__1::allocator> const&, void*, grpc_core::ValidationErrors*) const in grpc[x86_64][878](weighted_round_robin.o)

I also tried this with Firebase 11.8.0, and 11.7.0, but I get the same error.

B) If I use Firebase 10.5.0, 10.6.0, & 10.7.0 I get a different link error:

Undefined symbols for architecture x86_64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in openssl_grpc.o

C) If I use Firebase 10.8.1 I again get different link errors involving grpc. Here is a sample:

Undefined symbols for architecture x86_64:
"grpc::ClientContext::AddMetadata(std::__1::basic_string, std::__1::allocator> const&, std::__1::basic_string, std::__1::allocator> const&)", referenced from:
firebase::firestore::remote::FirebaseMetadataProviderApple::UpdateMetadata(grpc::ClientContext&) in FirebaseFirestore[x86_64][69](firebase_metadata_provider_apple.o)
firebase::firestore::remote::FirebaseMetadataProviderApple::UpdateMetadata(grpc::ClientContext&) in FirebaseFirestore[x86_64][69](firebase_metadata_provider_apple.o)
firebase::firestore::remote::FirebaseMetadataProviderApple::UpdateMetadata(grpc::ClientContext&) in FirebaseFirestore[x86_64][69](firebase_metadata_provider_apple.o)
firebase::firestore::remote::GrpcConnection::CreateContext(firebase::firestore::credentials::AuthToken const&, std::__1::basic_string, std::__1::allocator> const&) const in FirebaseFirestore[x86_64][99](grpc_connection.o)
firebase::firestore::remote::GrpcConnection::CreateContext(firebase::firestore::credentials::AuthToken const&, std::__1::basic_string, std::__1::allocator> const&) const in FirebaseFirestore[x86_64][99](grpc_connection.o)
firebase::firestore::remote::GrpcConnection::CreateContext(firebase::firestore::credentials::AuthToken const&, std::__1::basic_string, std::__1::allocator> const&) const in FirebaseFirestore[x86_64][99](grpc_connection.o)
firebase::firestore::remote::GrpcConnection::CreateContext(firebase::firestore::credentials::AuthToken const&, std::__1::basic_string, std::__1::allocator> const&) const in FirebaseFirestore[x86_64][99](grpc_connection.o)
firebase::firestore::remote::GrpcConnection::CreateContext(firebase::firestore::credentials::AuthToken const&, std::__1::basic_string, std::__1::allocator> const&) const in FirebaseFirestore[x86_64][99](grpc_connection.o)

D) I also tried setting the environment variable to FIREBASE_SOURCE_FIRESTORE while using Firebase 11.8.1 and I get the following error:

error: /SourcePackages/checkouts/grpc-ios/src/objective-c/PrivacyInfo.xcprivacy: No such file or directory (in target 'gRPC_gRPC-cpp' from project 'gRPC')

### Reproducing the issue

_No response_

### Firebase SDK Version

11.8.1

### Xcode Version

16.0

### Installation Method

Swift Package Manager

### Firebase Product(s)

Firestore

### Targeted Platforms

iOS

### Relevant Log Output

```shell

```

### If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet

```json

Replace this line with the contents of your Package.resolved.

```

### If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

```yml

Replace this line with the contents of your Podfile.lock!

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the SPM build with Firebase 11.8.1, Xcode 16.0, and the project's module setup; inspect the PackageFrameworks outputs and the missing PrivacyInfo.xcprivacy path under the gRPC checkout. Compare the undefined symbols across the listed Firebase versions and collect a complete Package.resolved. Done means the multi-module iOS build completes without the reported linker or privacy-file errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, ios, swift
Domain
build-system, databases, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.