Ask Your Question
1

boost version for node with external class

asked 2012-05-14 07:19:27 -0500

g17 gravatar image

Hello, I'm using ros-electric on ubuntu 11.04, which brings boost1.42. Since even the latest ros&ubuntu- combination features only boost1.46.1 I have the problem of getting a later boost version to work. It has to be >1.47 due to the geometry-packages. Is there a safe way to get the whole ros to work with boost1.47 or even 1.49 ? Another idea was, since this boost-version is just used in one single class, how to tell 'rosmake' in the cmakelist usse it just once. This is my attempt so far:

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/local/boost_1_49_0")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/local/boost_1_49_0/libs")
set(BOOST_ROOT /usr/local/boost_1_49_0)
set(Boost_INCLUDE_DIR /usr/local/boost_1_49_0)
set(BOOST_LIBRARYDIR /usr/local/boost_1_49_0/libs)
    set(Boost_USE_STATIC_LIBS   ON)
    set(Boost_USE_MULTITHREADED ON)
    find_package(Boost 1.49.0 COMPONENTS geometry )

   if(Boost_FOUND)
      include_directories(${Boost_INCLUDE_DIRS})
   endif()
rosbuild_add_executable(shutter src/shutter.cpp src/geometry.cpp)
target_link_libraries(src/geometry.cpp ${Boost_LIBRARIES})

Might be a few to many 'set's, but it got the class compiled before(using 'cmake' without the 'rosbuild...'-commands).

rosmake gives me:

fatal error: boost/geometry.hpp: file not found

This at the point, where geometry.hpp is included in my source. Any way I can use my external class in my ros node ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-05-28 01:43:29 -0500

g17 gravatar image

Ok, how I solved it: I put the class with the higher boost requirements into a static library, leading cmake to use the boost version I wanted with the code above. Then compiled it. I referred to this library in the rest of the code, which I could then compile with 'rosmake'. Note: I had to delete any trace to boost in the library-header file. Also I did not see this solution first, since Im quite new to C++. The static library might get quite big, when not only the geometry-part of boost is included.

edit flag offensive delete link more

Comments

This sounds dangerous and unstable. I'd try to really solve the problem and not just patch it. this code might also be not portable

Moataz Elmasry gravatar imageMoataz Elmasry ( 2012-09-05 03:05:39 -0500 )edit
1

answered 2012-05-14 08:11:49 -0500

joq gravatar image

That sounds tricky.

I recommend installing the latest ROS and Ubuntu distributions: Fuerte on Ubuntu Precise (12.04). Some (not all) of those boost packages are at version 1.48. You should probably check the versions of the exact packages you require on the Ubuntu site, first.

That seems like the safest solution, unless Electric on Natty is a requirement for other reasons.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-05-14 07:19:27 -0500

Seen: 420 times

Last updated: May 28 '12