Hi, I am trying to compile the source code of VTK6.3 version from GITHUB on Ubuntu 22.04 LTS using gcc +14.04 version of the compiler in the machine, but I used get the following error message :
CMake Error at CMake/vtkCompilerExtras.cmake:47 (if):
if given arguments:
"cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 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"
Unknown arguments specified
Call Stack (most recent call first):
CMakeLists.txt:283 (include)
I need this version of VTK to support and compile other source code of TexGen … Could you please let me know the way to succeed the compilation and its installation on Ubuntu 22.04 LTS workstation. Thanks in advance
To get VTK 6.3 to compile with a modern compiler like gcc 11.4 and a modern version of cmake, you’ll have to examine (and fix) the code whenever errors occur during the build.
For the error you reported, CMake/vtkCompilerExtras.cmake needs the following fix at line 35:
- string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]*"
+ string (REGEX MATCH "[0-9]+\\.[0-9]\\.[0-9]*"
_gcc_version "${_gcc_version_info}")
After this, there will probably be other errors in other parts of the code. VTK 6.3 is nearly 10 years old, back then it would have compiled with gcc 4.8 or maybe gcc 5.3.
In the comment above, are you saying that you have installed an old compiler on your system? When I first read it, I thought it was a typo since there is no “gcc 14”. But if you mean that you’ve installed a compiler from Ubuntu 14.04 (which would be gcc 4.8?), then that might work if you set the cmake variables so that the VTK build uses that compiler instead of using the system’s default compiler.
I encountered the mentioned problem while compiling the VTK 6.3 source code from GitHub. Unfortunately, I do not have the option to use a higher version of VTK, such as 9 or 8, because other source codes, like TexGen, currently support only VTK 6.3 or earlier versions.
Is there any method to compile and install the suggested version of VTK (6.3) successfully?
Thanks in advance
I think you must have made a mistake doing the fix that I suggested. My suggestion was to replace the [345] in that file with [0-9]+ and then try building again. Is that what you did?
CMake Error at CMake/GenerateExportHeader.cmake:178 (if):
if given arguments:
"cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 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_LESS" "4.2"
Unknown arguments specified
Call Stack (most recent call first):
CMake/GenerateExportHeader.cmake:354 (_test_compiler_hidden_visibility)
CMake/vtkModuleMacros.cmake:702 (generate_export_header)
Common/Core/CMakeLists.txt:646 (vtk_module_library)
This error was received after replace this line string (REGEX MATCH “[345]\.[0-9]\.[0-9]" with this line string (REGEX MATCH "[0-9]\.[0-9]\.[0-9]”. Thanks
Do I need to put the plus symbol before the string. I made those correction based on the attached image?
Based on the suggested modification as shown in the image, I still get the above mentioned error while doing compilation .
Thanks
Hi, Many thanks that work for me after modifying those two cmake files using the suggested line in it but while building the same source code VTK6.3 using Make -j$(40), I received another error attached here for the reference
That might be an error related to the c++11 standard. Try compiling with the c++98 standard instead, by setting the CMAKE_CXX_FLAGS in your CMakeCache.txt:
May I know where to find this file " CMakeCache.txt: "to modify the suggsted line.
To make the suggested modification in the named file is missing in the CMAKE folder of VTK6.3
Hi, I just found that file “CMakeCache.txt” from the build directory folder, where I have seen the CMake_CXX_FLAGS:STRING as empy without any details and attached same for the reference. All this compilation was done Cmake via terminal command . Do I need specify those details at those suggsted location and rerun the make -j$(no process) command again ?
Did you read the error and do you understand what it means?
It’s a permission error. So you either need to run a final “make install” as root, or you have to edit your cmake cache again to change the install prefix to a different directory (e.g. your home directory) where you have permissions.