naveenoid / kumonoito

The silken spider thread that lets one go back and forth between Drake and ROS.
1 stars 3 forks source link

Problems linking octomap: /usr/bin/ld: cannot find -loctomap::octomap #1

Open j-rivero opened 6 years ago

j-rivero commented 6 years ago

The current master branch fails to compile with the following error:

[ 18%] Linking CXX shared library /home/jrivero/code/TRI/ws/devel/.private/kumonoito/lib/libjaco_common.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/jaco_common.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC   -shared -Wl,-soname,libjaco_common.so -o /home/jrivero/code/TRI/ws/devel/.private/kumonoito/lib/libjaco_common.so CMakeFiles/jaco_common.dir/src/jaco_common.cc.o /tmp/drake/lib/libdrake.so /tmp/drake/lib/libBulletCollision.so /tmp/drake/lib/libLinearMath.so /tmp/drake/lib/libfcl.so /tmp/drake/lib/libccd.so -loctomap::octomap /tmp/drake/lib/libignition_rndf.so /tmp/drake/lib/liblcm.so -lglib-2.0 -lpthread /tmp/drake/lib/libprotobuf.so /tmp/drake/lib/libyaml_cpp.so /tmp/drake/lib/libfmt.so /tmp/drake/lib/libscsdir.so /tmp/drake/lib/libsdformat.so /tmp/drake/lib/libignition_math.so -ltinyxml /tmp/drake/lib/libtinyobjloader.so -ltinyxml2 -Wl,-rpath,/tmp/drake/lib 
/usr/bin/ld: cannot find -loctomap::octomap
collect2: error: ld returned 1 exit status

The problem comes from the fcl cmake module generated by Drake which list in the INTERFACE_LINK_LIBRARIES. For some reason the library target name "octomap::octomap" is not being resolved and is passed to the linker as it.

Since libfcl (the consumer of octomap) does link statically against ccd and octomap, there is not need to supply them in the cmake module. A dirty patch to solve the issue:

--- /opt/drake/lib/cmake/fcl/fcl-config.cmake   2017-11-29 07:43:37.000000000 +0100
+++ /tmp/drake/lib/cmake/fcl/fcl-config.cmake   2017-11-29 19:37:43.848797013 +0100
@@ -93,7 +93,6 @@
 set_target_properties(fcl::fcl PROPERTIES
   IMPORTED_LOCATION "${${CMAKE_FIND_PACKAGE_NAME}_IMPORT_PREFIX}/lib/libfcl.so"
   INTERFACE_INCLUDE_DIRECTORIES "${${CMAKE_FIND_PACKAGE_NAME}_IMPORT_PREFIX}/include"
-  INTERFACE_LINK_LIBRARIES "ccd::ccd;Eigen3::Eigen;octomap::octomap"
 )

 set(fcl_LIBRARIES "fcl::fcl")

I think that fixing the real problem does not worth the effort since these modules are going to be removed by https://github.com/RobotLocomotion/drake/pull/7417. I've confirmed that building drake using the branch in the PR makes this package to successfully compile.

naveenoid commented 6 years ago

Ok for now I will use this fix and document it in the readme.

j-rivero commented 6 years ago

let's leave the issue open until we merge the changes that fix it in the Drake repository.

naveenoid commented 6 years ago

Perhaps we need to document this in the README too? i.e. the dirty patch needed to develop with this project.

Sreevis commented 6 years ago

Hi, When I did the solution suggested by j-rivero, another similar error came, but previous error left. /usr/bin/ld: cannot find -lBoost::boost Have you faced this issue? I am using ubuntu 16.04 ROS kinetic.