PointCloudLibrary / PointCloudLibrary/pcl

including visualizer header causes segfault with clang tidy

Open
#2,769 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: visualization needs: author reply status: stale
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Your Environment

  • Operating System and version: Ubuntu 18.04
  • Compiler: GCC 7
  • PCL Version: Latest

Context

Please see below minimal code to reproduce the problem

CMakeLists.txt

cmake_minimum_required(VERSION 3.11)

project(sample)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

find_package(PCL REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES})

main.cpp

#include "pcl/visualization/pcl_visualizer.h"

int main() {
  int a; // this is needed to trigger the segfault along with including pcl_visualizer.h

  return 0;
}

After mkdir build && cd build and then cmake "-DCMAKE_CXX_CLANG_TIDY=clang-tidy" ..

make yields

[ 50%] Building CXX object CMakeFiles/sample.dir/main.cpp.o
Error running 'clang-tidy': Segmentation fault
CMakeFiles/sample.dir/build.make:62: recipe for target 'CMakeFiles/sample.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/sample.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/sample.dir/all' failed
make[1]: *** [CMakeFiles/sample.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@SunBlack do you have any idea how to solve this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal CMakeLists.txt and main.cpp reproduction, especially the inclusion of pcl/visualization/pcl_visualizer.h and the CMAKE_CXX_CLANG_TIDY=clang-tidy configuration. Run the reported cmake and make commands on Ubuntu 18.04 to confirm the failure; done means clang-tidy no longer segfaults for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.