Skip to content

Commit

Permalink
compile ros_comm and run roscpp tests (there are some non-critical fa…
Browse files Browse the repository at this point in the history
…ilures)

Issues:
- some roswtf tests fail - not sure what the problem is

- Due to use of global variables there are issues with destruction of
global objects in various translation units, during the process
shutdown. This is related to Subscriber and Publisher and happens only
in executables where they are defined as global variables outside of
main. Example: some topic_tools components such as throttle

This is most likely related to the fact that now various components are
statically linked instead of dynamically. And for instance if an
executable depends on rosconsole, and we define a publisher as a global
object, when the program exits, the publisher is getting destroyed, but
other global variables get destroyed before that:

> Core was generated by `devel/lib/topic_tools/throttle messages /input 5'.
> Program terminated with signal SIGABRT, Aborted.
> #0  0x00007f277238c428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
> 54      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> [Current thread is 1 (Thread 0x7f2773b90780 (LWP 24620))]
> (gdb) bt
> #0  0x00007f277238c428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
> ros#1  0x00007f277238e02a in __GI_abort () at abort.c:89
> ros#2  0x00007f2772ccf7dd in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#3  0x00007f2772ccd6b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#4  0x00007f2772ccd701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#5  0x00007f2772cce23f in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#6  0x0000000000719a64 in boost::system::error_code::message[abi:cxx11]() const (this=0x1fb5f00)
>     at .../include/boost/system/error_code.hpp:477
> ros#7  0x000000000071a0ed in boost::system::system_error::what (this=0x1fb5ef0) at .../include/boost/system/system_error.hpp:70
> ros#8  0x00007f2772ccf805 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#9  0x00007f2772ccd6b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#10 0x00007f2772ccc6a9 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#11 0x00007f2772ccd005 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> ros#12 0x00007f2772730f83 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
> ros#13 0x00007f2772731487 in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1
> ros#14 0x000000000071a557 in boost::mutex::lock (this=0xbb7fa0 <ros::console::g_locations_mutex>)
>     at .../include/boost/thread/pthread/mutex.hpp:119
> ros#15 0x000000000071c723 in boost::unique_lock<boost::mutex>::lock (this=0x7fff031f4950)
>     at .../include/boost/thread/lock_types.hpp:346
> ros#16 0x000000000071bdeb in boost::unique_lock<boost::mutex>::unique_lock (this=0x7fff031f4950, m_=...)
>     at .../include/boost/thread/lock_types.hpp:124
> ros#17 0x0000000000718dae in ros::console::initializeLogLocation (loc=0xbb5c70 <ros::Publisher::Impl::~Impl()::__rosconsole_define_location__loc>, name="ros.roscpp",
>     level=ros::console::levels::Debug) at .../ros_comm/tools/rosconsole/src/rosconsole/rosconsole.cpp:632
> ros#18 0x00000000007278b6 in ros::Publisher::Impl::~Impl (this=0x1fb6730, __in_chrg=<optimised out>) at .../ros_comm/clients/roscpp/src/libros/publisher.cpp:40
> ros#19 0x00000000007299a9 in boost::detail::sp_ms_deleter<ros::Publisher::Impl>::destroy (this=0x1fb6728)
>     at .../include/boost/smart_ptr/make_shared_object.hpp:59
> ros#20 0x0000000000729b14 in boost::detail::sp_ms_deleter<ros::Publisher::Impl>::operator() (this=0x1fb6728)
>     at .../include/boost/smart_ptr/make_shared_object.hpp:93
> ros#21 0x0000000000729a53 in boost::detail::sp_counted_impl_pd<ros::Publisher::Impl*, boost::detail::sp_ms_deleter<ros::Publisher::Impl> >::dispose (this=0x1fb6710)
>     at .../include/boost/smart_ptr/detail/sp_counted_impl.hpp:172
> ros#22 0x0000000000707ab5 in boost::detail::sp_counted_base::release (this=0x1fb6710)
>     at .../include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp:110
> ros#23 0x0000000000707b41 in boost::detail::shared_count::~shared_count (this=0xbb7d28 <g_pub+8>, __in_chrg=<optimised out>)
>     at .../include/boost/smart_ptr/detail/shared_count.hpp:426
> ros#24 0x0000000000707ef4 in boost::shared_ptr<ros::Publisher::Impl>::~shared_ptr (this=0xbb7d20 <g_pub>, __in_chrg=<optimised out>)
>     at .../include/boost/smart_ptr/shared_ptr.hpp:341
> ros#25 0x0000000000727bce in ros::Publisher::~Publisher (this=0xbb7d20 <g_pub>, __in_chrg=<optimised out>)
>     at .../ros_comm/clients/roscpp/src/libros/publisher.cpp:74
> ros#26 0x00007f2772390ff8 in __run_exit_handlers (status=0, listp=0x7f277271b5f8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
> ros#27 0x00007f2772391045 in __GI_exit (status=<optimised out>) at exit.c:104
> ros#28 0x00007f2772377837 in __libc_start_main (main=0x706886 <main(int, char**)>, argc=4, argv=0x7fff031f4bf8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>,
>     stack_end=0x7fff031f4be8) at ../csu/libc-start.c:325
> ros#29 0x0000000000705bc9 in _start ()
  • Loading branch information
lsolanka committed Apr 13, 2018
1 parent 44d6fca commit 7de5ea1
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 18 deletions.
29 changes: 24 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,39 @@ HunterGate(
)

project(ros_comm)
hunter_add_package(Boost COMPONENTS regex system chrono signals thread)
hunter_add_package(Boost
COMPONENTS date_time filesystem program_options regex system chrono signals thread)
hunter_add_package(BZip2)
hunter_add_package(lz4)
hunter_add_package(catkin)
hunter_add_package(roscpp_core)
hunter_add_package(ros)
hunter_add_package(message_generation)
hunter_add_package(ros_comm_msgs)
hunter_add_package(ros-cmake_modules)

find_package(Boost CONFIG REQUIRED
COMPONENTS regex system chrono signals thread)
COMPONENTS date_time filesystem program_options regex system chrono signals thread)

add_subdirectory(tools/rosgraph)
add_subdirectory(tools/roslaunch)
add_subdirectory(tools/rosmaster)
add_subdirectory(tools/rosparam)
add_subdirectory(utilities/xmlrpcpp)
add_subdirectory(tools/rostest)
add_subdirectory(utilities/roswtf)
add_subdirectory(utilities/roslz4)
add_subdirectory(tools/rosconsole)
add_subdirectory(clients/roscpp)
add_subdirectory(clients/rospy)
add_subdirectory(utilities/roslz4)
add_subdirectory(tools/rostest)
add_subdirectory(tools/rosnode)
add_subdirectory(tools/rosbag_storage)
add_subdirectory(tools/topic_tools)
add_subdirectory(tools/rosbag)
add_subdirectory(tools/rostopic)
add_subdirectory(tools/rosmsg)
add_subdirectory(tools/rosout)
add_subdirectory(tools/rosservice)
add_subdirectory(utilities/roswtf)
add_subdirectory(ros_comm)

add_subdirectory(test/test_roscpp)
7 changes: 7 additions & 0 deletions clients/roscpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ add_library(roscpp

add_dependencies(roscpp ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

target_include_directories(roscpp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_INCLUDE_DESTINATION}/ros>
$<BUILD_INTERFACE:${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_INCLUDE_DESTINATION}>
$<INSTALL_INTERFACE:include>
)

target_link_libraries(roscpp
${catkin_LIBRARIES}
${Boost_LIBRARIES}
Expand Down
2 changes: 1 addition & 1 deletion test/test_roscpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
catkin_add_gtest(${PROJECT_NAME}-test_version test_version.cpp)
if(TARGET ${PROJECT_NAME}-test_version)
target_link_libraries(${PROJECT_NAME}-test_version)
target_link_libraries(${PROJECT_NAME}-test_version ${catkin_LIBRARIES})
endif()

catkin_add_gtest(${PROJECT_NAME}-test_header test_header.cpp)
Expand Down
19 changes: 15 additions & 4 deletions tools/rosbag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ if(NOT WIN32)
endif()

find_package(catkin REQUIRED COMPONENTS rosbag_storage rosconsole roscpp std_srvs topic_tools xmlrpcpp)
find_package(Boost REQUIRED COMPONENTS date_time regex program_options filesystem)
find_package(BZip2 REQUIRED)
find_package(Boost CONFIG REQUIRED COMPONENTS date_time regex program_options filesystem)
find_package(BZip2 CONFIG REQUIRED)

catkin_python_setup()

Expand All @@ -18,6 +18,7 @@ include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${BZIP2_INCLUDE_DIR}
)

set(PROJECT_INSTALLSPACE_LIBRARIES ros::rosbag)
catkin_package(
LIBRARIES rosbag
INCLUDE_DIRS include
Expand All @@ -28,8 +29,13 @@ add_library(rosbag
src/recorder.cpp
src/time_translator.cpp)

target_link_libraries(rosbag ${catkin_LIBRARIES} ${Boost_LIBRARIES}
${BZIP2_LIBRARIES}
target_link_libraries(rosbag ${catkin_LIBRARIES} Boost::date_time Boost::regex
Boost::program_options Boost::filesystem BZip2::bz2
)

target_include_directories(rosbag PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

add_executable(record src/record.cpp)
Expand All @@ -42,9 +48,14 @@ install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h")
install(TARGETS rosbag
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION share/${PROJECT_NAME}/cmake
NAMESPACE ros::
FILE ${PROJECT_NAME}Targets.cmake)
install(TARGETS record play
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Expand Down
21 changes: 16 additions & 5 deletions tools/rosbag_storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ endif()

find_package(console_bridge REQUIRED)
find_package(catkin REQUIRED COMPONENTS cpp_common roscpp_serialization roscpp_traits rostime roslz4)
find_package(Boost REQUIRED COMPONENTS date_time filesystem program_options regex)
find_package(BZip2 REQUIRED)
find_package(Boost CONFIG REQUIRED COMPONENTS date_time filesystem program_options regex)
find_package(BZip2 CONFIG REQUIRED)

set(PROJECT_INSTALLSPACE_LIBRARIES ros::rosbag_storage)
catkin_package(
INCLUDE_DIRS include
LIBRARIES rosbag_storage
CATKIN_DEPENDS roslz4
DEPENDS console_bridge Boost
DEPENDS console_bridge "Boost COMPONENTS date_time filesystem program_options regex"
)

# Support large bags (>2GB) on 32-bit systems
add_definitions(-D_FILE_OFFSET_BITS=64)

include_directories(include ${catkin_INCLUDE_DIRS} ${console_bridge_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
add_definitions(${BZIP2_DEFINITIONS})

add_library(rosbag_storage
src/bag.cpp
Expand All @@ -38,13 +38,24 @@ add_library(rosbag_storage
src/uncompressed_stream.cpp
)

target_link_libraries(rosbag_storage ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${BZIP2_LIBRARIES} ${console_bridge_LIBRARIES})
target_link_libraries(rosbag_storage ${catkin_LIBRARIES} ${Boost_LIBRARIES} BZip2::bz2 ${console_bridge_LIBRARIES})

target_include_directories(rosbag_storage PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

install(TARGETS rosbag_storage
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION share/${PROJECT_NAME}/cmake
NAMESPACE ros::
FILE ${PROJECT_NAME}Targets.cmake
)

install(DIRECTORY include/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
Expand Down
14 changes: 12 additions & 2 deletions tools/topic_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_service_files(DIRECTORY srv

generate_messages(DEPENDENCIES std_msgs)

set(PROJECT_INSTALLSPACE_LIBRARIES ros::topic_tools)
catkin_package(
INCLUDE_DIRS include
LIBRARIES topic_tools
Expand All @@ -34,6 +35,10 @@ catkin_add_env_hooks(20.transform SHELLS bash DIRECTORY ${CMAKE_CURRENT_SOURCE_D

add_library(topic_tools src/shape_shifter.cpp src/parse.cpp)
target_link_libraries(topic_tools ${catkin_LIBRARIES})
target_include_directories(topic_tools PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

add_executable(switch_mux src/switch_mux.cpp)
target_link_libraries(switch_mux topic_tools ${catkin_LIBRARIES})
Expand All @@ -56,9 +61,15 @@ add_executable(throttle src/throttle.cpp)
target_link_libraries(throttle topic_tools ${catkin_LIBRARIES})

install(TARGETS topic_tools
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION share/${PROJECT_NAME}/cmake
NAMESPACE ros::
FILE ${PROJECT_NAME}Targets.cmake
)

install(TARGETS switch_mux mux demux relay drop throttle
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Expand Down Expand Up @@ -88,9 +99,8 @@ if(CATKIN_ENABLE_TESTING)
endif()

if(GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(${PROJECT_NAME}-test_shapeshifter EXCLUDE_FROM_ALL test/test_shapeshifter.cpp)
target_link_libraries(${PROJECT_NAME}-test_shapeshifter ${GTEST_LIBRARIES} topic_tools)
target_link_libraries(${PROJECT_NAME}-test_shapeshifter GTest::main topic_tools)
endif()
if(TARGET tests)
add_dependencies(tests ${PROJECT_NAME}-test_shapeshifter)
Expand Down
7 changes: 6 additions & 1 deletion utilities/roslz4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ catkin_python_setup()

catkin_package(
INCLUDE_DIRS include
LIBRARIES ros::roslz4
LIBRARIES roslz4
DEPENDS lz4)

include_directories(include ${lz4_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
Expand All @@ -21,6 +21,11 @@ set_source_files_properties(
src/lz4s.c src/xxhash.c
PROPERTIES COMPILE_DEFINITIONS "XXH_NAMESPACE=ROSLZ4_")
target_link_libraries(roslz4 lz4::lz4 ${catkin_LIBRARIES})
target_include_directories(roslz4 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)


if(NOT ANDROID)
# Python bindings
Expand Down

0 comments on commit 7de5ea1

Please sign in to comment.