PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.96k stars 4.62k forks source link

[visualization] -DWITH_VTK=ON does not enforce VTK presence when DBUILD_visualization=ON #4415

Open themightyoarfish opened 4 years ago

themightyoarfish commented 4 years ago

Context

I want to compile PCL with VTK enabled (not optional). I therefore run cmake -DWITH_VTK=ON -DDBUILD_visualization=ON ... VTK however is not installed.

Expected behavior

The build process should error out,

Current Behavior

CMake shows the warning that VTK was not found, but continues.

CMake Warning at CMakeLists.txt:395 (find_package):
  By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "VTK", but
  CMake did not find one.

  Could not find a package configuration file provided by "VTK" with any of
  the following names:

    VTKConfig.cmake
    vtk-config.cmake

  Add the installation prefix of "VTK" to CMAKE_PREFIX_PATH or set "VTK_DIR"
  to a directory containing one of the above files.  If "VTK" provides a
  separate development package or SDK, be sure it has been installed.

Visualization module, which needs VTK is not disabled (because I enabled it explicitly) and thus compilation errors ensue:

/private/var/folders/_p/j1qf8m7x31g3g_c6kvnbgp840000gp/T/tmp.pHnSEdrXFZ/pcl-pcl-1.11.1/visualization/src/point_picking_event.cpp:39:10: fatal error: 'pcl/visualization/point_picking_event.h' file not found
#include <pcl/visualization/point_picking_event.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To Reproduce

I'm using this code to install PCL:

install_pcl() {
    (
        if [ -z "$1" ]; then
            local -r version=1.11.1
        else
            local -r version=$1
        fi
            wget -N https://github.com/PointCloudLibrary/pcl/archive/pcl-$version.tar.gz -O pcl-$version.tar.gz && \
            tar -v -xzf pcl-$version.tar.gz && \
            mkdir -p pcl-pcl-$version/build && \
            cd pcl-pcl-$version/build && \
            cmake ..   \
            -DBUILD_io=ON \
            -DWITH_VTK=ON \
            -DBUILD_kdtree=ON \
            -DBUILD_visualization=ON \
            -DBUILD_octree=ON \
            -DBUILD_io=ON \
            -DBUILD_filters=ON \
            -DBUILD_surface=OFF \
            -DBUILD_CUDA=OFF \
            -DBUILD_GPU=OFF \
            -DBUILD_examples=OFF \
            -DBUILD_features=OFF \
            -DBUILD_tools=ON \
            -DBUILD_keypoints=OFF \
            -DBUILD_ml=OFF \
            -DBUILD_outofcore=OFF \
            -DBUILD_people=OFF \
            -DBUILD_tracking=OFF \
            -DBUILD_registration=OFF \
            -DBUILD_recognition=OFF && \
            make -j8 install
    )
}

Your Environment (please complete the following information):

Possible Solution

Not sure how the -DBUILD_<module> options are generated, but visualizations CMakeLists.txt should have a way to either disable itself even when explicitly requested by user when VTK is not found.

kunaltyagi commented 4 years ago

That's weird. I did the following:

$ docker run --rm -it ubuntu:20.04 bash
# apt update
# apt install libeigen3-dev libboost-all-dev libflann-dev git build-essential cmake mesa-common-dev -y
# git clone https://github.com/PointCloudLibrary/pcl
# mkdir pcl/build && cd pcl/build
# cmake -DWITH_VTK=ON -DBUILD_visualization ..
# make install

But saw no errors. It's true that CMake didn't fail, but that is different that the error you mentioned. PRs welcome to fix the lack of failure in CMake config step

stale[bot] commented 3 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.