hi,
environment:Ubuntu 22.04.1 LTS(aarch64),GNU Make 4.3(aarch64-unknown-linux-gnu), gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0.
make report errors:
[ 33%] Linking CXX shared library …/…/lib/libvtkCommonSystem-7.1.so
[ 33%] Building C object ThirdParty/exodusII/vtkexodusII/CMakeFiles/vtkexoIIc.dir/expmap.c.o
[ 33%] Building C object ThirdParty/exodusII/vtkexodusII/CMakeFiles/vtkexoIIc.dir/expmp.c.o
/usr/bin/ld: CMakeFiles/vtkCommonSystem.dir/vtkClientSocket.cxx.o: in function vtkClientSocket::New()': /home/casun/tmp/VTK-7.1.1/Common/System/vtkClientSocket.cxx:19: undefined reference to vtkObjectBase::InitializeObjectBase()’
/usr/bin/ld: CMakeFiles/vtkCommonSystem.dir/vtkClientSocket.cxx.o: in function vtkClientSocket::ConnectToServer(char const*, int)': /home/casun/tmp/VTK-7.1.1/Common/System/vtkClientSocket.cxx:36: undefined reference to vtkObject::GetGlobalWarningDisplay()’
…
/usr/bin/ld: CMakeFiles/vtkCommonMath.dir/vtkRungeKutta45.cxx.o:(.data.rel.ro._ZTV15vtkRungeKutta45[_ZTV15vtkRungeKutta45]+0x98): undefined reference to vtkObject::DebugOff()' /usr/bin/ld: CMakeFiles/vtkCommonMath.dir/vtkRungeKutta45.cxx.o:(.data.rel.ro._ZTV15vtkRungeKutta45[_ZTV15vtkRungeKutta45]+0xa0): undefined reference to vtkObject::Modified()’
/usr/bin/ld: CMakeFiles/vtkCommonMath.dir/vtkRungeKutta45.cxx.o:(.data.rel.ro._ZTV15vtkRungeKutta45[_ZTV15vtkRungeKutta45]+0xa8): undefined reference to `vtkObject::GetMTime()’
[ 34%] Building C object ThirdParty/exodusII/vtkexodusII/CMakeFiles/vtkexoIIc.dir/expss.c.o
collect2: error: ld returned 1 exit status
make[2]: *** [Common/Math/CMakeFiles/vtkCommonMath.dir/build.make:242:lib/libvtkCommonMath-7.1.so.1] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2769:Common/Math/CMakeFiles/vtkCommonMath.dir/all] 错误 2
Another Ubuntu 20(aarch64),GNU Make 4.2.(aarch64-unknown-linux-gnu), gcc (Ubuntu 9.4.0-19ubuntu1) 9.4.0 is OK.
But this show problem now.
How to do it, can i get some hints or VTK-7.1.1 is not surported on Ubuntu 22.04.1 LTS
supplement: cmake -DVTK_QT_VERSION:STRING=5 -DQT_QMAKE_EXECUTABLE:PATH=/usr/lib/qt5/bin/qmake -DVTK_Group_Qt:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON …
is ok.
I’m in the same boat, I’ve got a few apps comprised of tens of thousands of lines of code that are based on VTK 7. For these legacy apps that only require VTK’s old functionalities, upgrading to a newer VTK requires a lot of work for no benefit, in fact even recompiling these apps is a rare occurrence. Rebuilds and upgrades of legacy apps occur only when necessary, because generally I’ve got better things to spend my time on.
For legacy code, I just keep old systems/toolchains around. For Linux I have an older ubuntu installed in a separate root partition, and I chroot the older root before running “make”. Docker can be used similarly. Directories can be shared between the docker/chroot and the main system. Executables compiled with old toolchains generally run fine on newer systems, particularly for VTK since nearly all of its library dependencies are built-in.
The problem originates in regex for getting the compiler version from the output of gcc --version.
In case the major compiler version has more than one digit (>= 10) the macro _vtk_test_compiler_hidden_visibility
which is defined in: VTK-7.1.1/CMake/VTKGenerateExportHeader.cmake
does not work as expected.
You can give the following patch for VTK 7.1.1 a try:
diff -ruN VTK-7.1.1.orig/CMake/VTKGenerateExportHeader.cmake VTK-7.1.1/CMake/VTKGenerateExportHeader.cmake
--- VTK-7.1.1.orig/CMake/VTKGenerateExportHeader.cmake 2024-06-18 18:29:12.865503100 +0200
+++ VTK-7.1.1/CMake/VTKGenerateExportHeader.cmake 2024-06-18 18:30:39.409137800 +0200
@@ -174,7 +174,7 @@
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE _gcc_version_info
ERROR_VARIABLE _gcc_version_info)
- string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
+ string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*"
_gcc_version "${_gcc_version_info}")
# gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
# patch level, handle this here: