Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-talking between find_package(gazebo) and find_package(VTK) on Ubuntu 22.04 #1

Open
traversaro opened this issue Sep 29, 2022 · 1 comment

Comments

@traversaro
Copy link
Owner

traversaro commented Sep 29, 2022

This issue (and repo) is meant to provide a simple reproducible example of the problems created by calling find_package(gazebo) and find_package(VTK) in the same project on Ubuntu 22.04 .

find_package(gazebo) called before find_package(VTK)

Job: https://github.com/traversaro/vtk-gazebo-cross-talking/actions/runs/3151955287/jobs/5126569789

Error:

-- Found LZ4: /usr/lib/x86_64-linux-gnu/liblz4.so (found version "1.9.3") 
-- Found LZMA: /usr/lib/x86_64-linux-gnu/liblzma.so (found version "5.2.5") 
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80") 
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.3.0")  
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.11.1") 
-- Found utf8cpp: /usr/include/utf8cpp  
-- VTK_VERSION: 9.1.0
-- Configuring done
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/VTK-targets.cmake:1268 (set_target_properties):
-- Generating done
  The link interface of target "VTK::sqlite" contains:

    SQLite::SQLite3

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/vtk-config.cmake:138 (include)
  CMakeLists.txt:10 (find_package)


CMake Generate step failed.  Build files cannot be regenerated correctly.

This problem is the one described in gazebosim/gz-cmake#312 that will be fixed in gazebosim/gz-cmake#313 .

find_package(gazebo) called after find_package(VTK)

Job: https://github.com/traversaro/vtk-gazebo-cross-talking/actions/runs/3151955287/jobs/5126569952

Error:

-- Checking for module 'tinyxml2'
--   Found tinyxml2, version 9.0.0
-- Looking for ignition-msgs5 -- found version 5.8.1
-- Looking for ignition-common3 -- found version 3.14.0
-- Searching for dependencies of ignition-common3
-- Looking for dlfcn.h - found
-- Looking for libdl - found
-- Found DL: TRUE  
-- Found tinyobjloader: /usr/lib/x86_64-linux-gnu/cmake/tinyobjloader/tinyobjloader-config.cmake (found version "2.0.0") 
-- Searching for <ignition-common3> component [graphics]
-- Looking for ignition-common3-graphics -- found version 3.14.0
-- Searching for dependencies of ignition-common3-graphics
-- Looking for ignition-math6 -- found version 6.10.0
-- Looking for ignition-fuel_tools4 -- found version 4.4.0
-- Searching for dependencies of ignition-fuel_tools4
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.81.0")  
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncpp-namespaced-targets.cmake:5 (add_library):
  add_library cannot create imported target "JsonCpp::JsonCpp" because
  another target with the same name already exists.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncppConfig.cmake:41 (include)
  /usr/share/cmake/ignition-cmake2/cmake2/FindJSONCPP.cmake:34 (find_package)
  /usr/lib/x86_64-linux-gnu/cmake/ignition-fuel_tools4/ignition-fuel_tools4-config.cmake:94 (find_package)
  /usr/lib/x86_64-linux-gnu/cmake/gazebo/gazebo-config.cmake:251 (find_package)
  CMakeLists.txt:17 (find_package)


-- Checking for module 'yaml-0.1'
--   Found yaml-0.1, version 0.2.2
-- Found YAML: TRUE  
-- Checking for module 'libzip'
--   Found libzip, version 1.7.3
-- Found ZIP: TRUE  
-- Looking for ignition-common3 -- found version 3.14.0
-- Looking for ignition-math6 -- found version 6.10.0
-- Looking for ignition-msgs5 -- found version 5.8.1
-- Configuring incomplete, errors occurred!

The problem here is the one described in open-source-parsers/jsoncpp#1356, that will be eventually fixed by open-source-parsers/jsoncpp#1435 .

@traversaro
Copy link
Owner Author

traversaro commented Sep 29, 2022

Workaround

A workaround for this issues is to call find_package(gazebo) before find_package(VTK), and then after find_package(gazebo) is called restore the CMAKE_MODULE_PATH present before find_package(gazebo) was called, something like:

set(_CMAKE_MODULE_PATH_BACKUP "${CMAKE_MODULE_PATH}")
find_package(gazebo REQUIRED)
set(CMAKE_MODULE_PATH "${_CMAKE_MODULE_PATH_BACKUP}")
find_package(VTK REQUIRED)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant