gazebo ros plugin make error: Undefined symbols for architecture x86_64

asked 2016-06-07 03:35:05 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I'm new in ROS and Gazebo programming. I'm trying to create a control plugin for the laser that I've mounted on my robot model.

I'm using ROS indigo and gazebo 7.0 on MAC OS X 10.11.5

My problem comes when I try to compile, using standard 'cmake' and 'make', the .cc file of my plugin.

Following an official tutorial (http://gazebosim.org/tutorials/?tut=p...), I've wrote the CMakeLists.txt as:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package(roscpp REQUIRED)
find_package(std_msgs REQUIRED)
include_directories(${roscpp_INCLUDE_DIRS})
include_directories(${std_msgs_INCLUDE_DIRS})

# Find Gazebo
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")



# Build our plugin
add_library(velodyne_plugin SHARED velodyne_plugin.cc)
target_link_libraries(velodyne_plugin ${GAZEBO_libraries} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${roscpp_LIBRARIES})

I think that the problem could derive from the libraries' dependencies.

The 'cmake' command seems to work well while 'make' return the following output:

[ 50%] Linking CXX shared library libvelodyne_plugin.dylib
Undefined symbols for architecture x86_64:
  "sdf::Console::ColorMsg(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, int)", referenced from:
      double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
      bool sdf::Param::Get<double>(double&) const in velodyne_plugin.cc.o
  "sdf::Console::Instance()", referenced from:
      double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
      bool sdf::Param::Get<double>(double&) const in velodyne_plugin.cc.o
      sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [30]>(char const (&) [30]) in velodyne_plugin.cc.o
      sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
      sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [3]>(char const (&) [3]) in velodyne_plugin.cc.o
      sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [29]>(char const (&) [29]) in velodyne_plugin.cc.o
      sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [15]>(char const (&) [15]) in velodyne_plugin.cc.o
      ...
  "sdf::Element::GetElement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
  "sdf::Element::GetAttribute(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
  "sdf::Element::HasElementDescription(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
  "gazebo::event::Connection::Connection(gazebo::event::Event*, int)", referenced from:
      gazebo::event::EventT<void (gazebo::common::UpdateInfo const&)>::Connect(boost::function<void (gazebo ...
(more)
edit retag flag offensive close merge delete