[mira_talk] CentOS5 installation: BOOST problems and resolution

  • From: Leighton Pritchard <Leighton.Pritchard@xxxxxxxxxx>
  • To: "mira_talk@xxxxxxxxxxxxx" <mira_talk@xxxxxxxxxxxxx>
  • Date: Wed, 26 Jan 2011 10:27:28 +0000

Hi,

Just in case anyone else runs into similar problems (or there's an
opportunity to fix the underlying problem), I thought it might be useful to
post here on the issues I had with BOOST, when getting MIRA to install on
CentOS5.

Starting from a pretty standard CentOS5 with nearly all CentOS base/EL
packages (we're discouraged from straying by IT policy), flex and BOOST
versions are too old for MIRA's liking.  Both are straightforward-ish to
install from source, but the standard flex installation does not place a
symlink for flex++ (which should point to the flex binary), so the configure
script reports a version mismatch until this is fixed.

Having built BOOST with

$ ./bootstrap.sh --with-libraries=all --prefix=/usr/local
$ sudo ./bjam threading=multi install

Which places it in /usr/local (but with the system BOOST library still in
place), the configure script tells me that everything is OK, but throws this
error:

/bin/sh ../../libtool --tag=CXX   --mode=link g++ -pthread -I/usr/include
-DPUBLICQUIET -DAJ_Linux64   -I/usr/local/include -O3 -funroll-loops
-pthread -I/usr/include -L../io/ -L../util/ -L../errorhandling/ -L../mira
-L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf -L/usr/lib64
-L/usr/local/lib -L/usr/lib -L/usr/lib64 -lboost_thread -lboost_regex -o
mira_101 mira_101.o -lmira  -lmiraEdIt -lmiraExamine -lmirasupport
-lmiraestass -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio
-lmiracaf -lmiraKNN_abi373 -lm -lexpat -lz -lboost_thread  -lboost_regex
-lz  -ltcmalloc_minimal
libtool: link: g++ -pthread -I/usr/include -DPUBLICQUIET -DAJ_Linux64
-I/usr/local/include -O3 -funroll-loops -pthread -I/usr/include -o mira_101
mira_101.o  -L/home/lpritc/mira-3.2.1/src/io
-L/home/lpritc/mira-3.2.1/src/util
-L/home/lpritc/mira-3.2.1/src/errorhandling
-L/home/lpritc/mira-3.2.1/src/mira -L/home/lpritc/mira-3.2.1/src/examine
-L/home/lpritc/mira-3.2.1/src/EdIt -L/home/lpritc/mira-3.2.1/src/caf
-L/home/lpritc/mira-3.2.1/src/knn_abi373
-L/home/lpritc/mira-3.2.1/src/knn_alf -L/usr/lib64 -L/usr/local/lib
-L/usr/lib -lmira -lmiraEdIt -lmiraExamine -lmirasupport -lmiraestass
-lmiraerrorhandling -lmirautil -lmiradptools -lmirafio -lmiracaf
-lmiraKNN_abi373 -lm /usr/lib64/libexpat.so -lboost_thread -lboost_regex -lz
/usr/local/lib/libtcmalloc_minimal.so -pthread -Wl,-rpath -Wl,/usr/lib64
-Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath
-Wl,/usr/local/lib
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o): In function
`Skim::checkForHashes(signed char)':
skim.C:(.text+0x2d8d): undefined reference to
`boost::this_thread::disable_interruption::disable_interruption()'
skim.C:(.text+0x2e07): undefined reference to
`boost::this_thread::disable_interruption::~disable_interruption()'
skim.C:(.text+0x2e39): undefined reference to `vtable for
boost::detail::thread_data_base'
skim.C:(.text+0x2fe0): undefined reference to
`boost::thread::start_thread()'
skim.C:(.text+0x34aa): undefined reference to
`boost::this_thread::disable_interruption::disable_interruption()'
skim.C:(.text+0x351d): undefined reference to
`boost::this_thread::disable_interruption::~disable_interruption()'
skim.C:(.text+0x374a): undefined reference to
`boost::this_thread::disable_interruption::~disable_interruption()'
skim.C:(.text+0x39ca): undefined reference to
`boost::this_thread::disable_interruption::~disable_interruption()'
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o): In function
`boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void,
Skim, unsigned int>, boost::_bi::list2<boost::reference_wrapper<Skim>,
boost::_bi::value<unsigned int> > > >::~thread_data()':
skim.C:(.text._ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf1Iv4S
kimjEENS2_5list2INS_17reference_wrapperIS6_EENS2_5valueIjEEEEEEED0Ev[boost::
detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void, Skim,
unsigned int>, boost::_bi::list2<boost::reference_wrapper<Skim>,
boost::_bi::value<unsigned int> > > >::~thread_data()]+0xc): undefined
reference to `boost::detail::thread_data_base::~thread_data_base()'
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o): In function
`boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void,
Skim, unsigned int>, boost::_bi::list2<boost::reference_wrapper<Skim>,
boost::_bi::value<unsigned int> > > >::~thread_data()':
skim.C:(.text._ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf1Iv4S
kimjEENS2_5list2INS_17reference_wrapperIS6_EENS2_5valueIjEEEEEEED1Ev[boost::
detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void, Skim,
unsigned int>, boost::_bi::list2<boost::reference_wrapper<Skim>,
boost::_bi::value<unsigned int> > > >::~thread_data()]+0x8): undefined
reference to `boost::detail::thread_data_base::~thread_data_base()'
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o): In function
`boost::condition_variable::wait(boost::unique_lock<boost::mutex>&)':
skim.C:(.text._ZN5boost18condition_variable4waitERNS_11unique_lockINS_5mutex
EEE[boost::condition_variable::wait(boost::unique_lock<boost::mutex>&)]+0x33
): undefined reference to `boost::detail::get_current_thread_data()'
skim.C:(.text._ZN5boost18condition_variable4waitERNS_11unique_lockINS_5mutex
EEE[boost::condition_variable::wait(boost::unique_lock<boost::mutex>&)]+0x98
): undefined reference to `boost::this_thread::interruption_point()'
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o): In function `void
boost::condition_variable_any::wait<boost::unique_lock<boost::mutex>
>(boost::unique_lock<boost::mutex>&)':
skim.C:(.text._ZN5boost22condition_variable_any4waitINS_11unique_lockINS_5mu
texEEEEEvRT_[void 
boost::condition_variable_any::wait<boost::unique_lock<boost::mutex>
>(boost::unique_lock<boost::mutex>&)]+0x33): undefined reference to
`boost::detail::get_current_thread_data()'
skim.C:(.text._ZN5boost22condition_variable_any4waitINS_11unique_lockINS_5mu
texEEEEEvRT_[void 
boost::condition_variable_any::wait<boost::unique_lock<boost::mutex>
>(boost::unique_lock<boost::mutex>&)]+0x93): undefined reference to
`boost::this_thread::interruption_point()'
/home/lpritc/mira-3.2.1/src/mira/libmira.a(skim.o):(.rodata._ZTIN5boost6deta
il11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf1Iv4SkimjEENS2_5list2INS_17refere
nce_wrapperIS6_EENS2_5valueIjEEEEEEEE[typeinfo for
boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void,
Skim, unsigned int>, boost::_bi::list2<boost::reference_wrapper<Skim>,
boost::_bi::value<unsigned int> > > >]+0x10): undefined reference to
`typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status
make[2]: *** [mira_101] Error 1
make[2]: Leaving directory
`/home/lpritc/mira-3.2.1/src/examples_programming'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lpritc/mira-3.2.1/src'
make: *** [all-recursive] Error 1

Inspection of the configure script output tells me that it isn't looking in
the right places for all the BOOST components, specifically BOOST_CPPFLAGS,
which should point to /usr/local/include:

+++++++++++++++++++++++++++++++++++++
 BOOST_CPPFLAGS:    -pthread -I/usr/include
 BOOST LDFLAGS:     -L/usr/lib64
 ac_boost_path:    
 ac_boost_lib_path:
 BOOST_REGEX_LIB:   -lboost_regex

CFLAGS now:   -I/usr/local/include -O3 -funroll-loops
CXXFLAGS now: -DAJ_Linux64   -I/usr/local/include -O3 -funroll-loops
-pthread -I/usr/include
LDFLAGS now:  -L/usr/local/lib -L/usr/lib -L/usr/lib64 -lboost_thread
-lboost_regex
+++++++++++++++++++++++++++++++++++++

And this is true even when using the notes in INSTALL:

[ok] CentOS: you might need to configure like this:
     LDFLAGS="$LDFLAGS -L/usr/lib64" LIBS="-lexpat" ./configure

(the -lexpat trick isn't needed).

Or when setting BOOST_ROOT to /usr/local

Using --with-boost=/usr/local gives a completely different error:

$ ./configure --prefix=/usr/local --with-boost=/usr/local

[...]
Automatic recognition of Boost thread lib failed? I have
////// BOOST_CPPFLAGS:    -pthread -I/usr/local/include
////// BOOST LDFLAGS:     -L/usr/local/lib64
////// ac_boost_path:     /usr/local
////// ac_boost_lib_path:
////// BOOST_THREAD_LIB:
////// BOOST_ROOT: 
Please give the configure script the location of your BOOST
 libraries. Or, if needed, the name of your thread library (without
 'lib' in front):
   --with-boost=DIR
or --with-boost-libdir=LIB_DIR
or --with-boost-thread=special-lib

I looked into the configure script, assuming that there must be some issue
with recognition of the libraries, but rapidly decided that messing around
in there was a bad idea.  Since the only configuration issue obvious from
the output when not setting --with-boost was the setting of BOOST_CPPFLAGS,
I modified the Makefile directly to set

BOOST_CPPFLAGS = -pthread -I/usr/local/include

This failed as before.

I then removed the system BOOST libraries (leaving only those in
/usr/local).  This resolved the issue, and allowed MIRA to build.  The demos
that have accessible data run correctly.

Interestingly, although MIRA will build at this point, the configuration
script fails with the message that it can't autorecognise the BOOST thread
lib.  This is true even when specifying the correct library with ./configure
--with-boost-thread=...

I hope this is useful to someone.  If anyone reading this spots something
simple I've overlooked, I'd be grateful for the pointers.

Cheers,

L.

-- 
Dr Leighton Pritchard MRSC
D131, Plant Pathology Programme, SCRI
Errol Road, Invergowrie, Perth and Kinross, Scotland, DD2 5DA
e:lpritc@xxxxxxxxxx       w:http://www.scri.ac.uk/staff/leightonpritchard
gpg/pgp: 0xFEFC205C       tel:+44(0)1382 562731 x2405


______________________________________________________
SCRI, Invergowrie, Dundee, DD2 5DA.  
The Scottish Crop Research Institute is a charitable company limited by 
guarantee. 
Registered in Scotland No: SC 29367.
Recognised by the Inland Revenue as a Scottish Charity No: SC 006662.


DISCLAIMER:

This email is from the Scottish Crop Research Institute, but the views 
expressed by the sender are not necessarily the views of SCRI and its 
subsidiaries.  This email and any files transmitted with it are confidential to 
the intended recipient at the e-mail address to which it has been addressed.  
It may not be disclosed or used by any other than that addressee.
If you are not the intended recipient you are requested to preserve this 
confidentiality and you must not use, disclose, copy, print or rely on this 
e-mail in any way. Please notify postmaster@xxxxxxxxxx quoting the name of the 
sender and delete the email from your system.

Although SCRI has taken reasonable precautions to ensure no viruses are present 
in this email, neither the Institute nor the sender accepts any responsibility 
for any viruses, and it is your responsibility to scan the email and the 
attachments (if any).
______________________________________________________

--
You have received this mail because you are subscribed to the mira_talk mailing 
list. For information on how to subscribe or unsubscribe, please visit 
http://www.chevreux.org/mira_mailinglists.html

Other related posts: