ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
6

Disabling boost for a custom package

asked 2011-05-13 02:31:32 -0600

migueloliveira gravatar image

updated 2012-03-06 05:55:12 -0600

mjcarroll gravatar image

Hello

I am new to ros.

I am trying to create a rospkg for the bumblebee XB3 camera from point grey.

I have followed all the documentation for creating a package and so on.

Problem is, i must use a closed library from point grey (triclops). This library uses multi thread and i think there is a problem with the ros cmake, namely on the boost options.

Basically, if i mannually compile a code (using g++ test.cpp -o test) it runs fine but if i compile using ros cmake it seg faults.

I experimented a bit and found that if i manually remove boost from the compilation line it works.

So my question is if there is someway of saying in the CMakeList.txt file that no boost libs are to be used.

Best regards

Miguel Oliveira

University of Aveiro

edit retag flag offensive close merge delete

10 Answers

Sort by ยป oldest newest most voted
1

answered 2011-11-17 23:56:51 -0600

Achim gravatar image

Just in case someone else stumples upon this... I ran into a similar problem. For me triclops always seg faulted in triclopsStereo. triclopsRectify did work (which uses the internal calibration of the bumblebee, that is why I wanted to use it). So I get the rectified images from triclops and passed them to an OpenCV StereoBM block matcher.

triclopsGetImage( triclops, TriImg_RECTIFIED, TriCam_RIGHT, &image_right );
triclopsGetImage( triclops, TriImg_RECTIFIED, TriCam_LEFT, &image_left );

cv::Mat img_r(480,640,CV_8UC1,image_right.data);
cv::Mat img_l(480,640,CV_8UC1,image_left.data);

block_matcher_(img_l,img_r,disparity);

This gives me real nice disparity images, seemingly even faster than triclops without any hastle of calibration or similar and without crashes, as it seems until now. :)

edit flag offensive delete link more
4

answered 2011-05-13 05:15:28 -0600

tfoote gravatar image

If you're using roscpp you cannnot just remove boost. It's heavily integrated into the functionality of the library.

edit flag offensive delete link more
1

answered 2011-05-13 03:56:47 -0600

dornhege gravatar image

There is rosbuild_add_boost_directories() which should add boost. But I guess you do not have this commented in. Do you use any other ROS includes in your programm that in turn might include boost?

If you change CMAKE_VERBOSE_MAKEFILE to true in build/CMakeCache.txt you can check the exact compilation that is exectued.

edit flag offensive delete link more
1

answered 2011-05-14 06:55:41 -0600

Bram van de Klundert gravatar image

updated 2011-05-14 06:57:37 -0600

a different solution to your problem might be to read the camera with libdc1394. point grey actually advices you to do so(http://www.ptgrey.com/support/kb/index.asp?a=4&q=26). for the bumblebee 2 there is a package (named bumblebee2 (http://www.ros.org/wiki/bumblebee2) that can be used as a reference if you desire to write your own node.

edit flag offensive delete link more
0

answered 2011-05-19 05:38:39 -0600

dornhege gravatar image

There is rosbuild_remove_link_flags(target flags). If that removes too much, you could then even add the link flags once manually afterwards. I won't give any guarantee for what's happening then.

edit flag offensive delete link more
0

answered 2012-03-30 10:08:24 -0600

mlanting gravatar image

I've been having this same problem. The quickest and easiest fix I've found so far is just to call triclopsSetMaxThreadCount and set it to 1. It hasn't segfaulted since I tried that, though it's not performing as well.

edit flag offensive delete link more
0

answered 2011-05-16 02:57:48 -0600

dornhege gravatar image

updated 2011-05-16 02:58:12 -0600

It seems that boost (with the pointgrey library) really is the problem. Unfortunately, yes, you do need roscpp for writing a C++ publisher.

Usually that should not happen. I don't know of a solution, but can you check what "ldd 'that pointgrey lib'" gives you. It should list the linked libraries. Possibly there is some conflict.

edit flag offensive delete link more

Comments

Yep you're right. I have just received an email from pointgrey saying they linked their library against boost 1.38. I am using boost 1.42. Perhaps this is the problem. Hopefully. Thanks for the fast repplys. I will get back ...
migueloliveira gravatar image migueloliveira  ( 2011-05-16 03:05:23 -0600 )edit
-1

answered 2011-05-19 03:21:03 -0600

migueloliveira gravatar image

Hello Dornhege

the point grey lib was actually compiled for libboost 1.37. I am trying to get another version compiled for the proper boost version but was still not able to convince them.

ROS uses version 1.42

I actually made a couple more tests and I think I am closer to the problem.

The problem is in -lboost_thread-mt

roscpp includes it in two separate parts of the linking instruction, which is something like this:

g++ test.cpp -o test -L -lboost_thread-mt (... a lot of stuff here...) -BStatic (... a lot of stuff here...) -Bdynamic -lboost_thread-mt (... a lot of stuff here...)

I do have the full linking instructions, if you want i can copy paste them here but they are very large.

What I have discovered is that if I remove the first -lboost_thread from the instruction (I do this manually) the code runs fine without a segmentation fault.

The second -lboost_thread DOES NOT CRASH the code.

Any idea why this happens? What is the difference between the first and second?

How can I remove the first in CMakeList.txt

Thanks very much for your help.

Miguel

edit flag offensive delete link more
-1

answered 2011-05-19 23:52:26 -0600

migueloliveira gravatar image

updated 2011-05-19 23:53:52 -0600

Hey

Thanks

I have tried to use rosbuild_remove_link_flags(). Something is wrong. I can't seem to make it work. No matter what I write there, it is always the same linking instruction.

I have also tried to print using CMakeLists.txt the variables ROS uses for creating the linking instruction and they are empty?

Do you know what i could be doing wrong?

Here is my CMakeLists.txt . My executable is named olaola. It links to libs triclops and pgrstereo and to all the ones in ROS.

1 cmake_minimum_required(VERSION 2.4.6) 2 include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 4 # Set the build type. Options are: 5 # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 # Debug : w/ debug symbols, w/o optimization 7 # Release : w/o debug symbols, w/ optimization 8 # RelWithDebInfo : w/ debug symbols, w/ optimization 9 # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 #set(ROS_BUILD_TYPE Coverage) 11 set(ROS_BUILD_TYPE Debug) 12 13 rosbuild_init() 14 15 #set the default path for built executables to the "bin" directory 16 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 17 #set the default path for built libraries to the "lib" directory 18 set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 19 20 #Adding triclops include directory 21 include_directories(/usr/local/include/triclops) 22 23 #Creating a pgr library 24 rosbuild_add_library(pgrlibdcstereo src/pgr_conversions.cpp src/pgr_registers. cpp src/pgr_stereocam.cpp) 25 26 #Creating olaola executable 27 rosbuild_add_executable(olaola src/test.cpp) 28 rosbuild_add_compile_flags(olaola -I/usr/local/include/triclops) 29 link_directories(/usr/local/lib/triclops/) 30 31 #Adding target link libs 32 target_link_libraries(olaola triclops) 33 target_link_libraries(olaola pnmutils) 34 target_link_libraries(olaola pgrlibdcstereo) 35 36 #Removing link and compile flags. Tried several none works 37 rosbuild_remove_link_flags(olaola "-Wl") 38 rosbuild_remove_link_flags(olaola "-lboost_thread-mt") 39 rosbuild_remove_compile_flags(olaola "-Wl") 40 41 #A test to try to figure out outs inside the CMAKE vars. the TESTVAR is just t o be sure I know how to print a variable. The other are to print the variable ROS uses for crating the linking instruction.
42 set(TESTVAR "this is the content of the test var") 43 MESSAGE("TESTVAR = ${TESTVAR}") 44 45 MESSAGE(STATUS "MYLINKFLAGS ARE =" ${LINK_FLAGS}) 46 MESSAGE(STATUS "MY CMAKE_EXE_LINKER_FLAGS ARE =" ${CMAKE_EXE_LINKER_FLAGS}) 47 MESSAGE(STATUS "MY ROS_LINK_LIBS =" ${ROS_LINK_LIBS})

And the output of these prints is:

mike@BLACKBANDIT:~/workingcopy/arpua/sensors/camera/xb3$ make -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done [rosbuild] Building package xb3 [rosbuild] Cached build flags older than manifests; calling rospack to get flags [rosbuild] Including /opt/ros/diamondback/stacks/ros_comm/clients/rospy/cmake/rospy.cmake [rosbuild] Including /opt/ros/diamondback/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake [rosbuild] Including /opt/ros/diamondback ... (more)

edit flag offensive delete link more
-1

answered 2011-05-16 02:00:42 -0600

migueloliveira gravatar image

Thanks all for answering my question.

I will try to answer to all and ask new questions while im at it :)

Basically the segmentation fault I mention is in a thread related function of point greys library. triclopsSetMaxThread().

Regarding the sugestion of Bram van de Klundert:

This is not an option since i need to use the library provided by point grey to perform stereo calculation. I mean, i could just implement image acquisition with libdc1394 but for stereo calculation i would have to use triclops and the problem would still exist.

Regarding tfoote

Ok. Disabling boost is not an option. Just a question: i do need roscpp for making a publisher in c++ right?

Regarding dornhedge

I took a look at what the Makefile (or cmake) is doing (using your verbose). Basically, the problem i found is that (after i have added all required rosdeps) the make is actually doing the following (please be patient its a long instruction). I just found that if i take away the boost related libs (I will highlight them in bold for easy identification) (i did this mannually) the segmentation fault problem disapears.

This is why i wanted to disable boost in the first place.

/usr/bin/g++ -Wl,-rpath,/home/mike/workingcopy/libdc1394v2/libdc1394v2/lib -Wl,-rpath,/opt/ros/diamondback/stacks/image_common/camera_calibration_parsers/lib -Wl,-rpath,/opt/ros/diamondback/stacks/common/yaml_cpp/yaml-cpp/lib -Wl,-rpath,/opt/ros/diamondback/stacks/image_common/image_transport/lib -Wl,-rpath,/opt/ros/diamondback/stacks/common/pluginlib/lib -Wl,-rpath,/opt/ros/diamondback/stacks/common/tinyxml -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/utilities/message_filters/lib -Wl,-rpath,/opt/ros/diamondback/stacks/common_msgs/sensor_msgs/lib -Wl,-rpath,/opt/ros/diamondback/stacks/driver_common/dynamic_reconfigure/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/lib -Wl,-rpath,/opt/ros/diamondback/stacks/vision_opencv/cv_bridge/lib -Wl,-rpath,/opt/ros/diamondback/stacks/vision_opencv/opencv2/opencv/lib -Wl,-rpath,/opt/ros/diamondback/stacks/common_msgs/sensor_msgs/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/tools/rosbag/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/tools/topic_tools/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_serialization/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/utilities/xmlrpcpp/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/tools/rosconsole/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/utilities/rostime/lib -Wl,-rpath,/opt/ros/diamondback/stacks/ros_comm/utilities/cpp_common/lib -Wl,-rpath,/opt/ros/diamondback/ros/core/roslib/lib -Wl,-rpath,/opt/ros/diamondback/ros/tools/rospack/lib -pthread CMakeFiles/xb3.dir/src/xb3.o -o ../bin/xb3 -rdynamic -L/home/mike/workingcopy/libdc1394v2/libdc1394v2/lib -L/opt/ros/diamondback/stacks/image_common/camera_calibration_parsers/lib -L/opt/ros/diamondback/stacks/common/yaml_cpp/yaml-cpp/lib -L/opt/ros/diamondback/stacks/image_common/image_transport/lib -L/opt/ros/diamondback/stacks/common/pluginlib/lib -L/opt/ros/diamondback/stacks/common/tinyxml -L/opt/ros/diamondback/stacks/ros_comm/utilities/message_filters/lib -L/opt/ros/diamondback/stacks/common_msgs/sensor_msgs/lib ... (more)

edit flag offensive delete link more

Comments

please ask a new question. This is a Q&A format site not a mailing list, and questions in answers will get lost.
tfoote gravatar image tfoote  ( 2011-05-16 12:23:12 -0600 )edit
Do you need to use the point grey stereo library? There's one in ROS too http://www.ros.org/wiki/stereo_image_proc
tfoote gravatar image tfoote  ( 2011-05-16 12:25:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-05-13 02:31:32 -0600

Seen: 2,096 times

Last updated: Mar 30 '12