ros-drivers / velodyne

ROS support for Velodyne 3D LIDARs
http://ros.org/wiki/velodyne
Other
646 stars 643 forks source link

Noetic PCL Build warning (-Wdeprecated-declarations) #445

Closed icolwell-as closed 2 years ago

icolwell-as commented 2 years ago

Please complete the following information:

Describe the bug When including velodyne_pcl/point_types.h for use in a ROS package, the following error is produced when compiling:

                 from /home/ian/autoware.ai/src/core_perception/points_downsampler/nodes/ring_filter/ring_filter.cpp:17:
/opt/ros/noetic/include/velodyne_pcl/point_types.h:66:36: warning: ‘using uint16_t = uint16_t’ is deprecated: use std::uint16_t instead of pcl::uint16_t [-Wdeprecated-declarations]
   66 |                                   (uint16_t, ring, ring)
      |                                    ^~~~~~~~
In file included from /usr/include/pcl-1.10/pcl/point_types.h:42,
                 from /opt/ros/noetic/include/velodyne_pcl/point_types.h:46,
                 from /home/ian/autoware.ai/src/core_perception/points_downsampler/nodes/ring_filter/ring_filter.cpp:20:
/usr/include/pcl-1.10/pcl/pcl_macros.h:94:9: note: declared here
   94 |   using uint16_t [[deprecated("use std::uint16_t instead of pcl::uint16_t")]] = std::uint16_t;
      |         ^~~~~~~~

To Reproduce Steps to reproduce the behavior:

Include the header and compile it.

Expected behavior No deprecation warnings.

Additional context I think the problem might actually be coming from the specific version of PCL installed.

JWhitleyWork commented 2 years ago

@icolwell-as Would you mind submitting a PR to resolve?

icolwell-as commented 2 years ago

@JWhitleyWork, I had actually intended to do that, but then got a bit lost trying to find the real root cause. I could open a PR that would resolve it, but it might be better resolved some other way.

Perhaps you can help clear up some of my confusion: When it comes to the version of PCL that is used with certain ROS distros (noetic for example), it is pretty much dictated by the version of PCL that is distributed from Ubuntu's repos right? in the case of Ubuntu 20.04 this appears to be 1.10.0 when I run dpkg -l libpcl-dev.

This version of PCL will pretty much remain the same for the lifetime of ROS Noetic right? we wouldn't expect it to get updated due to Ubuntu's "stability" approach to their releases?

JWhitleyWork commented 2 years ago

@icolwell-as Yes, this is correct. The ROS pcl_ros package depends on the rosdep key libpcl-all-dev. In rosdep, based on this line, this will get resolved to the Ubuntu package libpcl-dev in the Ubuntu distribution that you're currently using. For focal (20.04), that meta-package depends on 1.10.0 (see here). If there is ever a bugfix release, it will be updated for Focal. However, it won't ever go beyond 1.10.x.

icolwell-as commented 2 years ago

Thanks @JWhitleyWork for confirming that with helpful links!

So with PCL 1.10.0, the following deprecation warning exists here. This is what produces the build warnings in my original post.

PCL 1.11+ seems to have removed those deprecation warnings, so they would no longer be an issue. However, since Noetic will target 1.10 for its lifetime, I think it's best to make the change here in this repo to suppress these warnings, even though there isn't really anything wrong with the code here.

I'll open a PR shortly, thanks!

JWhitleyWork commented 2 years ago

Makes sense to me!