NVIDIA-ISAAC-ROS / isaac_ros_nitros

NVIDIA Isaac Transport for ROS package for hardware-acceleration friendly movement of messages
Other
95 stars 18 forks source link

Build error (conflicts with a previous declaration) on Jetpack 5.1with Docker #19

Closed Kuan-Wei-Tseng closed 1 year ago

Kuan-Wei-Tseng commented 1 year ago

Hi, I got the following compile error when I tried to compile isaac_ros_nitros for Isaac ROS Visual SLAM on Jetson with Jetpack 5.1. (The hardware is Jetson Orin)

I used the script in jetson-containers to build ROS2 Humble container.

I have tried different C++ versions to compile, but the error messages are the same.

root@XXXXXXXXX:/home/workspaces/isaac_ros-dev# colcon build
Starting >>> isaac_ros_common
Starting >>> isaac_ros_test
Finished <<< isaac_ros_test [1.85s]                                                       
Finished <<< isaac_ros_common [2.35s]                   
Starting >>> isaac_ros_gxf
Starting >>> isaac_ros_nitros_interfaces
Starting >>> isaac_ros_apriltag_interfaces
Starting >>> isaac_ros_pointcloud_interfaces                                                                                         
Starting >>> isaac_ros_tensor_list_interfaces
Starting >>> isaac_ros_visual_slam_interfaces
Starting >>> isaac_ros_bi3d_interfaces
Finished <<< isaac_ros_gxf [2.73s]                                                                                                                              
Finished <<< isaac_ros_nitros_interfaces [3.96s]                                                                                     
Starting >>> isaac_ros_nitros
Finished <<< isaac_ros_bi3d_interfaces [4.22s]                                                                                           
Finished <<< isaac_ros_pointcloud_interfaces [4.36s]                                                                                  
Finished <<< isaac_ros_tensor_list_interfaces [4.41s]                                                                                  
Finished <<< isaac_ros_apriltag_interfaces [4.67s]                                                                                                                 
Finished <<< isaac_ros_visual_slam_interfaces [4.94s]                                                               
[Processing: isaac_ros_nitros]                              
--- stderr: isaac_ros_nitros                                
In file included from /usr/local/cuda/include/cuda/std/cmath:19,
                 from /usr/local/cuda/include/cuda/std/complex:12,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/complex.hpp:23,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/tensor.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/local/cuda/include/cuda/std/detail/libcxx/include/cmath:569:101: error: ‘float cuda::std::__3::hypot(float, float, float)’ conflicts with a previous declaration
  569 | inline _LIBCUDACXX_INLINE_VISIBILITY float       hypot(       float x,       float y,       float z ) { return sqrt(x*x + y*y + z*z); }
      |                                                                                                     ^
In file included from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/emitter.h:10,
                 from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/yaml.h:11,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/parameter_parser.hpp:31,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/parameter.hpp:29,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/component.hpp:25,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/allocator.hpp:21,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:28,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/include/c++/9/cmath:1868:3: note: previous declaration ‘float std::hypot(float, float, float)’
 1868 |   hypot(float __x, float __y, float __z)
      |   ^~~~~
In file included from /usr/local/cuda/include/cuda/std/cmath:19,
                 from /usr/local/cuda/include/cuda/std/complex:12,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/complex.hpp:23,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/tensor.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/local/cuda/include/cuda/std/detail/libcxx/include/cmath:570:101: error: ‘double cuda::std::__3::hypot(double, double, double)’ conflicts with a previous declaration
  570 | inline _LIBCUDACXX_INLINE_VISIBILITY double      hypot(      double x,      double y,      double z ) { return sqrt(x*x + y*y + z*z); }
      |                                                                                                     ^
In file included from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/emitter.h:10,
                 from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/yaml.h:11,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/parameter_parser.hpp:31,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/parameter.hpp:29,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/component.hpp:25,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/allocator.hpp:21,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:28,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/include/c++/9/cmath:1872:3: note: previous declaration ‘double std::hypot(double, double, double)’
 1872 |   hypot(double __x, double __y, double __z)
      |   ^~~~~
In file included from /usr/local/cuda/include/cuda/std/cmath:19,
                 from /usr/local/cuda/include/cuda/std/complex:12,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/complex.hpp:23,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/tensor.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:30,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/local/cuda/include/cuda/std/detail/libcxx/include/cmath:572:101: error: ‘long double cuda::std::__3::hypot(long double, long double, long double)’ conflicts with a previous declaration
  572 | inline _LIBCUDACXX_INLINE_VISIBILITY long double hypot( long double x, long double y, long double z ) { return sqrt(x*x + y*y + z*z); }
      |                                                                                                     ^
In file included from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/emitter.h:10,
                 from /home/workspaces/isaac_ros-dev/build/isaac_ros_nitros/_deps/yaml-cpp-src/include/yaml-cpp/yaml.h:11,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/parameter_parser.hpp:31,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/parameter.hpp:29,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/core/component.hpp:25,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/std/allocator.hpp:21,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_gxf/gxf/core/include/gxf/multimedia/video.hpp:28,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/include/isaac_ros_nitros/utils/vpi_utilities.hpp:20,
                 from /home/workspaces/isaac_ros-dev/src/isaac_ros_nitros/isaac_ros_nitros/src/utils/vpi_utilities.cpp:11:
/usr/include/c++/9/cmath:1876:3: note: previous declaration ‘long double std::hypot(long double, long double, long double)’
 1876 |   hypot(long double __x, long double __y, long double __z)
      |   ^~~~~
make[2]: *** [CMakeFiles/isaac_ros_nitros.dir/build.make:188: CMakeFiles/isaac_ros_nitros.dir/src/utils/vpi_utilities.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:159: CMakeFiles/isaac_ros_nitros.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< isaac_ros_nitros [40.6s, exited with code 2]
FrankBu0616 commented 1 year ago

Solved it. There is a patch at the bottom of this docker file. Patch it and nitro will build.

# Apply libcudacxx patch for fixing C++17 compilation errors in GXF
COPY patches/libcudacxx_aarch64_cuda_11_4.diff /tmp/
RUN patch -i /tmp/libcudacxx_aarch64_cuda_11_4.diff /usr/local/cuda-11.4/targets/aarch64-linux/include/cuda/std/detail/libcxx/include/cmath
jaiveersinghNV commented 1 year ago

Thanks @FrankBu0616 for identifying the fix.

For future reference, we also provide a run-dev.sh script inside Isaac ROS Common that builds an Isaac ROS-compatible container on both Jetson and x86 platforms. If you use our script, you'll automatically get any patches that we've applied in our Dockerfiles.

Kuan-Wei-Tseng commented 1 year ago

@FrankBu0616 I see. Thank you so much for pointing it out. :)