Linking with Gazebo using Catkin fails
See original GitHub issueSome 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:
- Created 7 years ago
- Comments:19 (10 by maintainers)
Top GitHub Comments
I will close this for now since it is not planned to change the behavior of the catkin API atm.
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 ownFindProtobuf.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.