mercredi 25 avril 2018

Static linking ActiveMQ-cpp

I am creating a c++ project where I want it to run in standalone mode without any dependencies since it will be deployed on multiple servers.

This is my CMAKELISTS file :

project(CMS-test)
cmake_minimum_required(VERSION 2.6)

add_executable(main main.cpp)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

INCLUDE_DIRECTORIES(/usr/local/apr/include/apr-1)
INCLUDE_DIRECTORIES(/usr/local/include/activemq-cpp-3.9.4)

target_link_libraries(main ${CMAKE_SOURCE_DIR}/libapr-1.a)
target_link_libraries(main ${CMAKE_SOURCE_DIR}/libactivemq-cpp.a)

but the error I'm getting after make main during linking is

libactivemq-cpp.a(libactivemq_cpp_la-DecafRuntime.o): In function `decaf::lang::Runtime::initializeRuntime(int, char**)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:72: undefined reference to `apr_initialize'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:73: undefined reference to `apr_pool_create_ex'
libactivemq-cpp.a(libactivemq_cpp_la-DecafRuntime.o): In function `decaf::lang::Runtime::shutdownRuntime()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:109: undefined reference to `apr_pool_destroy'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:110: undefined reference to `apr_terminate'
libactivemq-cpp.a(libactivemq_cpp_la-Network.o): In function `decaf::internal::net::Network::initializeNetworking()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/Network.cpp:116: undefined reference to `apr_signal_block'
libactivemq-cpp.a(libactivemq_cpp_la-SecureRandomImpl.o): In function `decaf::internal::security::SecureRandomImpl::providerNextBytes(unsigned char*, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/security/unix/SecureRandomImpl.cpp:128: undefined reference to `apr_file_read_full'
libactivemq-cpp.a(libactivemq_cpp_la-SecureRandomImpl.o): In function `decaf::internal::security::SecureRandomImpl::SecureRandomImpl()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/security/unix/SecureRandomImpl.cpp:76: undefined reference to `apr_file_open'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::tryLockMutex(pthread_mutex_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:83: undefined reference to `pthread_mutex_trylock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::createRWMutex(pthread_rwlock_t**)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:106: undefined reference to `pthread_rwlock_init'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::readerLockMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:115: undefined reference to `pthread_rwlock_rdlock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::writerLockMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:124: undefined reference to `pthread_rwlock_wrlock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::tryReaderLockMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:132: undefined reference to `pthread_rwlock_tryrdlock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::tryWriterLockMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:137: undefined reference to `pthread_rwlock_trywrlock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::unlockRWMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:143: undefined reference to `pthread_rwlock_unlock'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::destroyRWMutex(pthread_rwlock_t*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:151: undefined reference to `pthread_rwlock_destroy'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::createNewThread(unsigned long*, void* (*)(void*), void*, int, long long, long long*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:351: undefined reference to `pthread_attr_setstacksize'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:359: undefined reference to `pthread_create'
libactivemq-cpp.a(libactivemq_cpp_la-PlatformThread.o): In function `decaf::internal::util::concurrent::PlatformThread::joinThread(unsigned long)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/util/concurrent/unix/PlatformThread.cpp:382: undefined reference to `pthread_join'

and more..

Any advice ?

Aucun commentaire:

Enregistrer un commentaire