Tophat Installation Error Message Undefined reference.

/app/setups/tophat-2.0.12/src/segment_juncs.cpp:4917: undefined reference to `boost::thread::join()'
/app/setups/tophat-2.0.12/src/segment_juncs.cpp:4918: undefined reference to `boost::thread::~thread()'
/app/setups/tophat-2.0.12/src/segment_juncs.cpp:4994: undefined reference to `boost::thread::join()'
/app/setups/tophat-2.0.12/src/segment_juncs.cpp:4995: undefined reference to `boost::thread::~thread()'
segment_juncs.o: In function `thread<SegmentSearchWorker>':
/usr/include/boost/thread/detail/thread.hpp:191: undefined reference to `boost::thread::start_thread()'
/usr/include/boost/thread/detail/thread.hpp:191: undefined reference to `boost::thread::start_thread()'
segment_juncs.o: In function `~thread_data':
/usr/include/boost/thread/detail/thread.hpp:40: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:40: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:40: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:40: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
segment_juncs.o: In function `thread_data_base':
/usr/include/boost/thread/pthread/thread_data.hpp:65: undefined reference to `vtable for boost::detail::thread_data_base'

segment_juncs.o: In function `heap_new<boost::detail::thread_data<SegmentSearchWorker>, SegmentSearchWorker>':
/usr/include/boost/thread/detail/thread.hpp:49: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
segment_juncs.o:(.rodata._ZTIN5boost6detail11thread_dataI19SegmentSearchWorkerEE[typeinfo for boost::detail::thread_data<SegmentSearchWorker>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status
make[2]: *** [segment_juncs] Error 1
make[2]: Leaving directory `/app/setups/tophat-2.0.12/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/app/setups/tophat-2.0.12'
make: *** [all] Error 2
You have new mail in /var/spool/mail/root

1)The above problem has been resolved by adding library -lboost_thread-mt.
./configure --prefix=/app/tophat-2.0.12/ LDFLAGS="-lboost_thread-mt" | tee tophat.log

2)Root Cause of the Problem.
1)while compiling c++ file /app/setups/tophat-2.0.12/src/segment_juncs.cpp is unable to identify function name join() & thread().
2)while compiling C++ Header file /usr/include/boost/thread/detail/thread.hpp is unable to idetify function name thread_data_base()

3)How To Resolve These Problem
while compiling any open source we are facing undefined reference to function() or keyword like variable.this things are invoked from the LIBRARY or HEADER files, this files need to linked properly to configuration option.
Like LDFLAGS="-lboost_thread-mt"

4)Search Library Function
# grep -r thread_data_base /usr/ | tee /tmp/grep_r_thread_data_base_usr.log
# cat /tmp/grep_r_thread_data_base_usr.log | grep match
Binary file /usr/lib64/libboost_thread-mt.so.5 matches
Binary file /usr/lib64/libboost_thread-mt.so matches

To Confirm it.
# readelf -Ws /usr/lib64/libboost_thread-mt.so | grep --color join
    30: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_join@GLIBC_2.2.5 (2)
   126: 000000000000c090   901 FUNC    GLOBAL DEFAULT   11 _ZN5boost6thread4joinEv
   205: 000000000000a4b0    61 FUNC    GLOBAL DEFAULT   11 _ZNK5boost6thread8joinableEv
   238: 000000000000bb40  1351 FUNC    GLOBAL DEFAULT   11 _ZN5boost6thread10timed_joinERKNS_10posix_time5ptimeE


# readelf -Ws /usr/lib64/libboost_thread-mt.so | grep --color thread_data_base
    68: 0000000000212be0    40 OBJECT  WEAK   DEFAULT   20 _ZTVN5boost6detail16thread_data_baseE
    85: 0000000000010260    60 OBJECT  WEAK   DEFAULT   13 _ZTSN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEEE
    89: 000000000000d120    15 FUNC    WEAK   DEFAULT   11 _ZN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEED1Ev
   100: 000000000000ae20   238 FUNC    GLOBAL DEFAULT   11 _ZN5boost6detail16thread_data_baseD2Ev
   115: 000000000000abb0    24 FUNC    GLOBAL DEFAULT   11 _ZN5boost6detail23set_current_thread_dataEPNS0_16thread_data_baseE
   122: 000000000000d130    26 FUNC    WEAK   DEFAULT   11 _ZN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEE7disposeEv
   133: 000000000000d120    15 FUNC    WEAK   DEFAULT   11 _ZN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEED2Ev
   178: 0000000000212d60    24 OBJECT  WEAK   DEFAULT   20 _ZTIN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEEE
   202: 0000000000010100    34 OBJECT  WEAK   DEFAULT   13 _ZTSN5boost6detail16thread_data_baseE
   207: 0000000000212c20    40 OBJECT  WEAK   DEFAULT   20 _ZTIN5boost6detail16thread_data_baseE
   240: 0000000000212d20    56 OBJECT  WEAK   DEFAULT   20 _ZTVN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEEE
   281: 0000000000212c50    16 OBJECT  WEAK   DEFAULT   20 _ZTIN5boost23enable_shared_from_thisINS_6detail16thread_data_baseEEE
   301: 000000000000af20    18 FUNC    GLOBAL DEFAULT   11 _ZN5boost6detail16thread_data_baseD0Ev
   305: 000000000000d150     3 FUNC    WEAK   DEFAULT   11 _ZN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEE11get_deleterERKSt9type_info
   316: 0000000000010140    65 OBJECT  WEAK   DEFAULT   13 _ZTSN5boost23enable_shared_from_thisINS_6detail16thread_data_baseEEE
   326: 000000000000d160    19 FUNC    WEAK   DEFAULT   11 _ZN5boost6detail17sp_counted_impl_pINS0_16thread_data_baseEED0Ev
   337: 000000000000ae20   238 FUNC    GLOBAL DEFAULT   11 _ZN5boost6detail16thread_data_baseD1Ev
   340: 000000000000d0e0    50 FUNC    WEAK   DEFAULT   11 _ZN5boost10shared_ptrINS_6detail16thread_data_baseEE5resetEv

To Verify Manually
## g++ -L/usr/lib64/ -lboost_thread-mt
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
You have new mail in /var/spool/mail/root
it is SUCCESS.

Reference : Refer - http://stackoverflow.com/questions/7934176/compiling-c-source-file-using-boost-thread

0 comments:

Post a Comment