I've been stuck on this issue for an embarrassingly long period of time, and would be very grateful for any help. I'm very new to c++ and CMake, so it's likely I'm overlooking something quite obvious.
When I run Gazebo with a plugin I wrote, plank_drop.cc, I get the following error:
gzserver: symbol lookup error: /home/plugins/build/libPlankDrop.so: undefined symbol: _Z4joinIdENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4listIT_SaIS7_EEES5_
The symbol's name leads me to believe the issue is in the join function, called within plank_drop.cc, and defined in the extra_functions.cc.
I've added join() to the scope of plank_drop.cc like so:
#include "extra_functions.h"
And the compiler doesn't complain. It never seems to compain at compile time, or link time. It only fails at runtime. I've set this up in my CMakeList.txt like this:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}")
add_library(PlankDrop SHARED plank_drop.cc)
add_library(CamRecord SHARED cam_record.cc)
add_library(ExtraFunctions SHARED extra_functions.cc extra_functions.h)
target_link_libraries(PlankDrop CamRecord ExtraFunctions ${GAZEBO_LIBRARIES})
The relevant parts of my source code is here. All of my solutions just introduce new issues that are equally confusing.
Originally posted by david_d on Gazebo Answers with karma: 5 on 2018-12-13
Post score: 0
Original comments
Comment by david_d on 2018-12-13:
So, following this page: http://gdwarner.blogspot.com/2009/03/c-runtime-symbol-lookup-error.html
Using nm libPlankDrop.so | c++filt, this symbol is the problem:
U std::__cxx11::basic_string<char, std::char_traits, std::allocator > join(std::__cxx11::list<double, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)
I am still very confused.