PointCloudLibrary/pcl

[compile error] cmake-generated compile flags does not compile

Open

#4,380 opened on Sep 4, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C++ (9,023 stars) (4,506 forks)batch import
help wantedkind: compile errorneeds: testingskill: cmake

Description

Describe the error

Hi everyone, thanks for all your work in this excellent project.

I would just like to ask your expertise in solving the compile error that I have encountered. I am currently updating the docker image that is used to compile our code. The previous image uses Ubuntu 16.04 and the new image has Ubuntu 18.04. I am using the same PCL version and there are no changes in the code so far. The compilation in the old image had no problems but when I tried compiling in the new image, the following error came out:

nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
CMake Error at gen_histogram_filter_gpu.cu.o_deps.cmake:192 (message):
  Error generating
 .../gen_histogram_filter_gpu.cu.o.NVCC-depend


CMakeFiles/update_cuda_deps.dir/build.make:81: recipe for target '.../gen_histogram_filter_gpu.cu.o.depend.stamp' failed
make[2]: *** [modules/localization/CMakeFiles/localization_linux_x86_64.dir/src/lidar_mm/lidar_localization/cuda/gen_histogram_filter_gpu.cu.o.depend.stamp] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/update_cuda_deps.dir/all' failed
make[1]: *** [CMakeFiles/update_cuda_deps.dir/all] Error 2

I tried to get a verbose output of the make command and the following output was shown:

$ make VERBOSE=1
...
/usr/local/cuda/bin/nvcc -M -D__CUDACC__ .../cuda/histogram_filter_gpu.cu -o .../gen_histogram_filter_gpu.cu.o.NVCC-depend -ccbin /usr/bin/c++ -m64 -Dx86_64 ... -DvtkFiltersFlowPaths_AUTOINIT=1 ( vtkFiltersParallelFlowPaths ) -DvtkIOExodus_AUTOINIT=1 ( vtkIOParallelExodus ) -DvtkIOGeometry_AUTOINIT=1 ( vtkIOMPIParallel ) -DvtkIOImage_AUTOINIT=1 ( vtkIOMPIImage ) -DvtkIOParallel_AUTOINIT=1 ( vtkIOMPIParallel ) -DvtkIOSQL_AUTOINIT=2 ( vtkIOMySQL,vtkIOPostgreSQL ) -DvtkRenderingContext2D_AUTOINIT=1 ( vtkRenderingContextOpenGL ) -DvtkRenderingCore_AUTOINIT=3 ( vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL ) -DvtkRenderingFreeType_AUTOINIT=2 ( vtkRenderingFreeTypeFontConfig,vtkRenderingMatplotlib ) -DvtkRenderingLIC_AUTOINIT=1 ( vtkRenderingParallelLIC ) -DvtkRenderingVolume_AUTOINIT=1 ( vtkRenderingVolumeOpenGL ) -DDISABLE_PCAP -DDISABLE_PNG -DDISABLE_LIBUSB_1_0 -std=c++11 -O2 -Xcompiler -fPIC -Xcompiler -fvisibility=hidden -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 --default-stream per-thread -DNVCC -I..

The generated VTK compile flags seems to have parentheses missing:

-DvtkFiltersFlowPaths_AUTOINIT=1 ( vtkFiltersParallelFlowPaths )  -> -DvtkFiltersFlowPaths_AUTOINIT="1 ( vtkFiltersParallelFlowPaths )" ? 

Commenting out the following CMakeList.txt lines fixed the compile flags. That was the reason I guessed it might be the compile flags generated by PCL that was causing the error.

FindPackage(PCL VERSION 1.9 REQUIRED
## Add corresponding component while you need
    COMPONENTS common io gpu_containers
## Make sure to use specific-version pcl built from our *.deb
    PATHS "${CROSSPREFIX}/usr/local/pcl-1.9/share/pcl-1.9/" NO_DEFAULT_PATH)
#include_directories(SYSTEM ${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
...
set(INCLUDES
    ...
    ${PCL_INCLUDE_DIRS}
    )
...
set(LINK_LIBS 
    ...
    ${PCL_LIBRARIES}
    ...
    )

To Reproduce

It is not possible to post the CMakeList.txt file and code here but I am compiling the code inside a Docker container.

Your Environment (please complete the following information):

The Docker image I am using is quiet big so I am not able to post it here but the following are the software versions contained in the previous and new image:

  • Previous Docker image:
Base OS and version: Ubuntu 16.04
Cuda version: 10.0
gcc version: 5.4.0
cmake version: 3.5.1
PCL version: 1.9.1
  • New Docker image:
Base OS and version: Ubuntu 18.04
Cuda version: 10.0
gcc version: 7.5.0
cmake version: 3.10.2
PCL version: 1.9.1

PCL compilation commands inside container:

# install point cloud library
ARG pcl_version=1.9.1
ARG install_dir=/tmp/pcl-install
RUN mkdir ${install_dir} && cd ${install_dir} \
    && wget https://github.com/PointCloudLibrary/pcl/archive/pcl-${pcl_version}.tar.gz \
    && tar zxf pcl-${pcl_version}.tar.gz \
    && cd pcl-pcl-${pcl_version} && mkdir build && cd build \
    && cmake -D CMAKE_INSTALL_PREFIX=/usr/local/pcl-1.9 -D CMAKE_BUILD_TYPE=Release .. \
    && make && make install \
    && rm -rf ${install_dir}

Contributor guide