Boost Update Issue with my code

2019-02-25 21:08发布

I recently updated my boost to 1.59 and installed in /usr/local. My system default is installed in /usr/ and is 1.46. I am using ubuntu 12.04.

My code base uses ROS Hydro (Robot Operating System). I have a rather large code base which was working fine before the update. But now I get

terminate called after throwing an instance of 'boost::thread_interrupted'

My Stack trace

0x00007ffff573d0d5 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  0x00007ffff573d0d5 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff574083b in __GI_abort () at abort.c:91
#2  0x00007ffff608f69d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff608d846 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff608d873 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff608d96e in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7f1cc3e in boost::this_thread::interruption_point() () from /usr/local/lib/libboost_thread.so.1.59.0
#7  0x00007ffff7001752 in bool boost::condition_variable::timed_wait<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> >(boost::unique_lock<boost::mutex>&, boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> const&) () from /opt/ros/hydro/lib/libroscpp.so
#8  0x00007ffff6fff429 in ros::CallbackQueue::callAvailable(ros::WallDuration) () from /opt/ros/hydro/lib/libroscpp.so
#9  0x00007ffff7045f90 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*) () from /opt/ros/hydro/lib/libroscpp.so
#10 0x00007ffff702cd1b in ros::spin() () from /opt/ros/hydro/lib/libroscpp.so
#11 0x000000000041b795 in main ()

It shows the exception originates from ros core library which should not be happening.

The ldd for the executable is :

    $ ldd devel/lib/visensor_node/visensor_nod
        linux-vdso.so.1 =>  (0x00007ffff934d000)
        libvisensor.so => /home/eeuser/ros_workspaces/HeloRosProject/devel/lib/libvisensor.so (0x00007f55489e10

00)
    libopencv_core.so.2.4 => /opt/ros/hydro/lib/libopencv_core.so.2.4 (0x00007f55485b6000)
    libopencv_calib3d.so.2.4 => /opt/ros/hydro/lib/libopencv_calib3d.so.2.4 (0x00007f5548321000)
    libimage_transport.so => /opt/ros/hydro/lib/libimage_transport.so (0x00007f55480a0000)
    libroslib.so => /opt/ros/hydro/lib/libroslib.so (0x00007f5547e8f000)
    libroscpp.so => /opt/ros/hydro/lib/libroscpp.so (0x00007f5547b53000)
    librosconsole.so => /opt/ros/hydro/lib/librosconsole.so (0x00007f554792d000)
    libdynamic_reconfigure_config_init_mutex.so => /opt/ros/hydro/lib/libdynamic_reconfigure_config_init_mutex.so (0x00007f5547727000)
    libroscpp_serialization.so => /opt/ros/hydro/lib/libroscpp_serialization.so (0x00007f5547524000)
    librostime.so => /opt/ros/hydro/lib/librostime.so (0x00007f55472fd000)
    libboost_system.so.1.46.1 => /usr/lib/libboost_system.so.1.46.1 (0x00007f55470cb000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5546eae000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5546bae000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f55468b1000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f554669b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f55462dc000)
    libboost_thread.so.1.59.0 => /usr/local/lib/libboost_thread.so.1.59.0 (0x00007f55462b6000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5548a79000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f554609f000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f5545e97000)
    libopencv_flann.so.2.4 => /opt/ros/hydro/lib/libopencv_flann.so.2.4 (0x00007f5545c24000)
    libopencv_imgproc.so.2.4 => /opt/ros/hydro/lib/libopencv_imgproc.so.2.4 (0x00007f5545790000)
    libopencv_features2d.so.2.4 => /opt/ros/hydro/lib/libopencv_features2d.so.2.4 (0x00007f55454e9000)
    libmessage_filters.so => /opt/ros/hydro/lib/libmessage_filters.so (0x00007f55452e3000)
    libtinyxml.so.2.6.2 => /usr/lib/libtinyxml.so.2.6.2 (0x00007f55450ce000)
    libclass_loader.so => /opt/ros/hydro/lib/libclass_loader.so (0x00007f5544eb1000)
    libboost_signals.so.1.46.1 => /usr/lib/libboost_signals.so.1.46.1 (0x00007f5544c9c000)
    libboost_filesystem.so.1.46.1 => /usr/lib/libboost_filesystem.so.1.46.1 (0x00007f5544a7e000)
    libconsole_bridge.so => /opt/ros/hydro/lib/libconsole_bridge.so (0x00007f5544874000)
    librospack.so => /opt/ros/hydro/lib/librospack.so (0x00007f554462c000)
    libboost_thread.so.1.46.1 => /usr/lib/libboost_thread.so.1.46.1 (0x00007f5544413000)
    libxmlrpcpp.so => /opt/ros/hydro/lib/libxmlrpcpp.so (0x00007f55441f5000)
    libcpp_common.so => /opt/ros/hydro/lib/libcpp_common.so (0x00007f5543fec000)
    librosconsole_log4cxx.so => /opt/ros/hydro/lib/librosconsole_log4cxx.so (0x00007f5543dda000)
    librosconsole_backend_interface.so => /opt/ros/hydro/lib/librosconsole_backend_interface.so (0x00007f5543bd8000)
    liblog4cxx.so.10 => /usr/lib/liblog4cxx.so.10 (0x00007f55437f8000)
    libboost_regex.so.1.46.1 => /usr/lib/libboost_regex.so.1.46.1 (0x00007f55434f6000)
    libboost_system.so.1.59.0 => /usr/local/lib/libboost_system.so.1.59.0 (0x00007f55434f0000)
    libPocoFoundation.so.9 => /usr/lib/libPocoFoundation.so.9 (0x00007f554319f000)
    libboost_program_options.so.1.46.1 => /usr/lib/libboost_program_options.so.1.46.1 (0x00007f5542f39000)
    libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f5542a3c000)
    libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00007f5542818000)
    libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00007f55425df000)
    libicuuc.so.48 => /usr/lib/libicuuc.so.48 (0x00007f5542275000)
    libicui18n.so.48 => /usr/lib/libicui18n.so.48 (0x00007f5541eac000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5541ca8000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f5541a6b000)
    libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f554180c000)
    libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f5541431000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f554122e000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f5540ff4000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f5540dca000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f5540bc5000)
    libicudata.so.48 => /usr/lib/libicudata.so.48 (0x00007f553f854000)

