Closed swarmt closed 6 years ago
Weird... my build is successful. Trimesh is included in the package directly, so there should not be any version mismatches or anything. Do you have another version of trimesh installed on your system? It could possibly be finding that version instead of the one included in the package.
Definitely no other versions of trimesh. I will try it on a clean install.
EDIT: Same issue clean install.
There is something broken with the linking of libtrimesh.a. Build successfully if I supply the full path. I'll let you know when I figure it out!
Okay, thanks!
I am having the same issue after following the installation instructions. I have no other version of trimesh installed. I'm on Ubuntu 16.04
//homehome//gilmoujwgilmoujw//ROS_wsROS_ws//josh_wsjosh_ws//develdevel//liblib//libdsl_gridsearch.solibdsl_gridsearch.so:: undefinedundefined referencereference toto ``trimeshtrimesh::::TriMeshTriMesh::::readread((stdstd::::cxx11cxx11::::basic_stringbasic_string<<charchar,, stdstd::::char_traitschar_traits<
collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/build.make:120: recipe for target '/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid3d_node' failed make[2]: [/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid3d_node] Error 1 dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/build.make:120: recipe for target '/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid2d_node' failed make[2]: [/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid2d_node] Error 1 CMakeFiles/Makefile2:461: recipe for target 'dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/all' failed make[1]: [dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... CMakeFiles/Makefile2:818: recipe for target 'dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/all' failed make[1]: [dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: [all] Error 2
I just pushed a branch called linker-test. Could you check it out and try to build it? I changed dsl_gridsearch to a static lib and linked trimesh to it directly instead of linking trimesh to the individual executables. Both this version and the old configuration still build fine on my computer, so I don't really have a good way of testing the changes myself.
Thanks for the quick response! I deleted everything and cloned that branch and followed the installation instructions again. However, I got the same error.
/home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(mesh_utility.cpp.o): In function dsl_gridsearch::MeshUtility::meshToOccupancyGrid(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, dsl_gridsearch::OccupancyGrid**)': mesh_utility.cpp:(.text+0x33c): undefined reference to
trimesh::TriMesh::read(std::cxx11::basic_string<char, std::char_traitsdsl_gridsearch::MeshUtility::meshToHeightMap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, dsl_gridsearch::OccupancyGrid**, double)': mesh_utility.cpp:(.text+0x1d94): undefined reference to
trimesh::TriMesh::read(std::cxx11::basic_string<char, std::char_traitstrimesh::TriMesh::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(mesh_utility.cpp.o): In function
dsl_gridsearch::MeshUtility::meshToHeightMap(std::
Really not sure why this is happening. I will look into it tomorrow. If I figure anything out I will post it here.
As evidenced by the error: 'undefined reference totrimesh::TriMesh::read(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' I believe the problem isn't linking but rather to do with the version of GCC that the static library was compiled under. I found a great explanation at: https://stackoverflow.com/questions/41134190/linker-can-not-find-symbols-but-theyre-there
I tried using the workaround described here:
https://stackoverflow.com/questions/40705852/undefined-reference-to-std-cxx11basic-string-in-boost-on-travis-ci
by adding add_compile_options(-D_GLIBCXX_USE_CXX11_ABI=0) to the CMake file. The errors about read went away, but new errors in the library related to ros functions appeared. I have put them below.
CMakeFiles/dsl_grid2d_node.dir/src/dsl_gridsearch/dsl_grid2d_node.cpp.o: In function `main': dsl_grid2d_node.cpp:(.text+0x70): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)' dsl_grid2d_node.cpp:(.text+0xcc): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' dsl_grid2d_node.cpp:(.text+0x143): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(dsl_grid2d.cpp.o): In function `dsl_gridsearch::DslGrid2D::DslGrid2D(ros::NodeHandle, ros::NodeHandle)': dsl_grid2d.cpp:(.text+0x1f3): undefined reference to `ros::NodeHandle::getParam(std::string const&, std::string&) const' dsl_grid2d.cpp:(.text+0x28f): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid2d.cpp:(.text+0x328): undefined reference to `ros::NodeHandle::getParam(std::string const&, bool&) const' dsl_grid2d.cpp:(.text+0x3b8): undefined reference to `ros::NodeHandle::getParam(std::string const&, int&) const' dsl_grid2d.cpp:(.text+0x44b): undefined reference to `ros::NodeHandle::getParam(std::string const&, int&) const' dsl_grid2d.cpp:(.text+0x4d4): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid2d.cpp:(.text+0x558): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid2d.cpp:(.text+0x63f): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid2d.cpp:(.text+0x755): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid2d.cpp:(.text+0x8c7): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid2d.cpp:(.text+0xa7f): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid2d.cpp:(.text+0xf9a): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(dsl_grid2d.cpp.o):dsl_grid2d.cpp:(.text+0x1344): more undefined references to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' follow CMakeFiles/dsl_grid3d_node.dir/srccollect2: error: ld returned 1 exit status /dsl_gridsearch/dsl_grid3d_node.cpp.o: In function `main': dsl_grid3d_node.cpp:(.text+0x70): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)' dsl_grid3d_node.cpp:(.text+0xcc): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' dsl_grid3d_node.cpp:(.text+0x143): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(dsl_grid3d.cpp.o): In function `dsl_gridsearch::DslGrid3D::DslGrid3D(ros::NodeHandle, ros::NodeHandle)': dsl_grid3d.cpp:(.text+0x29b): undefined reference to `ros::NodeHandle::getParam(std::string const&, std::string&) const' dsl_grid3d.cpp:(.text+0x337): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid3d.cpp:(.text+0x3d0): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid3d.cpp:(.text+0x469): undefined reference to `ros::NodeHandle::getParam(std::string const&, bool&) const' dsl_grid3d.cpp:(.text+0x4f9): undefined reference to `ros::NodeHandle::getParam(std::string const&, int&) const' dsl_grid3d.cpp:(.text+0x58c): undefined reference to `ros::NodeHandle::getParam(std::string const&, int&) const' dsl_grid3d.cpp:(.text+0x61f): undefined reference to `ros::NodeHandle::getParam(std::string const&, int&) const' dsl_grid3d.cpp:(.text+0x6a8): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid3d.cpp:(.text+0x72c): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid3d.cpp:(.text+0x7b0): undefined reference to `ros::NodeHandle::getParam(std::string const&, double&) const' dsl_grid3d.cpp:(.text+0x8a8): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid3d.cpp:(.text+0x9be): dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/build.make:120: recipe for target '/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid2d_node' failed undefined referencemake[2]: *** [/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid2d_node] Error 1 to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid3d.cpp:(.text+0xb1e): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' dsl_grid3d.cpp:(.text+0xcd5): undefined reference to `ros::console::initializeLogLocation(ros::console:CMakeFiles/Makefile2:818: recipe for target 'dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/all' failed :LogLocation*,make[1]: *** [dsl_gridsearch/CMakeFiles/dsl_grid2d_node.dir/all] Error 2 std::string const&,make[1]: *** Waiting for unfinished jobs.... ros::console::levels::Level)' dsl_grid3d.cpp:(.text+0x136e): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /home/gilmoujw/ROS_ws/josh_ws/devel/lib/libdsl_gridsearch.a(dsl_grid3d.cpp.o):dsl_grid3d.cpp:(.text+0x16b7): more undefined references to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' follow collect2: error: ld returned 1 exit status dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/build.make:120: recipe for target '/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid3d_node' failed make[2]: *** [/home/gilmoujw/ROS_ws/josh_ws/devel/lib/dsl_gridsearch/dsl_grid3d_node] Error 1 CMakeFiles/Makefile2:461: recipe for target 'dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/all' failed make[1]: *** [dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/all] Error 2 Makefile:138: recipe for target 'all'
I was able to get it to build by getting the latest version of trimesh2 from here and copying the appropriate files over after building trimesh2.
/tmp/ccB4bBU7.o: In function main': try.cpp:(.text+0x33): undefined reference to
trimesh::TriMesh::read(char const*)'
try.cpp:(.text+0x2e4): undefined reference to trimesh::TriMesh::need_normals(bool)' /tmp/ccB4bBU7.o: In function
trimesh::TriMesh::need_faces()':
try.cpp:(.text._ZN7trimesh7TriMesh10need_facesEv[_ZN7trimesh7TriMesh10need_facesEv]+0x42): undefined reference to trimesh::TriMesh::unpack_tstrips()' try.cpp:(.text._ZN7trimesh7TriMesh10need_facesEv[_ZN7trimesh7TriMesh10need_facesEv]+0x6c): undefined reference to
trimesh::TriMesh::triangulate_grid(bool)'
collect2: error: ld returned 1 exit status
Please help me resolve the issue
Did you try building the latest trimesh2 lib from source as mentioned by @gilmoujw?
Hey There!
Just wanted to test out your library and struck an error during build.
undefined reference to trimesh::TriMesh::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/build.make:120: recipe for target '/home/sam/robo/devel/lib/dsl_gridsearch/dsl_grid3d_node' failed make[2]: *** [/home/sam/robo/devel/lib/dsl_gridsearch/dsl_grid3d_node] Error 1 CMakeFiles/Makefile2:377: recipe for target 'dsl_gridsearch/CMakeFiles/dsl_grid3d_node.dir/all' failed