Skip to content

Duplicate symbol regression when interacting with cocos2d-x 3.17 prebuilt lib on MacOS #39

@solodon4

Description

@solodon4

Please fill in the following fields:

Pre-built SDK from the website:
Firebase C++ SDK version: 6.8.0
Firebase plugins in use (Auth, Database, etc.): Analytics, Remote Config, Dynamic Links
Additional SDKs you are using (Facebook, AdMob, etc.): Cocos2d-x 3.17
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:

I am trying to upgrade Firebase in my Cocos2d-x project from version 5.6.0 to 6.8.0. Everything was building fine with 5.6.0 however after substituting Firebase sources with 6.8.0 ones and resolving missing dependencies I get the following symbol conflict with the prebuilt version of cocos2d-x static lib:

duplicate symbol 'flatbuffers::MakeCamel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)' in:
    /Applications/Cocos/Cocos2d-x/cocos2d-x-3.17/prebuilt/mac/libcocos2d Mac.a(idl_gen_general.o)
    /Users/user/Projects/Cocos/TileGame/external/firebase_cpp_sdk/frameworks/darwin/x86_64/firebase.framework/firebase(6eeb4ec1b7654fac8ff5c92573f1d7a3_idl_parser.o)
ld: 1 duplicate symbol for architecture x86_64

libcocos2d Mac.a includes flatbuffers verbatim and it seems that interaction with Firebase 5.6.0 was possible because of some kind of renaming scheme in place in the Firebase sources (note the namespace is f_b_flatbuffers in 5.6.0 vs flatbuffers in 6.8.0):

external/firebase_cpp_sdk-old/frameworks/darwin/universal/firebase.framework/firebase(bc365d2402c329b3ab8113d22eb92bb5_idl_parser.o):
0000000000000000 T f_b_flatbuffers::MakeCamel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)

In the 6.8.0 flatbuffers is included verbatim just like in cocos2d-x lib, causing the linker to report duplicate symbol when both libraries are used together:

external/firebase_cpp_sdk/frameworks/darwin/universal/firebase.framework/firebase(6eeb4ec1b7654fac8ff5c92573f1d7a3_idl_parser.o):
0000000000000000 T flatbuffers::MakeCamel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)

I was wondering in what version of Firebase was the renaming dropped and whether you guys plan on keeping it that way? I am not super familiar with Xcode's build system, do I need any additional flags to link against Firebase 6.8.0 framework on Mac OS to avoid these conflicts? I don't get this issue when targeting iOS while I also don't see any renaming in place on iOS in the 5.6.0, so I'm not sure what's happening.

Please answer the following, if applicable:

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    newNew issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions