USE_SCOPED_HEADER_INSTALL_DIR path issues

Aperta
#273 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cmake, cpp
Ambito
build-system

Direzione di ricerca

Start by reproducing the downstream compilation failure with the described st_ptz_control and st_flir packages, then inspect their CMakeLists.txt files and the generated st_ptz_control_params.hpp include and install paths. Compare the installed header layout with the include path used by ptz.hpp; done means a downstream package can include onvif_ptz.hpp without a missing-header error or deprecation warning.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Running ROS2 Jazzy on Ubuntu 24.04.3

We have started migrating to the new include path location by adding USE_SCOPED_HEADER_INSTALL_DIR to our ament_auto_package() calls in our CMakeLists.txt files (https://github.com/ament/ament_cmake/pull/577). This creates a problem when the generated params.hpp header is included in a public installed header that is then included in a downstream package.

Source

Given this package

src/camera/st_ptz_control/include/st/camera/ptz/onvif_ptz.hpp
src/camera/st_ptz_control/include/st/camera/ptz/ptz.hpp

where onvif_ptz.hpp has the line

#include "st/camera/ptz/ptz.hpp"

where ptz.hpp has the line

#include <st_ptz_control/st_ptz_control_params.hpp>

and its CMakeLists (cruft removed):

generate_parameter_library(
  st_ptz_control_params
  src/params.yaml
)

ament_auto_add_library(
  st_ptz_control_component SHARED
  src/ptz.cpp
)

target_link_libraries(
  st_ptz_control_component
  st_ptz_control_params)

ament_auto_package(USE_SCOPED_HEADER_INSTALL_DIR)

This produces installed headers:

/opt/st/core/st_ptz_control
|-- include
|   `-- st_ptz_control
|       |-- st
|       |   `-- camera
|       |       `-- ptz
|       |           |-- commands.hpp -> /workspace/STcore/core/src/camera/st_ptz_control/include/st/camera/ptz/commands.hpp
|       |           |-- onvif_ptz.hpp -> /workspace/STcore/core/src/camera/st_ptz_control/include/st/camera/ptz/onvif_ptz.hpp
|       |           |-- ptz.hpp -> /workspace/STcore/core/src/camera/st_ptz_control/include/st/camera/ptz/ptz.hpp
|       |           `-- visibility_control.hpp -> /workspace/STcore/core/src/camera/st_ptz_control/include/st/camera/ptz/visibility_control.hpp
|       `-- st_ptz_control_params.hpp -> /workspace/STcore/core/build/st_ptz_control/include/st_ptz_control/st_ptz_control_params.hpp

This package is used by a downstream package with the header

src/camera/st_flir/src/flir.hpp

which has the line

#include "st/camera/ptz/onvif_ptz.hpp"

and its package.xml has

  <depend>st_ptz_control</depend>

Issues

As-written, this generates a compilation error in st_flir:

--- stderr: st_flir
In file included from /opt/st/core/st_ptz_control/include/st_ptz_control/st/camera/ptz/onvif_ptz.hpp:3,
                 from /workspace/STcore/core/src/camera/st_flir/src/flir.hpp:3,
                 from /workspace/STcore/core/src/camera/st_flir/src/flir.cpp:1:
/opt/st/core/st_ptz_control/include/st_ptz_control/st/camera/ptz/ptz.hpp:6:10: fatal error: st_ptz_control/st_ptz_control_params.hpp: No such file or directory
    6 | #include <st_ptz_control/st_ptz_control_params.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/st_flir_component.dir/build.make:76: CMakeFiles/st_flir_component.dir/src/flir.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/st_flir_component.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< st_flir [0.12s, exited with code 2]

If I modify the include in onvif_ptz.hpp to be just #include <st_ptz_control_params.hpp> then I get a deprecation warning:

--- stderr: st_ptz_control
In file included from /workspace/STcore/core/src/camera/st_ptz_control/include/st/camera/ptz/ptz.hpp:5,
                 from /workspace/STcore/core/src/camera/st_ptz_control/src/ptz.cpp:1:
/workspace/STcore/core/build/st_ptz_control/include/st_ptz_control_params.hpp:1:137: note: ‘#pragma message: #include "st_ptz_control_params.hpp" is deprecated. Use #include <st_ptz_control/st_ptz_control_params.hpp> instead.’
    1 | #pragma message("#include \"st_ptz_control_params.hpp\" is deprecated. Use #include <st_ptz_control/st_ptz_control_params.hpp> instead.")

Which, if I follow the instructions in the deprecation warning, it appears to be a valid path based on the installed header structure.

Lingua principale
Python
Stelle
385
Fork
81
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PickNikRobotics/generate_parameter_library

Tutte le issue di PickNikRobotics/generate_parameter_library

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.