I try to build my shared object, which linked with to *.a libraries and one *.so object. I'm instantiate 2 singletone classes from my so, which included into static library. See api of them below:
template<typename T>
class Singleton {
public:
virtual ~Singleton() {}
static std::unique_ptr<T>& instance()
{
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
static std::unique_ptr<T> _instance;
if (_instance == nullptr) {
_instance.reset(new T);
}
return _instance;
}
}
And second one
class RTCEngine
: public IRTCEngine
, public ISignalingClientObserver
, public Observable
, public std::enable_shared_from_this<RTCEngine>
{
public:
static std::shared_ptr<IRTCEngine> instance()
{
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
static std::shared_ptr<IRTCEngine> _instance;
if (_instance == nullptr) {
_instance.reset(new RTCEngine());
}
return _instance;
}
They called inside my own class, which is inheritated from QObject. Compiling step walkthroug, but I have a linkage errors:
internalconnectionlogick.o: in function `__static_initialization_and_destruction_0(int, int)':
internalconnectionlogick.cpp:(.text+0x1a78): undefined reference to `__dso_handle'
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: internalconnectionlogick.cpp:(.text+0x1a88): undefined reference to `__dso_handle'
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: internalconnectionlogick.cpp:(.text+0x1aac): undefined reference to `__dso_handle'
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: internalconnectionlogick.cpp:(.text+0x1ac4): undefined reference to `__dso_handle'
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: internalconnectionlogick.cpp:(.text+0x1ad8): undefined reference to `__dso_handle'
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: internalconnectionlogick.o:internalconnectionlogick.cpp:(.text+0x1ae8): more undefined references to `__dso_handle' follow
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: libLIBVKS.so.1.0.0: hidden symbol `__dso_handle' isn't defined
/home/user/AuroraOS/mersdk/targets/AuroraOS-4.0.2.89-base-armv7hl.default/opt/cross/bin/armv7hl-meego-linux-gnueabi-ld: final link failed: bad value
As build system I'm using qmake, I build it from qt. Here is pro for my *.so
TARGET = LIBVKS
TEMPLATE = lib
CONFIG += sailfishapp
DEFINES += LIBVKS_LIBRARY
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS_DEBUG = -Wall -fPIC
QMAKE_CFLAGS_DEBUG = -Wall -fPIC
QMAKE_LFLAGS_DEBUG += -rdynamic
LIBS += -L$${dependencies_directory}/RtcSdk/lib -lRTCSDK <- here is with singletones
LIBS += -L$${dependencies_directory}/WebRtc/lib -lwebrtc
LIBS += -L$${dependencies_directory}/ffmpeg/lib -lffmpeg
LIBS += -lpthread -ldl -lglib-2.0 -lgio-2.0 -lgobject-2.0 -latomic -lstdc++
LIBS += -nostartfiles
And here is *.a object which I link, inside my, so, and where I get the problems, Here provided all flags, source files are not included, it's not necessary
TARGET = RTCSDK
TEMPLATE = lib
CONFIG += staticlib debug
CONFIG += sailfishapp
LIBS += -lpthread -ldl -lX11 -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lGLEW -lGLU -lGL
I can't solve the problem with dso, because I call singletone clases for inside initialization. How can I build, or link this libraries together for correct work?