|
From: Plug G. <plu...@gm...> - 2012-04-18 14:28:31
|
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
|
|
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
|
|
From: Tom H. <to...@co...> - 2012-04-18 15:26:57
|
On 18/04/12 15:28, Plug Gulp wrote: > 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? Boost is not used by valgrind itself, so I wouldn't worry too much if configure can't find it. It just means some of the tests won't be able to be built. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: Plug G. <plu...@gm...> - 2012-04-18 15:07:46
|
Thanks for the info, Tom!
Anyway, I made following changes to the configure.in script and it
worked. Don't know whether they are correct.
AC_MSG_CHECKING([for boost])
AC_LANG(C++)
safe_CXXFLAGS=$CXXFLAGS
safe_LIBS=$LIBS
# CXXFLAGS="-lboost_thread-mt $mflag_primary"
CXXFLAGS="$mflag_primary"
LIBS="-lboost_thread-mt $LIBS"
BST_FLAGS="$CXXFLAGS $LIBS"
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_SUBST([BOOST_LIBS], ["${BST_FLAGS}"])
AC_MSG_RESULT([yes])
], [
ac_have_boost_1_35=no
AC_MSG_RESULT([no])
])
LIBS=$safe_LIBS
CXXFLAGS=$safe_CXXFLAGS
AC_LANG(C)
AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
Now the commandline generated to build the test code is:
g++ -o conftest -m64 conftest.cpp -lboost_thread-mt
Thanks and regards,
~Plug
On Wed, Apr 18, 2012 at 3:49 PM, Tom Hughes <to...@co...> wrote:
> On 18/04/12 15:28, Plug Gulp wrote:
>
>> 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?
>
>
> Boost is not used by valgrind itself, so I wouldn't worry too much if
> configure can't find it. It just means some of the tests won't be able to be
> built.
>
> Tom
>
> --
> Tom Hughes (to...@co...)
> http://compton.nu/
|
|
From: Bart V. A. <bva...@ac...> - 2012-04-18 18:35:42
|
On 04/18/12 14:28, Plug Gulp wrote: > Even though Boost development libraries are installed on my system, > the configure script fails to detect it. Does trunk r12507 help ? Bart. |
|
From: Plug G. <plu...@gm...> - 2012-04-19 15:46:27
|
On Wed, Apr 18, 2012 at 7:35 PM, Bart Van Assche <bva...@ac...> wrote: > On 04/18/12 14:28, Plug Gulp wrote: > >> Even though Boost development libraries are installed on my system, >> the configure script fails to detect it. > > > Does trunk r12507 help ? > Just curious, is there a web interface for the Valgrind repo? Thanks and regards, ~Plug > Bart. |