`opt` is hard-coded in `humble`

Open
#53 0 comments 0 reactions 1 assignee View on GitHub

@cottsay is already working on this.

Since Mar 20, 2025.

Assessment

This issue has not been assessed yet.

Description

@clalancette I installed ROS 2 in a directory different from /opt/ros/humble. The yaml_cpp_vendor package installs to the root/opt/yaml_cpp_vendor/, where root is my installation path.

$ find output/export/root/ -name *yaml[-_]cpp* | cut -d '/' -f 3-
root/share/colcon-core/packages/yaml_cpp_vendor
root/share/ament_index/resource_index/parent_prefix_path/yaml_cpp_vendor
root/share/ament_index/resource_index/package_run_dependencies/yaml_cpp_vendor
root/share/ament_index/resource_index/packages/yaml_cpp_vendor
root/share/yaml_cpp_vendor
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendorConfig.cmake
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendor-extras.cmake
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendorConfig-version.cmake
root/share/yaml_cpp_vendor/environment/yaml_cpp_vendor_library_path.dsv
root/share/yaml_cpp_vendor/environment/yaml_cpp_vendor_library_path.sh
root/opt/yaml_cpp_vendor
root/opt/yaml_cpp_vendor/share/cmake/yaml-cpp
root/opt/yaml_cpp_vendor/share/cmake/yaml-cpp/yaml-cpp-config.cmake
root/opt/yaml_cpp_vendor/share/cmake/yaml-cpp/yaml-cpp-config-version.cmake
root/opt/yaml_cpp_vendor/share/cmake/yaml-cpp/yaml-cpp-targets.cmake
root/opt/yaml_cpp_vendor/share/cmake/yaml-cpp/yaml-cpp-targets-release.cmake
root/opt/yaml_cpp_vendor/share/pkgconfig/yaml-cpp.pc
root/opt/yaml_cpp_vendor/lib/libyaml-cpp.so.0.7
root/opt/yaml_cpp_vendor/lib/libyaml-cpp.so
root/opt/yaml_cpp_vendor/lib/libyaml-cpp.so.0.7.0
root/opt/yaml_cpp_vendor/include/yaml-cpp

As a result, yaml-cpp is not found by ur_calibration. This fix helps

diff --git a/CMakeLists.txt b/CMakeLists.txt
index badc1b4..2d4ea7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,7 @@ macro(build_yaml_cpp)
     DIRECTORY
       ${CMAKE_CURRENT_BINARY_DIR}/yaml_cpp_install/
     DESTINATION
-      ${CMAKE_INSTALL_PREFIX}/opt/yaml_cpp_vendor
+      ${CMAKE_INSTALL_PREFIX}
     USE_SOURCE_PERMISSIONS
   )
 endmacro()
@@ -70,21 +70,6 @@ endmacro()
 find_package(yaml-cpp QUIET NO_CMAKE_PACKAGE_REGISTRY)
 if(FORCE_BUILD_VENDOR_PKG OR NOT yaml-cpp_FOUND)
   build_yaml_cpp()
-
-  if(WIN32)
-    ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.bat)
-    set(ENV_VAR_NAME "PATH")
-    set(ENV_VAR_VALUE "opt\\yaml_cpp_vendor\\bin")
-  else()
-    ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.sh)
-    if(APPLE)
-      set(ENV_VAR_NAME "DYLD_LIBRARY_PATH")
-    else()
-      set(ENV_VAR_NAME "LD_LIBRARY_PATH")
-    endif()
-    set(ENV_VAR_VALUE "opt/yaml_cpp_vendor/lib")
-  endif()
-  ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.dsv.in)
 else()
   message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION} in path ${yaml-cpp_CONFIG}")
 endif()
diff --git a/yaml_cpp_vendor-extras.cmake.in b/yaml_cpp_vendor-extras.cmake.in
index deac98c..0706bc6 100644
--- a/yaml_cpp_vendor-extras.cmake.in
+++ b/yaml_cpp_vendor-extras.cmake.in
@@ -3,9 +3,9 @@ find_package(yaml-cpp QUIET)
 if(NOT yaml-cpp_FOUND)
   # add the local Modules directory to the modules path
   if(WIN32)
-    set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/yaml_cpp_vendor/CMake")
+    set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../CMake")
   else()
-    set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/yaml_cpp_vendor/share/cmake/yaml-cpp")
+    set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../lib/cmake/yaml-cpp")
   endif()
   message(STATUS "Setting yaml-cpp_DIR to: '${yaml-cpp_DIR}'")

It looks like this afterward:

$ find output/export/root/ -name *yaml[-_]cpp* | cut -d '/' -f 3-
root/share/cmake/yaml-cpp
root/share/cmake/yaml-cpp/yaml-cpp-config.cmake
root/share/cmake/yaml-cpp/yaml-cpp-config-version.cmake
root/share/cmake/yaml-cpp/yaml-cpp-targets.cmake
root/share/cmake/yaml-cpp/yaml-cpp-targets-release.cmake
root/share/pkgconfig/yaml-cpp.pc
root/share/colcon-core/packages/yaml_cpp_vendor
root/share/ament_index/resource_index/parent_prefix_path/yaml_cpp_vendor
root/share/ament_index/resource_index/package_run_dependencies/yaml_cpp_vendor
root/share/ament_index/resource_index/packages/yaml_cpp_vendor
root/share/yaml_cpp_vendor
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendorConfig.cmake
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendor-extras.cmake
root/share/yaml_cpp_vendor/cmake/yaml_cpp_vendorConfig-version.cmake
root/lib/libyaml-cpp.so.0.7
root/lib/libyaml-cpp.so
root/lib/libyaml-cpp.so.0.7.0
root/include/yaml-cpp
Dominant language
CMake
Stars
1
Forks
17
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ros2/yaml_cpp_vendor

All issues in ros2/yaml_cpp_vendor

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.