Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.
This repository was archived by the owner on May 31, 2025. It is now read-only.

Linking with Gazebo using Catkin fails #856

@davetcoleman

Description

@davetcoleman

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions