Skip to content

Build error PCL + VTK 6.1 + CUDA #776

@duga3

Description

@duga3
Contributor

I'm trying to build the latest master with VTK 6.1 and GPU support.
This might relate to #766.
I used the following to configure:

cmake \
    -DBUILD_CUDA=ON \
    -DBUILD_GPU=ON \
    -DBUILD_people=OFF \
    -DBUILD_simulation=OFF \
    -DBUILD_recognition=OFF \
    -DBUILD_segmentation=ON \
    -DBUILD_stereo=OFF \
    -DBUILD_visualization=ON \
    -DWITH_VTK=ON \
    -DWITH_QT=OFF \
    -DWITH_TUTORIALS=OFF \
    -DWITH_DOCS=OFF \
    -DWITH_FZAPI=OFF \
    -DCUDA_SDK_ROOT_DIR=/usr/local/cuda \
    -DCUDA_ARCH_BIN="3.0 3.5" \
    -Wno-dev \
    -DCMAKE_BUILD_TYPE=Release \
     ..

My system:

  • Ubuntu Ubuntu 14.04
  • gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
  • CUDA 5.5
  • VTK 6.1

All libs are correctly found and the configuration finishes without errors.
Compiling stops with:

CMake Warning (dev) in pcl_cuda_features_generated_normal_3d.cu.o.cmake:
  Syntax Warning in cmake code at

    /scratch/pcl/build/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/pcl_cuda_features_generated_normal_3d.cu.o.cmake:79:215

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in pcl_cuda_features_generated_normal_3d.cu.o.cmake:
  Syntax Warning in cmake code at

    /scratch/pcl/build/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/pcl_cuda_features_generated_normal_3d.cu.o.cmake:79:273

nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
CMake Error at pcl_cuda_features_generated_normal_3d.cu.o.cmake:202 (message):
  Error generating
  /scratch/pcl/build/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/./pcl_cuda_features_generated_normal_3d.cu.o

The error is caused from line 79 in "pcl_cuda_features_generated_normal_3d.cu.o.cmake".
The VTK cmake files add definitions like

-DvtkRenderingCore_AUTOINIT=4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
-DvtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL)

They end up in the nvcc_flags variable and cause nvcc to crash.
When I removed them manually, the cuda file I've done it for, compiles.
These definitions come from the new way VTK6 initializes the object factories.
nvcc seems like not to like these and exits with

nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified

The VTK cmake files automatically add these vtk* definitions.
More details here: http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines

For another project I solved this problem by adding a "vtk definitions filter" to the module that compiles the CUDA files.
Might no be the best solution, but the cmake code looks like this.

get_directory_property(dir_defs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
set(vtk_flags)
foreach(it ${dir_defs})
    if(it MATCHES "vtk*")
    list(APPEND vtk_flags ${it})
    endif()
endforeach()

foreach(d ${vtk_flags})
    remove_definitions(-D${d})
endforeach()

Activity

HaArLiNsH

HaArLiNsH commented on Jun 30, 2014

@HaArLiNsH

Lets continue my issues #776 here

My system :

  • Windows 8.1 x64
  • Visual Studio 2012 x64
  • CUDA 6.0 x64
  • VTK 6.1 x64
  • QT 5.3 x64

We have VTK 6.1 in common so I think its only this migration problem you mention.

But you are mentioning the CUDA section build and not the gpu section build. I tought the CUDA section was depreciated a long time ago and only the gpu section was needed. Kinfu is in the gpu section. Am I wrong somewhere ?

Anyway , cuda or gpu section , the problem come from VTK.

In pcl_gpu_features_generated_centroid.cu.obj.cmake on line 79 we can find this related to VTK

-DvtkIOGeometry_AUTOINIT=1(vtkIOMPIParallel);
-DvtkIOImage_AUTOINIT=1(vtkIOMPIImage);
-DvtkRenderingCore_INCLUDE="C:/Dev/PCL/Pcl-master/build/CMakeFiles/vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingFreeType_vtkRenderingFreeTypeOpenGL_vtkRenderingOpenGL.h";
-DvtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL);

and I can find similars line on every cmake on the gpu section (features, containers, kinfu .)

As duga3 propose , I think we need to reformat the way VTK put theses definitions.

But its beyond my programming capabilities for now

duga3

duga3 commented on Jul 1, 2014

@duga3
ContributorAuthor

@HaArLiNsH Seems that your issue is also caused by the VTK definitions.

I just had a look at the PCL CMake scripts.
Somebody could add convert the PCL_CUDA_ADD_LIBRARY macros to functions that have a local variable scope and remove the VTK definitions locally. Unfortunately PCL also uses CUDA_COMPILE sometimes, so another function wrapping CUDA_COMPILE would be necessary too.
There are probably better solutions, would be nice to hear the opinion of a PCL developer.

jspricke

jspricke commented on Jul 31, 2014

@jspricke
Member

Hi @duga3 your solution sounds plausible. Can you send a pull request with it? Thanks!

eidelen

eidelen commented on Jun 22, 2016

@eidelen

Hi duga3,
I ran into the same problem with CUDA and vtk. Your macro solved it perfectly ;) Thx!

duga3

duga3 commented on Mar 28, 2017

@duga3
ContributorAuthor

I have unfortunately no fast fix, but I think you have to find out what variables are passed to the nvcc compiler. I wrote that fix 3 years ago, I guess that cmake/nvcc handling changed a bit since then.
As a starting point, try running make VERBOSE=1 so you see what's actually passed to nvcc, Then you can check FindCUDA.cmake how it handles defines.

Isha8

Isha8 commented on Nov 4, 2017

@Isha8

I get the same errors, tried with VERBOSE = 1. How to change MARCO with a function? Kindly let me know.
`2 errors detected in the compilation of "/tmp/tmpxft_00006d71_00000000-12_normal_3d.compute_61.cpp1.ii".
CMake Error at pcl_cuda_features_generated_normal_3d.cu.o.cmake:268 (message):
Error generating file
/home/isha/pcl-trunk/build/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/./pcl_cuda_features_generated_normal_3d.cu.o

cuda/features/CMakeFiles/pcl_cuda_features.dir/build.make:977: recipe for target 'cuda/features/CMakeFiles/pcl_cuda_features.dir/src/pcl_cuda_features_generated_normal_3d.cu.o' failed
make[2]: *** [cuda/features/CMakeFiles/pcl_cuda_features.dir/src/pcl_cuda_features_generated_normal_3d.cu.o] Error 1
CMakeFiles/Makefile2:9291: recipe for target 'cuda/features/CMakeFiles/pcl_cuda_features.dir/all' failed
make[1]: *** [cuda/features/CMakeFiles/pcl_cuda_features.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
`

yaochx

yaochx commented on May 21, 2018

@yaochx

this caused by "add_definitions(${PCL_DEFINITIONS})"

  1. add 'set_directory_properties(` PROPERTIES COMPILE_DEFINITIONS "" ) after cxx/nvcc flags setting
  2. or to remove 'add_definitions(${PCL_DEFINITIONS})

this works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jspricke@duga3@HaArLiNsH@eidelen@yaochx

        Issue actions

          Build error PCL + VTK 6.1 + CUDA · Issue #776 · PointCloudLibrary/pcl