Bug 1079531

Summary: PCL 1.7* cmake add_definitions issue
Product: [Fedora] Fedora Reporter: Debra Cook <dcook>
Component: pclAssignee: Tim Niemueller <tim>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dcook, richmattes, tim, wfehrnstrom
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcl-1.7.1-2.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-03 04:05:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Debra Cook 2014-03-21 18:41:46 UTC
Description of problem:
When attempting to compile pcl with cmake, add_definitions(${PCL_DEFINITIONS})
returns an error. 

Version-Release number of selected component (if applicable):
pcl 1.7* 

How reproducible:

CMakeList.txt
cmake_minimum_required(VERSION 1.6 FATAL_ERROR)
project(TEST_PROJECT)
find_package(PCL 1.7 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write pcd_write.cpp)
target_link_libraries(pcd_write ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})


Steps to Reproduce:
Assuming FC 20, pcl 1.7* and vtk 6.* are installed along with any other pcl dependencies
1. create a simple pcl program
2. use the CMakeList.txt listed above
3. create a build directory in the directory containing the program and CMakeList.txt
4. type cmake ..

Actual results:
[100%] Building CXX object CMakeFiles/pcd_write.dir/pcd_write.o
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/usr/bin/c++   -DDISABLE_PCAP -DDISABLE_PNG -DEIGEN_USE_NEW_STDVECTOR -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET -DvtkRenderingCore_AUTOINIT="4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)" -DvtkRenderingVolume_AUTOINIT="1(vtkRenderingVolumeOpenGL)" -I/usr/local/include/vtk-6.2 -I/usr/local/include/pcl-1.7 -I/usr/include/eigen3 -I/usr/include/ni    vtkRenderingCore_AUTOINIT=4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL) vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL) -o CMakeFiles/pcd_write.dir/pcd_write.o -c /home/testuser/pcd_write.cpp'
make[2]: *** [CMakeFiles/pcd_write.dir/pcd_write.o] Error 1
make[1]: *** [CMakeFiles/pcd_write.dir/all] Error 2

Expected results:
 no errors, program compiles

Additional info:

this is related to an issue posted on the pcl user's forum resulting 
from pcl 1.7* and vtk 6
one of the responses requested that a bug report be issued here for the cmake add_definitions error

From Rich Mattes on PCL user forum
"The error in the original thread has to do with the PCL_DEFINITIONS that are being generated when using vtk6.  Try removing ADD_DEFINITIONS(${PCL_DEFINITIONS}) from your CMakeLists.txt to confirm.  If you could, please file a bug against fedora's pcl at bugzilla.redhat.org and I'll try to follow up on it."

Comment 1 Rich Mattes 2014-03-21 22:50:36 UTC
Thanks for the report.

It looks like this has to do with how PCL is treating the VTK_DEFINITIONS provided by VTK's VTKConfig.cmake.  With the new version of VTK, the VTK_DEFINITIONS aren't required when you include VTK_USE_FILE[1].  In PCLConfig.cmake, PCL both includes every ${LIB}_USE_FILE it can find, and it gathers all of its ${LIB}_DEFINITIONS in the PCL_DEFINITIONS string.  

I think the solution is to stop including VTK_DEFINITIONS in the PCL_DEFINITIONS string in PCLConfig.cmake.  I have a patch and will build an update tonight.

[1] http://vtk.org/Wiki/VTK/Build_System_Migration

Comment 2 Fedora Update System 2014-03-22 02:15:30 UTC
pcl-1.7.1-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/pcl-1.7.1-2.fc20

Comment 3 Fedora Update System 2014-03-23 04:49:02 UTC
Package pcl-1.7.1-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pcl-1.7.1-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4258/pcl-1.7.1-2.fc20
then log in and leave karma (feedback).

Comment 4 Debra Cook 2014-03-25 14:36:16 UTC
I get the same error message when the add definitions line is in the CMakeList.txt file
I uninstalled pcl and vtk, reinstalled them (using yum) then installed the pcl update.
vtk 6.0.0.9 is in the FC repository. Is pcl looking for 6.2?

# make
Scanning dependencies of target pcd_write
[100%] Building CXX object CMakeFiles/pcd_write.dir/pcd_write.o
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/usr/bin/c++   -DDISABLE_PCAP -DDISABLE_PNG -DEIGEN_USE_NEW_STDVECTOR -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET -DvtkRenderingCore_AUTOINIT="4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)" -DvtkRenderingVolume_AUTOINIT="1(vtkRenderingVolumeOpenGL)" -I/usr/local/include/vtk-6.2 -I/usr/local/include/pcl-1.7 -I/usr/include/eigen3 -I/usr/include/ni    vtkRenderingCore_AUTOINIT=4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL) vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL) -o CMakeFiles/pcd_write.dir/pcd_write.o -c /home/testuser/pcltest2/pcd_write.cpp'
make[2]: *** [CMakeFiles/pcd_write.dir/pcd_write.o] Error 1
make[1]: *** [CMakeFiles/pcd_write.dir/all] Error 2
make: *** [all] Error 2

Comment 5 Rich Mattes 2014-03-25 15:18:15 UTC
It looks like it's also looking in /usr/local/include/pcl-1.7.  Do you have a copy of PCL installed under /usr/local?  If so, it may be overriding the Fedora version.

Comment 6 Debra Cook 2014-03-25 16:46:48 UTC
I can compile programs now.
The /usr/local was left over from a manual pcl and vtk installation attempt to try an older version earlier this month. After deleting remaining files from the local install it works.

Thanks for fixing the problem.

Comment 7 Fedora Update System 2014-04-03 04:05:55 UTC
pcl-1.7.1-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 wfehrnstrom 2016-09-22 05:15:16 UTC
Problems persist for MAC OSX PCL-1.8 manual build when linked with VTK-7.0.0 

The bug is still present, and it seems that this bug report describes my problems extremely accurately.

Comment 9 wfehrnstrom 2016-09-22 05:15:40 UTC
Problems persist for MAC OSX PCL-1.8 manual build when linked with VTK-7.0.0 

The bug is still present, and it seems that this bug report describes my problems extremely accurately.