In particular this might be of interest :
$ ldd devel/lib/visensor_node/visensor_node  | grep lib\boost
    libboost_system.so.1.46.1 => /usr/lib/libboost_system.so.1.46.1 (0x00007fcc9abdb000)
    libboost_thread.so.1.59.0 => /usr/local/lib/libboost_thread.so.1.59.0 (0x00007fcc99dc6000)
    libboost_signals.so.1.46.1 => /usr/lib/libboost_signals.so.1.46.1 (0x00007fcc987ac000)
    libboost_filesystem.so.1.46.1 => /usr/lib/libboost_filesystem.so.1.46.1 (0x00007fcc9858e000)
    libboost_thread.so.1.46.1 => /usr/lib/libboost_thread.so.1.46.1 (0x00007fcc97f23000)
    libboost_regex.so.1.46.1 => /usr/lib/libboost_regex.so.1.46.1 (0x00007fcc97006000)
    libboost_system.so.1.59.0 => /usr/local/lib/libboost_system.so.1.59.0 (0x00007fcc97000000)
    libboost_program_options.so.1.46.1 => /usr/lib/libboost_program_options.so.1.46.1 (0x00007fcc96a49000)

ldd for libvisensor.so

linux-vdso.so.1 =>  (0x00007fff7e3fe000)
libboost_thread.so.1.59.0 => /usr/local/lib/libboost_thread.so.1.59.0 (0x00007f29b4b60000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f29b4832000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f29b4536000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f29b4320000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f29b3f60000)
/lib64/ld-linux-x86-64.so.2 (0x00007f29b4c1d000)
libboost_system.so.1.59.0 => /usr/local/lib/libboost_system.so.1.59.0 (0x00007f29b3f5b000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f29b3d53000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f29b3b35000)

I have noticed that for some funny reason, both boost libraries are linked ie. version 1.46 and also 1.59. How should I go about fixing this error?

标签: c++ boost ros
1条回答
啃猪蹄的小仙女
2楼-- · 2019-02-25 21:29

ROS Hydro is not compatible with Boost 1.59. If you install Boost 1.59 while ROS Hydro is also installed you are going to run into problems. As it is explained on the following page in ROS answers but I will also copy an excerpt from it for completeness on my answer.

The source installation of ROS will compile with other versions of boost, but due to the possibility of binary incompatibility, the binary versions of ROS must be installed with the same version of boost that they were built with. If you'd like to use ROS with a version of boost other than the standard version, you'll have to build ROS from source.

http://answers.ros.org/question/170406/ros-hydro-and-boost-148/

查看更多
登录 后发表回答