wfehrnstrom
wfehrnstrom

Reputation: 329

Cmake Strange Error: Syntax Error Unexpected Token ('

I am compiling Qt5, VTK, PCL, and PDAL into a project, and my build process was working excellently until I rebuilt PCL because I was trying to get rid of another weird error where syntax errors kept popping up in Qt5 after linking PCL. For more info on that, see here: Qt, VTK, PCL, and PDAL integration I also recently agreed to a new XCode License under root. So that may also be the problem. Here is the exact error:

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/usr/bin/g++   -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -I/Users/wfehrnstrom/build-CmakeTest-MainKit-Release -I/Users/wfehrnstrom/CmakeTest -I/usr/local/include/vtk-7.0 -isystem /usr/local/include -iframework /Users/wfehrnstrom/Qt5/5.7/clang_64/lib -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtWidgets.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtGui.framework/Headers -isystem /System/Library/Frameworks/OpenGL.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtCore.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/./mkspecs/macx-clang  -ferror-limit=0 -O3 -DNDEBUG   vtkDomainsChemistry_AUTOINIT=1(vtkDomainsChemistryOpenGL2) vtkRenderingContext2D_AUTOINIT=1(vtkRenderingContextOpenGL2) vtkRenderingCore_AUTOINIT=3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL2) -fPIC -std=gnu++11 -o CMakeFiles/CmakeTest.dir/main.cpp.o -c     /Users/wfehrnstrom/CmakeTest/main.cpp'
make[2]: *** [CMakeFiles/CmakeTest.dir/main.cpp.o] Error 2
make[1]: *** [CMakeFiles/CmakeTest.dir/all] Error 2
make: *** [all] Error 2

Does anyone know why I am getting this strange error seemingly out of nowhere after rebuilding VTK and PCL? Thank you!

Upvotes: 0

Views: 2955

Answers (1)

inv3n7or
inv3n7or

Reputation: 11

Had this exact same issue when pulling PCL into QT5 on OS X.

Compiling PCL 1.8 from source resolved the issue (migrated from PCL 1.6).

CMakeLists.txt:

project(LRS_PCL)
set(CMAKE_C_COMPILER "/usr/bin/gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
cmake_minimum_required(VERSION 2.8)

set(SOURCE_DIR .)
set(SOURCE
   ${SOURCE}
   ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
   PARENT_SCOPE
)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt/5.5/gcc_64)

find_package( PCL 1.8 REQUIRED )
find_package( Qt5 REQUIRED COMPONENTS Widgets Core )

include( CheckCXXCompilerFlag )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )

include_directories( ${PCL_INCLUDE_DIRS} /user/local/include )
link_directories( ${PCL_LIBRARY_DIRS} /usr/local/lib /usr/lib/x86_64-linux-gnu )
add_definitions( ${PCL_DEFINITIONS} )

target_link_libraries( LRS_PCL ${PCL_LIBRARIES} /usr/local/lib/librealsense.so )

Upvotes: 1

Related Questions