My application is using couchbase-lite-core as database. It links LiteCoreStatic statically. But I get different behavior on Windows and MacOS when linking with Support static lib. I rmb someone from you told me that we should not link Support when linking LiteCoreStatic lib.
But I got this error on Windows:
LiteCoreStatic.lib(c4Observer.obj) : error LNK2001: unresolved external symbol "void __cdecl c4Internal::recordException(class std::exception const &,struct C4Error *)" (?recordException@c4Internal@@YAXAEBVexception@std@@PEAUC4Error@@@Z)
LiteCoreStatic.lib(c4Document.obj) : error LNK2019: unresolved external symbol "void __cdecl litecore::SecureRandomize(struct fleece::slice)" (?SecureRandomize@litecore@@YAXUslice@fleece@@@Z) referenced in function c4doc_generateID
LiteCoreStatic.lib(c4DocExpiration.obj) : error LNK2001: unresolved external symbol "bool __cdecl c4Internal::tryCatch(struct C4Error *,class fleece::function_ref<void __cdecl(void)>)" (?tryCatch@c4Internal@@YA_NPEAUC4Error@@V?$function_ref@$$A6AXXZ@fleece@@@Z)
LiteCoreStatic.lib(Database.cc.obj) : error LNK2001: unresolved external symbol "public: __cdecl litecore::FilePath::FilePath(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0FilePath@litecore@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
...
After link with Support lib, build on Windows is ok. However, on MacOS (which build ok without Support) has below issues when building with Support:
duplicate symbol __ZN8litecore9LogDomain3logENS_8LogLevelEPKcz in:
/Volumes/DATA/git/cortex-v2-codereview/src/ThirdParty/couchbase-lite-core/build_cmake/macos/Libs/Debug/libSupport.a(Logging_Stub.cc.o)
/Volumes/DATA/git/cortex-v2-codereview/src/ThirdParty/couchbase-lite-core/build_cmake/macos/Libs/Debug/libLiteCoreStatic.a(Logging.cc.o)
duplicate symbol __ZN8litecore8ActorLogE in:
/Volumes/DATA/git/cortex-v2-codereview/src/ThirdParty/couchbase-lite-core/build_cmake/macos/Libs/Debug/libSupport.a(Logging_Stub.cc.o)
/Volumes/DATA/git/cortex-v2-codereview/src/ThirdParty/couchbase-lite-core/build_cmake/macos/Libs/Debug/libLiteCoreStatic.a(Logging.cc.o)
I’m not sure how to do it correctly. How should I link with or without Support? Can anyone advice please?