Unable to Import PCL library in Isaac SDK

I would like to use the PCL library for our development within NVIDIA Isaac 2020.2 SDK. But there are no support and sample examples to refer to. When we tried to import it with a syntax used by a similar third-party library, the module fails to build even with multiple attempts to include the dependency.

INFO: Analyzed target //apps/robot_nav/ros_bridge:app_ros_bridge (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/ki-adm-2/workspace/adm_core/isaac/sdk/apps/robot_nav/ros_bridge/BUILD:78:1: Couldn't build file apps/robot_nav/ros_bridge/_objs/_modlib_ros_to_tim_components/RosToTim.o: C++ compilation of rule '//apps/robot_nav/ros_bridge:_modlib_ros_to_tim_components' failed (Exit 1) crosstool_wrapper_driver_is_not_gcc_host.py failed: error executing command external/toolchain/crosstool/scripts/crosstool_wrapper_driver_is_not_gcc_host.py -MD -MF bazel-out/k8-opt/bin/apps/robot_nav/ros_bridge/_objs/_modlib_ros_to_tim_components/RosToTim.d ... (remaining 233 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from apps/robot_nav/ros_bridge/RosToTim.cpp:1:0:
apps/robot_nav/ros_bridge/RosToTim.hpp:17:10: fatal error: pcl/segmentation/extract_clusters.h: No such file or directory
 #include <pcl/segmentation/extract_clusters.h>
compilation terminated.
Target //apps/robot_nav/ros_bridge:app_ros_bridge failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.365s, Critical Path: 1.03s
INFO: 0 processes.
FAILED: Build did NOT complete successfull

So, to fix this I tried to utilize the third party PCL library found in isaac/sdk/third_party/packages.bzl . I updated the dependencies of ros_to_tim_components,

isaac_cc_module(
    name = "ros_to_tim_components",
    visibility = ["//visibility:public"],
    deps = [      
        "//packages/ros_bridge/components:ros_node",
        "//third_party:ros",
        "@pcl//:segmentation",
        "//packages/ros_bridge/components:ros_to_proto_converter",
     ],
    srcs = [ "RosToTim.cpp",  ],
    hdrs = [ "RosToTim.hpp",  ],
)

I am trying to use the pcl header #include <pcl/segmentation/extract_clusters.h> in the RosToTim.hpp header file. Even after the changes to the build file, bazel is unable to build the component.

$ bazel build //apps/robot_nav/ros_bridge:app_ros_bridge
INFO: Analyzed target //apps/robot_nav/ros_bridge:app_ros_bridge (1 packages loaded, 19 targets configured).
INFO: Found 1 target...
ERROR: /home/ki-adm-2/workspace/adm_core/isaac/sdk/apps/robot_nav/ros_bridge/BUILD:78:1: Couldn't build file apps/robot_nav/ros_bridge/_objs/_modlib_ros_to_tim_components/RosToTim.o: C++ compilation of rule '//apps/robot_nav/ros_bridge:_modlib_ros_to_tim_components' failed (Exit 1) crosstool_wrapper_driver_is_not_gcc_host.py failed: error executing command external/toolchain/crosstool/scripts/crosstool_wrapper_driver_is_not_gcc_host.py -MD -MF bazel-out/k8-opt/bin/apps/robot_nav/ros_bridge/_objs/_modlib_ros_to_tim_components/RosToTim.d ... (remaining 544 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from bazel-out/k8-opt/bin/external/isaac_ros_bridge_x86_64/_virtual_includes/isaac_ros_bridge_x86_64/boost/config.hpp:39:0,
                 from bazel-out/k8-opt/bin/external/isaac_ros_bridge_x86_64/_virtual_includes/isaac_ros_bridge_x86_64/boost/next_prior.hpp:19,
                 from ./packages/ros_bridge/gems/include_before_ros.hpp:20,
                 from ./packages/ros_bridge/components/RosNode.hpp:16,
                 from ./packages/ros_bridge/components/RosToProtoConverter.hpp:16,
                 from apps/robot_nav/ros_bridge/RosToTim.hpp:14,
                 from apps/robot_nav/ros_bridge/RosToTim.cpp:1:
bazel-out/k8-opt/bin/external/isaac_ros_bridge_x86_64/_virtual_includes/isaac_ros_bridge_x86_64/boost/config/compiler/gcc.hpp:303:0: error: "BOOST_FALLTHROUGH" redefined [-Werror]
 #  define BOOST_FALLTHROUGH __attribute__((fallthrough))
 
<command-line>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
Target //apps/robot_nav/ros_bridge:app_ros_bridge failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.096s, Critical Path: 5.63s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

How to go about utilizing the third party PCL library successfully? @hemals @shrinv

1 Like

PCL is built and linked in for several codelets in Isaac SDK, including sdk://packages/surflets/components:point_cloud_clustering, but the build error here seems to have nothing to do with PCL specifically if I read correctly. It appears that boost/next_prior.hpp is getting included twice. Perhaps there is a #pragma once not being respected or a missing header guard somewhere?