humanoid-path-planner/hpp-fcl

make[2]: *** No rule to make target 'octomap-NOTFOUND', needed by 'src/libhpp-fcl.so'. Stop.

Closed this issue · 11 comments

When I ran the command make after cmake .. to built hpp-fcl with octomap1.9.8, there was an ERROR.

[ 48%] Building CXX object src/CMakeFiles/hpp-fcl.dir/hfield.cpp.o
cd /home/zhangchen/source_codes/hpp-fcl-2.3.5/build/src && /usr/bin/c++ -DHPP_FCL_HAS_OCTOMAP -DHPP_FCL_HAS_QHULL -DHPP_FCL_HAVE_OCTOMAP -DOCTOMAP_MAJOR_VERSION=1 -DOCTOMAP_MINOR_VERSION=9 -DOCTOMAP_PATCH_VERSION=8 -Dhpp_fcl_EXPORTS -I/home/zhangchen/source_codes/hpp-fcl-2.3.5/build -I/home/zhangchen/source_codes/hpp-fcl-2.3.5/build/include -I/home/zhangchen/source_codes/hpp-fcl-2.3.5/include -isystem /usr/include/eigen3 -pedantic -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion  -Wall -Wextra  -Wno-error=deprecated-declarations -fstack-protector-strong -Wno-error=strict-aliasing -Wno-error=class-memaccess -O2 -g -DNDEBUG -fPIC -MD -MT src/CMakeFiles/hpp-fcl.dir/hfield.cpp.o -MF CMakeFiles/hpp-fcl.dir/hfield.cpp.o.d -o CMakeFiles/hpp-fcl.dir/hfield.cpp.o -c /home/zhangchen/source_codes/hpp-fcl-2.3.5/src/hfield.cpp
make[2]: *** No rule to make target 'octomap-NOTFOUND', needed by 'src/libhpp-fcl.so'.  Stop.

I had change the CMakeLists.txt in the octomap part, after line 136 ADD_PROJECT_DEPENDENCY(octomap PKG_CONFIG_REQUIRES "octomap >= 1.6") in CMakeLists.txt

set (octoma_VERSION 1.9.8)
set (OCTOMAP_INCLUDE_DIRS /usr/local/include)
set (OCTOMAP_LIBRARY_DIRS /usr/local/lib)
set (OCTOMAP_LIBRARIES /usr/local/lib/liboctomap.so;/usr/local/lib/iboctomath.so)
  
if(NOT octomap_FOUND OR NOT OCTOMAP_VERSION)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(PC_OCTOMAP octomap)
  endif()

  find_path(OCTOMAP_INCLUDE_DIR octomap/octomap.h
    HINTS "${PC_OCTOMAP_INCLUDE_DIRS}")

  # Using find_library() even if pkg-config is available ensures that the full
  # paths to the octomap and octomath libraries are set in OCTOMAP_LIBRARIES
  find_library(OCTOMAP_LIBRARY octomap
    HINTS "${PC_OCTOMAP_LIBRARY_DIRS}")

  find_library(OCTOMATH_LIBRARY octomath
    HINTS "${PC_OCTOMAP_LIBRARY_DIRS}")

  # Use a cache variable so that the version can be manually set if pkg-config
  # is not available
  set(OCTOMAP_VERSION "${PC_OCTOMAP_VERSION}"
    CACHE STRING "octomap version (major.minor.patch)")

  if(OCTOMAP_INCLUDE_DIR AND OCTOMAP_LIBRARY AND OCTOMATH_LIBRARY AND OCTOMAP_VERSION)
    set(OCTOMAP_INCLUDE_DIRS "${OCTOMAP_INCLUDE_DIR}")
    set(OCTOMAP_LIBRARIES "${OCTOMAP_LIBRARY}" "${OCTOMATH_LIBRARY}")
    set(octomap_FOUND ON)

    mark_as_advanced(OCTOMAP_INCLUDE_DIR OCTOMAP_LIBRARY OCTOMATH_LIBRARY OCTOMAP_VERSION)
  else()
    set(octomap_FOUND OFF)
  endif()
endif()

But there was the same error.

my library version: octomap 1.9.8(it worked in fcl), hpp-fcl 2.3.5

THANKS A LOT!

nim65s commented

hpp-fcl 2.3.5 is known to build well with octomap 1.9.8: those are the latest versions of both packages, which are currently packaged at least in archlinux, conda, nix and pip.

You are probably doing something wrong, but you are not providing enough information to let us find out what.

What is your operating system ? On which version ? How did you install octomap ? Where ? What is your CMAKE_PREFIX_PATH ?

I tried to install octomap 1.9.8 and hpp-fcl 2.3.5 on another computer and got the same error unfortunately…
SORRY for missing enough information before.
I ran all things on Ubuntu 20.04. I installed octomap as instructions in octomap's github.. I did not change any commands and did not set CMAKE_PREFIX_PATH manually. The same as I installed hpp-fcl (I only turned OFF build python interface).
I am a new learner for those things. Thanks for your time!

nim65s commented

If you are talking about these instructions:

cd octomap
mkdir build
cd build
cmake ..
make

Then you did not install octomap, you only compile it.
If CMake default installation prefix /usr/local is ok for you, then you need to add sudo make install after the make.

hpp-fcl require an octomap.pc file installed in eg. /usr/local/lib/pkgconfig/octomap.pc. Do you have this file somewhere ?

Yes, I have ran sudo make install.
I have installed multi version octomap ,such as 1.8.0, 1.9.1, 1.9.8, before on the first computer and then I have the file /usr/local/lib/pkgconfig/octomap.pc. And I only installed octomap 1.9.8 on the second computer, and got the file /usr/lib/x86_64-linux-gnu/pkgconfig/octomap.pc.
Thank you again!!!

I used cmake commands in CMakeLists.txt of another C++ project on the first computer

find_package(octomap REQUIRED)
...
include_directories(${OCTOMAP_INCLUDE_DIRS})
message(STATUS "OCTOMAP_INCLUDE_DIRS=${OCTOMAP_INCLUDE_DIRS}")
message(STATUS "OCTOMAP_LIBRARY_DIRS=${OCTOMAP_LIBRARY_DIRS}")
message(STATUS "OCTOMAP_LIBRARIES: ${OCTOMAP_LIBRARIES}")

And got outputs:

[cmake] -- OCTOMAP_INCLUDE_DIRS=/usr/local/include
[cmake] -- OCTOMAP_LIBRARY_DIRS=/usr/local/lib
[cmake] -- OCTOMAP_LIBRARIES: /usr/local/lib/liboctomap.so;/usr/local/lib/liboctomath.so

Does this issue been solved @dogged1021?

Not yet, sadly.
And, there was a warning while ran cmake .., but cmake was completed

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_LOCATION not set for imported target "octomap" configuration
  "RelWithDebInfo".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/zhangchen/source_codes/hpp-fcl-2.3.5/build

The best solution to solve this issue is to prepare a docker image. @dogged1021 Could you provide it?

I have not used docker before but I will learn it and try what you say as soon as possible. I‘m also cursious about this issue. Thanks a lot!

I re-compiled & installed octomap with command

cmake .. -DCMAKE_INSTALL_PREFIX=/usr/lib/x86_64-linux-gnu

And then built hpp-fcl sucessfully! I could ran the hpp-fcl examples now.
Thanks a lot! @jcarpent @nim65s

nim65s commented

This is clearly not a correct installation prefix. lib and lib/x86_64-linux-gnu are supposed to be inside this installation prefix.

I think you should try to use some package managers: octomap is correctly packaged in many ways.

Anyway, if this work for you and you are fine with it, this is fine for us too.