Hello all I am trying to downgrade my version of VTK from 6.3.0 to 5.10.1 so that I can use some python utilities (namely pyFoam) however when I try to compile the VTK5.10.1 I get the following error:
CMake Error at CMake/vtkCompilerExtras.cmake:40 (if):
if given arguments:
"cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software" " see the source for copying conditions. There is
NO
warranty" " not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE." “VERSION_GREATER” “4.2.0” “AND” “BUILD_SHARED_LIBS” “AND”
“HAVE_GCC_VISIBILITY” “AND” “VTK_USE_GCC_VISIBILITY” “AND” “NOT” “MINGW”
“AND” “NOT” “CYGWIN”
Older VTK versions detected the compiler version manually. There is a regex in CMake/vtkCompilerExtras.cmake that will need expanded to detect the compiler version.
Thanks for your reply Ben I have been able to locate the
CMake/vtkCompilerExtras.cmake
file, and I have Identified the REGEX.
# Now check if we can use visibility to selectively export symbols
exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE
_gcc_version_info)
string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]"
_gcc_version "${_gcc_version_info}")
if(NOT _gcc_version)
string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0"
_gcc_version "${_gcc_version_info}")
endif()
# GCC visibility support, on by default and in testing.
check_cxx_compiler_flag(-fvisibility=hidden HAVE_GCC_VISIBILITY)
option(VTK_USE_GCC_VISIBILITY "Use GCC visibility support if available." ON)
mark_as_advanced(VTK_USE_GCC_VISIBILITY)
if(${_gcc_version} VERSION_GREATER 4.2.0 AND BUILD_SHARED_LIBS
AND HAVE_GCC_VISIBILITY AND VTK_USE_GCC_VISIBILITY
AND NOT MINGW AND NOT CYGWIN)
# Should only be set if GCC is newer than 4.2.0
set(VTK_ABI_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
else()
set(VTK_ABI_CXX_FLAGS "")
endif()
Would you be so kind as to explicitly inform me how I would expand it to detect the compiler version my compiler version is GCC 7.5.0 btw
There may be many such errors when compiling such old code with new compilers. Trying to use c++03 is likely to be the easiest path to getting a build. The next best would be using a gcc 4.x if that would work.