Ask Your Question
1

Building catkin package with external dependency

asked 2013-12-31 03:44:02 -0600

Pi Robot gravatar image

updated 2013-12-31 14:19:15 -0600

Hello,

I am trying to build a catkin package (skeleton_markers) that depends on the Ubuntu packages freeglut3 and freeglut3-dev. I tried to use:

find_package(PkgConfig)
pkg_check_modules(GLUT freeglut3)

and I added

<build_depend>freeglut3-dev</build_depend>

and

<run_depend>freeglut3</run_depend>

to my package.xml file but it turns out that freeglut3 does not have a .pc file so pkg-config cannot find it. After checking the catkin docs, I still cannot figure out how to add this external dependency to my build files.

P.S. The truth is I can use the following hack to get it to work on my machine:

# Find Glut
find_path(GLUT_INCLUDE_DIRS
          NAMES glut.h
          HINTS /usr/include/GL /usr/local/include/GL)
find_library(GLUT_LIBRARIES
             NAMES libglut.so)

but this does not work on the ROS build farm because presumably it doesn't have freeglut3 installed and also, I need a user's machine to automatically install freeglut3 if it is not installed.

--patrick

UPDATE: Here are my package.xml and CMakeLists.txt files as well as a link to the latest build failure on Jenkins. The root of the problem seems to be the error message :

skeleton_markers/ARCH_PARAM/amd64/UBUNTU_PARAM/precise/label/prerelease/jenkins_scripts/rosdep.py", line 51, in to_apt
    return self.r2a[ros_entry]
KeyError: 'freeglut3-dev

Link to Jenkins console output.

package.xml file:

<package>
  <name>skeleton_markers</name>
  <version>0.4.1</version>
  <description>
   Skeleton Markers: Publish a list of joint markers 
   for viewing in RViz.
  </description>

  <maintainer <a href="mailto:email="patrick@pirobot.org">Patrick">email="patrick@pirobot.org">Patrick</a> Goebel</maintainer>
  <license>BSD</license>
  <url type="website">http://ros.org/wiki/skeleton_markers</url>
  <url type="https://github.com/pirobot/skeleton_markers/issues"></url>
  <author <a href="mailto:email="patrick@pirobot.org">Patrick">email="patrick@pirobot.org">Patrick</a> Goebel</author>

  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>libopenni-dev</build_depend>
  <build_depend>libopenni-nite-dev</build_depend>
  <build_depend>libopenni-sensor-primesense-dev</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>tf</build_depend>
  <build_depend>orocos_kdl</build_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>visualization_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>openni_camera</build_depend>
  <build_depend>openni_tracker</build_depend>
  <build_depend>freeglut3-dev</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>roscpp</build_depend>

  <run_depend>libopenni-dev</run_depend>
  <run_depend>libopenni-nite-dev</run_depend>
  <run_depend>libopenni-sensor-primesense-dev</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>orocos_kdl</run_depend>
  <run_depend>message_runtime</run_depend>
  <run_depend>visualization_msgs</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>tf</run_depend>
  <run_depend>openni_camera</run_depend>
  <run_depend>openni_tracker</run_depend>
  <run_depend>freeglut3-dev</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>roscpp</run_depend>

</package>

CMakeLists.xml file:

cmake_minimum_required(VERSION 2.8.3)
project(skeleton_markers)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    tf
    geometry_msgs
    message_generation)

# Find Orocos KDL
find_package(orocos_kdl REQUIRED)

# Find OpenNI
find_package(PkgConfig)
pkg_check_modules(OpenNI REQUIRED libopenni)

# Find Glut
find_package(GLUT REQUIRED)

link_directories(
  ${catkin_LIBRARY_DIRS}
  ${Boost_LIBRARY_DIRS}
  ${orocos_kdl_LIBRARY_DIRS}
  ${OpenNI_LIBRARIES}
  ${GLUT_LIBRARIES}
)

include_directories(${catkin_INCLUDE_DIRS}
                    ${OpenNI_INCLUDE_DIRS}
                    ${GLUT_INCLUDE_DIRS}
                    ${orocos_kdl_INCLUDE_DIRS})

catkin_python_setup()

add_message_files (
  FILES
  Skeleton.msg
)

generate_messages(
    DEPENDENCIES geometry_msgs std_msgs
)

catkin_package(
    DEPENDS openni_camera openni_tracker
    CATKIN DEPENDS message_runtime
    rospy
    roscpp
    tf
    visualization_msgs
    std_msgs
    geometry_msgs
)

add_executable(skeleton_tracker
  src/skeleton_tracker.cpp
  src/KinectController.cpp
  src/KinectDisplay.cpp)

target_link_libraries(skeleton_tracker
  ${catkin_LIBRARIES}
  ${OpenNI_LIBRARIES}
  ${GLUT_LIBRARIES}
  ${orocos_kdl_LIBRARIES})

#install(TARGETS skeleton_tracker RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

message("DEBUG variable catkin_INCLUDE_DIRS: ${catkin_INCLUDE_DIRS}")
message("DEBUG variable OpenNI_INCLUDE_DIRS: ${OpenNI_INCLUDE_DIRS}")
message("DEBUG variable GLUT_INCLUDE_DIRS: ${GLUT_INCLUDE_DIRS}")
message("DEBUG variable orocos_kdl_INCLUDE_DIRS: ${orocos_kdl_INCLUDE_DIRS}")
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-12-31 15:20:09 -0600

Pi Robot gravatar image

After much Googling about Glut and CMake, I finally found the magic fix. Turns out I need the following depends in my package.xml file:

<build_depend>glut</build_depend>
<build_depend>libxmu-dev</build_depend>
<build_depend>libxi-dev</build_depend>

And the following in my CMakeLists.txt file:

find_package(GLUT REQUIRED)

This combination resulted in a successful build on Jenkins.

--patrick

edit flag offensive delete link more
1

answered 2013-12-31 05:01:57 -0600

joq gravatar image

There is a rosdep defined for freeglut3-dev, but not for freeglut3.

What happens if you change the <run_depend> to freeglut3-dev?

What does the build failure say? (You could post a link.)

edit flag offensive delete link more

Comments

Thanks @joq and happy New Year! I gave that a try and it didn't fix the build failure. I got a little further by using "glut" instead of freeglut3-dev since I discovered that is the proper key in rosdep. I also added finding_package(GLUT REQUIRED) to my CMakeLists.txt file. However I still get a build error on Jenkins. I have updated my question with my current package.xml and CMakeLists.txt files as well as a link to the latest build failure message on Jenkins.

Pi Robot gravatar imagePi Robot ( 2013-12-31 14:19:39 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-12-31 03:44:02 -0600

Seen: 2,992 times

Last updated: Dec 31 '13