xubuntu and dcmtk 3.6.1 compilation error

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
tomasgk
Posts: 2
Joined: Mon, 2013-02-04, 16:05

xubuntu and dcmtk 3.6.1 compilation error

#1 Post by tomasgk »

I follow the next steps to install the dcmtk library v.3.6.1 in Xubuntu 14.04:

./configure
make all
make install
make install-lib
make distclean


All was successful. I can make work all apps without any problem. Then I decided to compile my own application using the installed libraries. Paste the source code from storescp.cc and execute the next line in the console:

g++ ./storescp.cc -DHAVE_CONFIG_H -I/usr/local/include -L/usr/local/lib -lcharls -ldcmdata -ldcmdsig -ldcmimage -ldcmimgle -ldcmjpeg -ldcmnet -ldcmpstat -ldcmqrdb -ldcmrt -ldcmsr -ldcmtls -ldcmwlm -loflog -lofstd -o storescp

I cannot make it work. Also with the most basic examples. I can compile the storescp.cc but only with the package from repository (apt-get install libdcmtk-dev). I think that there must be a linking problem.

The only big difference that I can see is that the libdcmtk2-dev use shared libraries *.so and this one have static libraries *.a.

Code: Select all

/usr/local/lib/libdcmnet.a(dimse.o): In function `sendDcmDataset(T_ASC_Association*, DcmDataset*, unsigned char, E_TransferSyntax, DUL_DATAPDV, void (*)(void*, unsigned long), void*)':
dimse.cc:(.text+0x4df7): undefined reference to `DcmOutputBufferStream::DcmOutputBufferStream(void*, long long)'
dimse.cc:(.text+0x5596): undefined reference to `DcmOutputBufferStream::flushBuffer(void*&, long long&)'
dimse.cc:(.text+0x5d29): undefined reference to `DcmOutputBufferStream::~DcmOutputBufferStream()'
dimse.cc:(.text+0x5e75): undefined reference to `DcmOutputBufferStream::~DcmOutputBufferStream()'
/usr/local/lib/libdcmnet.a(dimse.o): In function `DIMSE_receiveCommand(T_ASC_Association*, T_DIMSE_BlockingMode, int, unsigned char*, T_DIMSE_Message*, DcmDataset**, DcmDataset**)':
dimse.cc:(.text+0x9420): undefined reference to `DcmInputBufferStream::DcmInputBufferStream()'
dimse.cc:(.text+0x9513): undefined reference to `DcmInputBufferStream::releaseBuffer()'
dimse.cc:(.text+0x9972): undefined reference to `DcmInputBufferStream::setBuffer(void const*, long long)'
dimse.cc:(.text+0x99a4): undefined reference to `DcmInputBufferStream::setEos()'
dimse.cc:(.text+0xa459): undefined reference to `DcmInputBufferStream::~DcmInputBufferStream()'
dimse.cc:(.text+0xa690): undefined reference to `DcmInputBufferStream::~DcmInputBufferStream()'
/usr/local/lib/libdcmnet.a(dimse.o): In function `DIMSE_receiveDataSetInMemory(T_ASC_Association*, T_DIMSE_BlockingMode, int, unsigned char*, DcmDataset**, void (*)(void*, unsigned long), void*)':
dimse.cc:(.text+0xaa34): undefined reference to `DcmInputBufferStream::DcmInputBufferStream()'
dimse.cc:(.text+0xaee5): undefined reference to `DcmInputBufferStream::setBuffer(void const*, long long)'
dimse.cc:(.text+0xaefc): undefined reference to `DcmInputBufferStream::setEos()'
dimse.cc:(.text+0xb8a6): undefined reference to `DcmInputBufferStream::~DcmInputBufferStream()'
dimse.cc:(.text+0xb9e2): undefined reference to `DcmInputBufferStream::~DcmInputBufferStream()'
dimse.cc:(.text+0xba97): undefined reference to `DcmInputBufferStream::releaseBuffer()'
/usr/local/lib/liboflog.a(globinit.o): In function `dcmtk::log4cplus::internal::alloc_ptd()':
globinit.cc:(.text+0xf0d): undefined reference to `pthread_setspecific'
/usr/local/lib/liboflog.a(globinit.o): In function `dcmtk::log4cplus::threadCleanup()':
globinit.cc:(.text+0x1247): undefined reference to `pthread_getspecific'
globinit.cc:(.text+0x1274): undefined reference to `pthread_setspecific'
/usr/local/lib/liboflog.a(globinit.o): In function `(anonymous namespace)::_static_log4cplus_initializer::~_static_log4cplus_initializer()':
globinit.cc:(.text+0x1293): undefined reference to `pthread_key_delete'
/usr/local/lib/liboflog.a(globinit.o): In function `dcmtk::log4cplus::ptd_cleanup_func(void*)':
globinit.cc:(.text+0x12b7): undefined reference to `pthread_getspecific'
globinit.cc:(.text+0x12d3): undefined reference to `pthread_setspecific'
globinit.cc:(.text+0x1300): undefined reference to `pthread_setspecific'
/usr/local/lib/liboflog.a(globinit.o): In function `dcmtk::log4cplus::initializeLog4cplus()':
globinit.cc:(.text+0x133c): undefined reference to `pthread_key_create'
globinit.cc:(.text+0x134c): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(logimpl.o): In function `dcmtk::log4cplus::spi::LoggerImpl::forcedLog(int, OFString const&, char const*, int)':
logimpl.cc:(.text+0x246): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(loglevel.o): In function `dcmtk::log4cplus::LogLevelManager::toString(int) const':
loglevel.cc:(.text+0x337): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(ndc.o): In function `dcmtk::log4cplus::NDC::getPtr()':
ndc.cc:(.text+0x410): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(patlay.o): In function `dcmtk::log4cplus::pattern::PatternConverter::formatAndAppend(std::ostream&, dcmtk::log4cplus::spi::InternalLoggingEvent const&)':
patlay.cc:(.text+0x85b): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(patlay.o):patlay.cc:(.text+0xcb6): more undefined references to `pthread_getspecific' follow
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::FairMutex::unlock() const':
syncprims.cc:(.text+0x12b): undefined reference to `sem_post'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::SharedMutex::rdlock() const':
syncprims.cc:(.text+0x162): undefined reference to `pthread_rwlock_rdlock'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::SharedMutex::wrlock() const':
syncprims.cc:(.text+0x1a5): undefined reference to `pthread_rwlock_wrlock'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::SharedMutex::rdunlock() const':
syncprims.cc:(.text+0x1db): undefined reference to `pthread_rwlock_unlock'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::SharedMutex::SharedMutex()':
syncprims.cc:(.text+0x23e): undefined reference to `pthread_rwlock_init'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::SharedMutex::wrunlock() const':
syncprims.cc:(.text+0x28f): undefined reference to `pthread_rwlock_unlock'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::Semaphore::unlock() const':
syncprims.cc:(.text+0x2c5): undefined reference to `sem_post'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::Semaphore::lock() const':
syncprims.cc:(.text+0x2fb): undefined reference to `sem_wait'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::FairMutex::lock() const':
syncprims.cc:(.text+0x331): undefined reference to `sem_wait'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::FairMutex::~FairMutex()':
syncprims.cc:(.text+0x3d8): undefined reference to `sem_destroy'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::Semaphore::~Semaphore()':
syncprims.cc:(.text+0x428): undefined reference to `sem_destroy'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::ManualResetEvent::ManualResetEvent(bool)':
syncprims.cc:(.text+0x866): undefined reference to `pthread_mutexattr_init'
syncprims.cc:(.text+0x89a): undefined reference to `pthread_mutexattr_settype'
syncprims.cc:(.text+0x8f6): undefined reference to `pthread_mutexattr_destroy'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::FairMutex::FairMutex()':
syncprims.cc:(.text+0x9f6): undefined reference to `sem_init'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::Semaphore::Semaphore(unsigned int, unsigned int)':
syncprims.cc:(.text+0xa95): undefined reference to `sem_init'
syncprims.cc:(.text+0xac5): undefined reference to `sem_wait'
syncprims.cc:(.text+0xb14): undefined reference to `sem_destroy'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::Mutex::Mutex(dcmtk::log4cplus::thread::Mutex::Type)':
syncprims.cc:(.text+0xbb3): undefined reference to `pthread_mutexattr_init'
syncprims.cc:(.text+0xbee): undefined reference to `pthread_mutexattr_settype'
syncprims.cc:(.text+0xc4a): undefined reference to `pthread_mutexattr_destroy'
syncprims.cc:(.text+0xc96): undefined reference to `pthread_mutexattr_destroy'
/usr/local/lib/liboflog.a(syncprims.o): In function `dcmtk::log4cplus::thread::impl::PthreadMutexAttr::~PthreadMutexAttr()':
syncprims.cc:(.text._ZN5dcmtk9log4cplus6thread4impl16PthreadMutexAttrD2Ev[_ZN5dcmtk9log4cplus6thread4impl16PthreadMutexAttrD5Ev]+0xb): undefined reference to `pthread_mutexattr_destroy'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::blockAllSignals()':
threads.cc:(.text+0x129): undefined reference to `pthread_sigmask'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::impl::Thread::start()':
threads.cc:(.text+0x3ae): undefined reference to `pthread_create'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::impl::Thread::join()':
threads.cc:(.text+0x45f): undefined reference to `pthread_join'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::impl::Thread::~Thread()':
threads.cc:(.text+0x4a9): undefined reference to `pthread_detach'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::impl::Thread::~Thread()':
threads.cc:(.text+0x574): undefined reference to `pthread_detach'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::getCurrentThreadName()':
threads.cc:(.text+0x7b8): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(threads.o): In function `dcmtk::log4cplus::thread::getCurrentThreadName2()':
threads.cc:(.text+0xe2d): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(timehelp.o): In function `dcmtk::log4cplus::helpers::Time::getFormattedTime(OFString const&, bool) const':
timehelp.cc:(.text+0x2d3): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(mdc.o): In function `dcmtk::log4cplus::MDC::getPtr()':
mdc.cc:(.text+0x44): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(logmacro.o): In function `dcmtk::log4cplus::detail::get_macro_body_oss()':
logmacro.cc:(.text+0x185): undefined reference to `pthread_getspecific'
/usr/local/lib/liboflog.a(logmacro.o):logmacro.cc:(.text+0x1b5): more undefined references to `pthread_getspecific' follow
/usr/local/lib/libofstd.a(ofthread.o): In function `OFThread::start()':
ofthread.cc:(.text+0x80): undefined reference to `pthread_create'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFThread::join()':
ofthread.cc:(.text+0xbc): undefined reference to `pthread_join'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFThreadSpecificData::OFThreadSpecificData()':
ofthread.cc:(.text+0x1a9): undefined reference to `pthread_key_create'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFThreadSpecificData::set(void*)':
ofthread.cc:(.text+0x20e): undefined reference to `pthread_setspecific'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFThreadSpecificData::get(void*&)':
ofthread.cc:(.text+0x229): undefined reference to `pthread_getspecific'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFSemaphore::OFSemaphore(unsigned int)':
ofthread.cc:(.text+0x307): undefined reference to `sem_init'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFSemaphore::~OFSemaphore()':
ofthread.cc:(.text+0x334): undefined reference to `sem_destroy'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFSemaphore::wait()':
ofthread.cc:(.text+0x370): undefined reference to `sem_wait'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFSemaphore::trywait()':
ofthread.cc:(.text+0x39a): undefined reference to `sem_trywait'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFSemaphore::post()':
ofthread.cc:(.text+0x3c4): undefined reference to `sem_post'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFMutex::trylock()':
ofthread.cc:(.text+0x510): undefined reference to `pthread_mutex_trylock'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::OFReadWriteLock()':
ofthread.cc:(.text+0x5e7): undefined reference to `pthread_rwlock_init'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::~OFReadWriteLock()':
ofthread.cc:(.text+0x614): undefined reference to `pthread_rwlock_destroy'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::rdlock()':
ofthread.cc:(.text+0x650): undefined reference to `pthread_rwlock_rdlock'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::wrlock()':
ofthread.cc:(.text+0x66e): undefined reference to `pthread_rwlock_wrlock'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::tryrdlock()':
ofthread.cc:(.text+0x68c): undefined reference to `pthread_rwlock_tryrdlock'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::trywrlock()':
ofthread.cc:(.text+0x6aa): undefined reference to `pthread_rwlock_trywrlock'
/usr/local/lib/libofstd.a(ofthread.o): In function `OFReadWriteLock::unlock()':
ofthread.cc:(.text+0x6c8): undefined reference to `pthread_rwlock_unlock'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: xubuntu and dcmtk 3.6.1 compilation error

#2 Post by J. Riesmeier »

1. The order of libraries linked to the program is significant (and yours is wrong).
2. You list a couple of libraries that are not needed for the storescp program.
3. Some system libraries are missing, e.g. pthread (check "config/Makefile.def").
4. Depending on how you've built DCMTK, some external libraries might be missing.

tomasgk
Posts: 2
Joined: Mon, 2013-02-04, 16:05

Re: xubuntu and dcmtk 3.6.1 compilation error

#3 Post by tomasgk »

Thanks! The problem was the order of the linkers and some missing. Now is working fine.

I use this order to compile storescp.cc:

g++ ./storescp.cc -DHAVE_CONFIG_H -I/usr/local/include -L/usr/local/lib -pthread -ldcmimage -ldcmimgle -ldcmjpeg -ldcmnet -ldcmpstat -ldcmdsig -ldcmsr -ldcmtls -loflog -ldcmdata -lofstd -o storescp

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest