|
From: Plug G. <plu...@gm...> - 2012-04-18 14:40:42
|
The failure to detect Boost is indeed due to the linker error when the
configure script tries to build the test code. I checked the
config.log file and the command used to build the test code is as
follows:
g++ -o conftest -lboost_thread-mt -m64 conftest.cpp
which causes the build to fail with the same errors mentioned in my
previous email. So what do I change in the configure.in file so that
the build command line arguments are generated as follows:
g++ conftest.cpp -o conftest -lboost_thread-mt -m64
Thanks and regards,
~Plug
On Wed, Apr 18, 2012 at 3:28 PM, Plug Gulp <plu...@gm...> wrote:
> Hi,
>
> I am trying to build Valgrind 3.7.0 on Ubuntu 11.10 x86_64. I have
> Boost 1.46 pre-installed on my system. The boost libraries are
> installed under /usr/lib and the headers are under /usr/include. When
> I try to configure Valgrind for build by running the configure script
> as follows, the script thinks boost is not available on the system
> where as it is indeed available:
>
> $ ./configure
> :
> :
> checking for boost... no
> :
> :
> Maximum build arch: amd64
> Primary build arch: amd64
> Secondary build arch:
> Build OS: linux
> Primary build target: AMD64_LINUX
> Secondary build target:
> Platform variant: vanilla
> Primary -DVGPV string: -DVGPV_amd64_linux_vanilla=1
> Default supp files: exp-sgcheck.supp xfree-3.supp
> xfree-4.supp glibc-2.X-drd.supp glibc-2.34567-NPTL-helgrind.supp
> glibc-2.X.supp
> $
>
>
> Even though Boost development libraries are installed on my system,
> the configure script fails to detect it. I looked at the configure.in
> file and checked the section in the file where Boost detection is
> done:
>
> AC_MSG_CHECKING([for boost])
>
> AC_LANG(C++)
> safe_CXXFLAGS=$CXXFLAGS
> CXXFLAGS="-lboost_thread-mt $mflag_primary"
>
> AC_LINK_IFELSE([AC_LANG_SOURCE([
> #include <boost/thread.hpp>
> static void thread_func(void)
> { }
> int main(int argc, char** argv)
> {
> boost::thread t(thread_func);
> return 0;
> }
> ])],
> [
> ac_have_boost_1_35=yes
> AC_SUBST([BOOST_CFLAGS], [])
> AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
> AC_MSG_RESULT([yes])
> ], [
> ac_have_boost_1_35=no
> AC_MSG_RESULT([no])
> ])
>
> CXXFLAGS=$safe_CXXFLAGS
> AC_LANG(C)
>
> AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
>
>
>
> From the above section we can see that there is a small piece of code
> compiled and linked with libboost_thread-mt library to check whether
> Boost is supported on the platform. The code is as follows:
>
> #include <boost/thread.hpp>
> static void thread_func(void)
> { }
> int main(int argc, char** argv)
> {
> boost::thread t(thread_func);
> return 0;
> }
>
> I copied this code into a C++ source file and built it as follows:
>
> $ g++ -lboost_thread-mt test_boost.cpp
>
> I get following errors:
>
> /tmp/ccZFm6Ju.o: In function `main':
> test_boost.cpp:(.text+0x39): undefined reference to `boost::thread::~thread()'
> /tmp/ccZFm6Ju.o: In function
> `boost::detail::thread_data_base::thread_data_base()':
> test_boost.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24):
> undefined reference to `vtable for boost::detail::thread_data_base'
> /tmp/ccZFm6Ju.o: In function `boost::thread::thread<void (*)()>(void
> (*)(), boost::disable_if<boost::is_convertible<void (*&)(),
> boost::detail::thread_move_t<void (*)()> >,
> boost::thread::dummy*>::type)':
> test_boost.cpp:(.text._ZN5boost6threadC2IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[_ZN5boost6threadC5IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE]+0x30):
> undefined reference to `boost::thread::start_thread()'
> /tmp/ccZFm6Ju.o: In function `boost::detail::thread_data<void
> (*)()>::~thread_data()':
> test_boost.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f):
> undefined reference to
> `boost::detail::thread_data_base::~thread_data_base()'
> /tmp/ccZFm6Ju.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo
> for boost::detail::thread_data<void (*)()>]+0x10): undefined reference
> to `typeinfo for boost::detail::thread_data_base'
> collect2: ld returned 1 exit status
>
>
> But when I give the build command as follows in slightly different
> way, the build succeeds:
>
> $ g++ test_boost.cpp -lboost_thread-mt
>
>
> Is the above build failure the reason why Valgrind configure script
> thinks that boost is not available on the system? How do I fix the
> configure.in file to help Valgrind detect Boost?
>
> Thanks and regards,
>
> ~Plug
|