collada_urdf icon indicating copy to clipboard operation
collada_urdf copied to clipboard

CMake issue with the release on noetic

Open jmirabel opened this issue 3 years ago • 11 comments

After having installed ros-noetic-collada-urdf, using find_package(catkin REQUIRED COMPONENTS collada_urdf) fails with error

CMake Error at /opt/ros/noetic/share/collada_urdf/cmake/collada_urdfConfig.cmake:113 (message): Project 'collada_urdf' specifies '/usr/../include/include' as an include dir, which is not found. It does neither exist as an absolute directory nor in '${prefix}//usr/../include/include'. Check the issue tracker 'https://github.com/ros/collada_urdf/issues' and consider creating a ticket if the problem has not been reported yet. Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package) CMakeLists.txt:7 (find_package)

jmirabel avatar Apr 15 '21 08:04 jmirabel

Same on my system, can't get anything that depends on collada-urdf to compile.

werner291 avatar Jul 20 '21 14:07 werner291

Dirty workaround, acceptable in docker containers, are

  • mkdir -p /include/include
  • sed -i 's#/usr/../include/include;##' /opt/ros/noetic/share/collada_urdf/cmake/collada_urdfConfig.cmake

jmirabel avatar Jul 20 '21 14:07 jmirabel

Seems related to this portion in the file it's complaining about:

if(NOT "/home/werner/catkin_test/src/collada_urdf/collada_urdf/include;/usr/../include/include;/usr/include/collada-dom2.4/1.5;/usr/include/collada-dom2.4;/usr/include " STREQUAL " ")
  set(collada_urdf_INCLUDE_DIRS "")
  set(_include_dirs "/home/werner/catkin_test/src/collada_urdf/collada_urdf/include;/usr/../include/include;/usr/include/collada-dom2.4/1.5;/usr/include/collada-dom2.4;/usr/include")
  if(NOT "https://github.com/ros/collada_urdf/issues " STREQUAL " ")
    set(_report "Check the issue tracker 'https://github.com/ros/collada_urdf/issues' and consider creating a ticket if the problem has not been reported yet.")
  elseif(NOT "http://ros.org/wiki/collada_urdf " STREQUAL " ")
    set(_report "Check the website 'http://ros.org/wiki/collada_urdf' for information and consider reporting the problem.")
  else()
    set(_report "Report the problem to the maintainer 'Chris Lalancette <[email protected]>, Shane Loretz <[email protected]>' and request to fix the problem.")
  endif()
  foreach(idir ${_include_dirs})
    if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
      set(include ${idir})
    elseif("${idir} " STREQUAL "include ")
      get_filename_component(include "${collada_urdf_DIR}/../../../include" ABSOLUTE)
      if(NOT IS_DIRECTORY ${include})
        message(FATAL_ERROR "Project 'collada_urdf' specifies '${idir}' as an include dir, which is not found.  It does not exist in '${include}'.  ${_report}")
      endif()
    else()
      message(FATAL_ERROR "Project 'collada_urdf' specifies '${idir}' as an include dir, which is not found.  It does neither exist as an absolute directory nor in '/home/werner/catkin_test/src/collada_urdf/collada_urdf/${idir}'.  ${_report}")
    endif()
    _list_append_unique(collada_urdf_INCLUDE_DIRS ${include})
  endforeach()
endif()

It's as if collada_urdf_DIR is set to some weird value.

werner291 avatar Jul 20 '21 14:07 werner291

Actually, this seems to be the offending line:

set(_include_dirs "/home/werner/catkin_test/src/collada_urdf/collada_urdf/include;/usr/../include/include;/usr/include/collada-dom2.4/1.5;/usr/include/collada-dom2.4;/usr/include") if(NOT "https://github.com/ros/collada_urdf/issues " STREQUAL " ")

Now to find out where that's coming from...

werner291 avatar Jul 20 '21 15:07 werner291

...which in turn comes from here: https://github.com/ros/catkin/blob/noetic-devel/cmake/templates/pkgConfig.cmake.in#L96

werner291 avatar Jul 20 '21 15:07 werner291

Looks like some package named ASSIMP is drawing in the non-existing directory /usr/../include/include.

Tested by inserting the line: message(WARNING "Dependency: ${depend} DEPENDS ON DIRECTORIES ${${depend_name}_INCLUDE_DIRS}") in the file collada_urdfConfig.cmake wherever PROJECT_DEPENDENCIES_INCLUDE_DIRS gets changed.

werner291 avatar Jul 20 '21 16:07 werner291

Notably, catkin also produced this warning:

Starting  >>> collada_urdf                                                                              
________________________________________________________________________________________________________
Warnings   << collada_urdf:cmake /home/werner/catkin_test/logs/collada_urdf/build.cmake.000.log         
CMake Warning (dev) at /usr/lib/x86_64-linux-gnu/cmake/assimp-5.0/assimpTargets.cmake:54 (if):
  if given arguments:

    "ON"

  An argument named "ON" appears in a conditional statement.  Policy CMP0012
  is not set: if() recognizes numbers and boolean constants.  Run "cmake
  --help-policy CMP0012" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/assimp-5.0/assimp-config.cmake:1 (include)
  CMakeLists.txt:16 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

werner291 avatar Jul 20 '21 16:07 werner291

CMakeCache indeed shows the nonsensical include path: ASSIMP_INCLUDE_DIRS:INTERNAL=/usr/../include/include

werner291 avatar Jul 20 '21 16:07 werner291

This appears to be the offending part of the CMakeLists.txt

message(ERROR "Assimp: ${ASSIMP_INCLUDE_DIRS}") # Outputs /usr/include

if ( NOT ASSIMP_FOUND )
  find_package(Assimp QUIET)
  if ( NOT ASSIMP_FOUND )
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(ASSIMP assimp)
  endif()
endif()

message(ERROR "Assimp: ${ASSIMP_INCLUDE_DIRS}") # Gets overwritten to /usr/../include/include!

werner291 avatar Jul 20 '21 16:07 werner291

Dammit...

CMake is case-sensitive: it should be assimp_FOUND, not ASSIMP_FOUND!

werner291 avatar Jul 20 '21 16:07 werner291

Yup. Tested it with a project that depends on collada_urdf; it compiles fine once i make the change.

werner291 avatar Jul 20 '21 16:07 werner291