Skip to content

Link errors using firebase_firestore in CMake on macOS desktop #53

@mark-grimes

Description

@mark-grimes

Please fill in the following fields:

Pre-built SDK from the website or open-source from this repo: website
Firebase C++ SDK version: 6.12.0
Firebase plugins in use (Auth, Database, etc.): Firestore (not relevant but also using Auth and Storage)
Additional SDKs you are using (Facebook, AdMob, etc.):
Platform you are using the C++ SDK on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): desktop

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Attempting to link to the firebase_firestore CMake target gives

Undefined symbols for architecture x86_64:
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      firebase::firestore::remote::ConnectivityMonitorApple::ConnectivityMonitorApple(std::__1::shared_ptr<firebase::firestore::util::AsyncQueue> const&) in libfirebase_firestore.a(d43fad9bb2ebb8a979aa11feb868dab3_connectivity_monitor_apple.o)
  "_SCNetworkReachabilityGetFlags", referenced from:
      firebase::firestore::remote::ConnectivityMonitorApple::ConnectivityMonitorApple(std::__1::shared_ptr<firebase::firestore::util::AsyncQueue> const&) in libfirebase_firestore.a(d43fad9bb2ebb8a979aa11feb868dab3_connectivity_monitor_apple.o)
  "_SCNetworkReachabilitySetCallback", referenced from:
      firebase::firestore::remote::ConnectivityMonitorApple::ConnectivityMonitorApple(std::__1::shared_ptr<firebase::firestore::util::AsyncQueue> const&) in libfirebase_firestore.a(d43fad9bb2ebb8a979aa11feb868dab3_connectivity_monitor_apple.o)
  "_SCNetworkReachabilitySetDispatchQueue", referenced from:
      firebase::firestore::remote::ConnectivityMonitorApple::ConnectivityMonitorApple(std::__1::shared_ptr<firebase::firestore::util::AsyncQueue> const&) in libfirebase_firestore.a(d43fad9bb2ebb8a979aa11feb868dab3_connectivity_monitor_apple.o)
      firebase::firestore::remote::ConnectivityMonitorApple::~ConnectivityMonitorApple() in libfirebase_firestore.a(d43fad9bb2ebb8a979aa11feb868dab3_connectivity_monitor_apple.o)
  "absl::str_format_internal::FormatPack(absl::str_format_internal::UntypedFormatSpecImpl, absl::Span<absl::str_format_internal::FormatArgImpl const>)", referenced from:
      f_b_grpc_chttp2_transport::f_b_grpc_chttp2_transport(grpc_channel_args const*, grpc_endpoint*, bool, grpc_resource_user*) in libfirebase_firestore.a(ebe3cf7b618c76d718a4bf7736e66541_chttp2_transport.o)
  "bool absl::str_format_internal::FormatArgImpl::Dispatch<char const*>(absl::str_format_internal::FormatArgImpl::Data, absl::str_format_internal::FormatConversionSpec, void*)", referenced from:
      f_b_grpc_chttp2_transport::f_b_grpc_chttp2_transport(grpc_channel_args const*, grpc_endpoint*, bool, grpc_resource_user*) in libfirebase_firestore.a(ebe3cf7b618c76d718a4bf7736e66541_chttp2_transport.o)
ld: symbol(s) not found for architecture x86_64

Linking to the SystemConfiguration framework gets rid of the first four, so it would be helpful to have that listed in the documentation.

I can't fix the last two symbols though. I presume they're from the abseil.io library, so I built that. The symbols seem to be in the library:

username$ nm -Ug ../../abseil_install/lib/*.a
<snip>
../../abseil_install/lib/libabsl_str_format_internal.a(bind.cc.o):
<snip>
0000000000000ef0 T __ZN4absl14lts_2020_02_2519str_format_internal10FormatPackENS1_21UntypedFormatSpecImplENS0_4SpanIKNS1_13FormatArgImplEEE

<snip>
../../abseil_install/lib/libabsl_str_format_internal.a(arg.cc.o):
0000000000002a20 T __ZN4absl14lts_2020_02_2519str_format_internal13FormatArgImpl8DispatchINS0_11string_viewEEEbNS2_4DataENS1_20FormatConversionSpecEPv
0000000000002070 T __ZN4absl14lts_2020_02_2519str_format_internal13FormatArgImpl8DispatchINS0_6int128EEEbNS2_4DataENS1_20FormatConversionSpecEPv
00000000000022c0 T __ZN4absl14lts_2020_02_2519str_format_internal13FormatArgImpl8DispatchINS0_7uint128EEEbNS2_4DataENS1_20FormatConversionSpecEPv
0000000000000000 T __ZN4absl14lts_2020_02_2519str_format_internal13FormatArgImpl8DispatchINS1_7VoidPtrEEEbNS2_4DataENS1_20FormatConversionSpecEPv
<snip>

...but linking the absl_str_format_internal library in doesn't solve anything. I presume name mangling stops the symbols being located. Abseil and my Firebase code are compiled with Apple clang version 11.0.3 (clang-1103.0.32.29).

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase C++ quickstarts ?

Not applicable - issue seems to be with project setup, not code. I haven't used anything other than Firestore::GetInstance(...) yet.

What's the issue repro rate? (eg 100%, 1/5 etc)

100%

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions