question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linking with Gazebo using Catkin fails

See original GitHub issue

Some of the exported flags (?) are being done incorrectly with Gazebo when using Catkin. @j-rivero indicates the problem is not within Gazebo because “We have built a lot of third party software on top of Gazebo so it should be related to catkin packages somehow.” Though, we’ve also built even more software with Catkin…

The original issue from bitbucket:

Based on discussions with @j-rivero on this gazebo_ros_pkgs pull request, I’ve isolated some sort of flag export build problem that results in the error:

CMake Error at /home/dave/ros/current/ws_gazebo_test/devel_release/share/base_pkg/cmake/base_pkgConfig.cmake:141 (message):
  Project 'dummy_pkg' tried to find library '-lpthread'.  The library is
  neither a target nor built/installed properly.  Did you compile project
  'base_pkg'? Did you find_package() it before the subdirectory containing
  its code is included?
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
  CMakeLists.txt:6 (find_package)

I think the problem is Gazebo7 is exporting a dependency on pthread which is suggested is bad on StackOverflow.

This occurs when one catkin package depends on Gazebo, and another depends on that package:

base_pkg CMakeLists

cmake_minimum_required(VERSION 2.8.3)
project(base_pkg)

find_package(catkin REQUIRED COMPONENTS
  roscpp
)

find_package(GAZEBO REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

find_package(Boost REQUIRED COMPONENTS thread)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

catkin_package(
  DEPENDS
    Boost
    GAZEBO
)

dependent pkg CMakeLists

cmake_minimum_required(VERSION 2.8.3)
project(dummy_pkg)

find_package(catkin REQUIRED COMPONENTS
  base_pkg
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

catkin_package(
  CATKIN_DEPENDS
    base_pkg
)

The full workspace can be tested from this barebones test repo I’ve just created.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dirk-thomascommented, Jan 22, 2018

I will close this for now since it is not planned to change the behavior of the catkin API atm.

1reaction
jlack1987commented, Jul 10, 2017

Would just like to toss in here that I ran into the same problem independently when trying to link protobuf w/o gazebo. We already forked our own FindProtobuf.cmake file, so I just commented out the chunk that added -lpthread to the libraries and that took care of it. I really appreciate the detailed research done here, saved me a ton of time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

catkin_make fails when linking on reference to ros::NodeHandle
I've now been able to make the original program run as a ROS Node using rosrun mypackage mypackage_node . The problem I'm having...
Read more >
Error when "catkin_make" is run - Robotics Stack Exchange
I am using Gazebo 11 and ROS Noetic and i've made sure to source the shell. error. I am new to ROS and...
Read more >
Using ros pluggin & catkin build - Gazebo: Q&A Forum
I am trying to build and link my ros pluggin to Gazebo. I am building all my ros packages (and therefore the pluggin)...
Read more >
Newest 'catkin' Questions - Stack Overflow
I want to simulate Tiago robot in Gazebo and I am using ROS available package. Before, I simulated it without problem but right...
Read more >
Gazebo Simulation Integration — moveit_tutorials Noetic ...
Gazebo is the most popular robotics simulator in the ROS ecosystem, ... It alone doesn't fix the problem, since now we need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found