Segmentation Fault When Visualizing Live Fused Point Cloud with PCL Viewer

Hi all,

I’m working on a project that involves fusing point cloud data from two ZED2i cameras. My workflow is as follows:

  • Calibration: I use ZED360 to obtain the calibration parameters for my multi-camera setup.
  • Fusion: I use the Stereolabs Fusion API (from the ZED SDK 5) to combine the data streams.
  • Visualization: I can successfully visualize the fused point cloud in real time using the provided GLViewer.

My goal:
I need to process the fused point cloud further (e.g., for object detection with YOLO), so I’m trying to downsample the fused cloud using PCL’s VoxelGrid filter. I want to visualize the live (not saved) downsampled point cloud using PCL’s viewer (pcl::visualization::PCLVisualizer or CloudViewer), instead of GLViewer.

What Works

  • I can save the downsampled point cloud to disk and view it with pcl_viewer without any issues.
  • The live fused cloud displays correctly in GLViewer.

What Fails

  • When I try to visualize the live fused or live downsampled point cloud with PCL’s viewer (in the same process, not from a saved file), I get a segmentation fault (Segmentation fault (core dumped)).
  • I have tried both my own code and the official Stereolabs ZED + PCL sample from this repo, but the error persists.
  • The error occurs as soon as the PCL viewer window opens, before any cloud is rendered.

My Setup

  • Cameras: 2 × ZED2i
  • Calibration: ZED360
  • Fusion: ZED SDK 5 (Ubuntu 22.04)
  • Downsampling: PCL VoxelGrid
  • Visualization: PCL Visualizer (pcl::visualization::PCLVisualizer or CloudViewer)
  • GLViewer works fine
  • PCL version: 1.12 (Ubuntu package)
  • VTK version: 9.1 (Ubuntu package)

What I’ve Tried

  • Verified that the point cloud pointer is valid and persistent throughout the viewer’s lifetime.
  • Ensured the cloud dimensions match the ZED output (width × height).
  • Protected all cloud access with mutexes (since I’m using threads for ZED data acquisition).
  • Checked that the cloud is non-empty before updating the viewer.
  • Used both my own code and the official Stereolabs ZED + PCL sample code.
  • The crash always occurs in the X11/VTK event loop, specifically during spinOnce() or showCloud().

Why I Need PCL Viewer

I need to further process the fused point cloud (e.g., for object detection with YOLO or other models), and PCL’s data structures and visualization tools are essential for my workflow.

Error Details

  • The segmentation fault occurs as soon as the PCL viewer window opens (before any points are rendered).
  • Saving the cloud and viewing it with pcl_viewer from the command line works fine.
  • The error persists even when using the official Stereolabs sample code.

Request

Has anyone successfully visualized a live fused (or downsampled) point cloud from two ZED2i cameras using PCL’s viewer on Ubuntu 22.04 with ZED SDK 5?

  • Is there a known compatibility issue between ZED SDK 5, PCL 1.12, and VTK 9.1?
  • Are there additional steps needed to make the live point cloud compatible with PCL’s viewer?
  • Any suggestions for debugging or workarounds?

Any help or advice would be greatly appreciated!

I have attached a screenshot of the error and am happy to provide code snippets or more details as needed.

Hi @priyamgupta
Welcome to the StereoLabs community.

This seems to be a PCL issue. PCL is not maintained anymore, so this may require a fix that no one will ever add.

Have you tried using Open3D instead?

Hi Myzhar,

As you suggested, I tried switching from PCL to Open3D, but unfortunately, I keep running into persistent build errors—this time related to zstd (Zstandard) libraries, which seem to be triggered during the build process for C++.

What I Tried

  • Followed the Open3D build instructions for C++.
  • The build proceeds fine until about 80%, then fails with errors like:

text

/usr/bin/ld: ../../curl/lib/libcurl.a(content_encoding.c.o): in function `zstd_do_close':
content_encoding.c:(.text+0x62): undefined reference to `ZSTD_freeDStream'
/usr/bin/ld: ... undefined reference to `ZSTD_createDStream'
/usr/bin/ld: ... undefined reference to `ZSTD_decompressStream'
/usr/bin/ld: ... undefined reference to `ZSTD_isError'
collect2: error: ld returned 1 exit status
  • This happens for several targets, including examples and main apps, even after multiple clean builds.

What I’ve Already Done

  • Installed libzstd-dev (the development package for zstd) and confirmed the library exists at /usr/lib/x86_64-linux-gnu/libzstd.so.
  • Tried cleaning the build directory and rebuilding from scratch.
  • Attempted to add zstd-related flags and variables in the CMake configuration.
  • Tried explicitly linking zstd in various ways, but the error persists.

What Seems to Be the Problem

  • The error is not directly about ZED (StereoLabs) libraries, but about how Open3D’s build system links its internal static libcurl with zstd.
  • When Open3D builds its own static libcurl with zstd support, all executables and libraries that use curl must also explicitly link to zstd. This is a CMake/static linking issue, not a missing package.

What I Need Help With

  • Has anyone successfully built Open3D C++ with ZED support recently?
  • Is there a known workaround or a patch for this zstd linking issue?
  • Are there any Open3D build flags or CMake tricks to force all targets to link with zstd, or to avoid this problem entirely?

Example of the Error

text

[ 80%] Linking CXX executable ../../OfflineReconstruction/OfflineReconstruction
/usr/bin/ld: ../../curl/lib/libcurl.a(content_encoding.c.o): in function `zstd_do_close':
content_encoding.c:(.text+0x62): undefined reference to `ZSTD_freeDStream'
...
collect2: error: ld returned 1 exit status
make[2]: *** [cpp/apps/CMakeFiles/OfflineReconstruction.dir/build.make:183: OfflineReconstruction/OfflineReconstruction] Error 1

I’ve tried several times, but keep hitting this same wall. If you or anyone else has advice on resolving this zstd/curl linkage issue with Open3D (especially when using ZED), I’d really appreciate your help!

Hi @priyamgupta
I recommend you contact the Open3D support for specific issues with their software: https://www.open3d.org/help/