Failed to compile OCCT7.8.0 with VTK9.3

On my laptop with arch linux OS, I want to use vtk in OCCT 7.8.0, so i download vtk with the lateset release vtk 9.3.1and compiled it, installed the files and the libs in my specific directory. In the installed lib directory, I get the vtk lib files with the suffix '-9.3.so' in the lib name, such as "libvtkCommonCore-9.3.so libvtkCommonCore-9.3.so.1 libvtkCommonCore-9.3.so.9.3". By the way, I don't know why there are 3 lib files with a little different names in the suffix. The problem is that after i configure the VTK_INCLUDE_DIR and VTK_LIB_DIR before compile OCCT 7.8.0, when i compile OCCT, the error pops out:

[ 43%] Linking CXX shared library ../../lin64/gcc/lib/libTKIVtk.so
/usr/bin/ld: cannot find -lvtkCommonCore: No such files or directories
/usr/bin/ld: cannot find  -lvtkRenderingCore: No such files or directories
/usr/bin/ld: cannot find  -lvtkRenderingOpenGL: No such files or directories
/usr/bin/ld: cannot find  -lvtkRenderingFreeType: No such files or directories
/usr/bin/ld: cannot find  -lvtkRenderingFreeTypeOpenGL: No such files or directories
/usr/bin/ld: cannot find  -lvtkFiltersGeneral: No such files or directories
/usr/bin/ld: cannot find  -lvtkInteractionStyle: No such files or directories

make[2]: *** [src/TKIVtk/CMakeFiles/TKIVtk.dir/build.make:401:lin64/gcc/lib/libTKIVtk.so.7.8.0] error 1
make[1]: *** [CMakeFiles/Makefile2:2080:src/TKIVtk/CMakeFiles/TKIVtk.dir/all] error 2
make: *** [Makefile:136:all] error 2

It seems the libs of the vtk can not be found with the suffix. i changed some libs' names to verify my thought. I changed "libvtkCommonCore-9.3.so libvtkRenderingCore-9.3.so libvtkRenderingOpenGL2-9.3.so" to "libvtkCommonCore.so libvtkRenderingCore.so libvtkRenderingOpenGL.so". The cannot-find-error of the above libraries whose names are changed disappeared. Maybe I can changed the names to compiled this time, but there are hundreds of vtk libs. What should i do to fix this problem? Any ideas? Thanks.

Dmitrii Pasukhin's picture

Hello, yes, the problem indeed in the lib names. But originally, names extracted from VTK's CMake configuration. I assume it is a bug. The best choice - try to build VTK without suffix. ".so.1.so.." is fine and it is just a flex link. At least one name should be without suffix of version.

For now, could you please create an issue in our bug-tracker? I will proceed with it according 7.9. CMake reorganization.

Best regards, Dmitrii.

Leo Liu's picture

Thanks for your reply, i finally succeed to compile the OCCT 7.8 by altering manually the cmake variable "VTK_CUSTOM_LIBRARY_SUFFIX" in the CMakeLists.txt of VTK. I did succeed to get libs' names without the suffix. However, OCCT still needs the "*OpenGL.so" libs while VTK generated "*OpenGL2.so" libs, which i failed (run out of patience) to find a cmake variable and renamed the libs manually (which looks stupid). OCCT also needs "vtkRenderingFreeTypeOpenGL" which seems didn't exist in VTK (or maybe integrated in some modules?). I solved it as such by simply removed the code which need the lib. I don't know if there would be a problem.

As for the bug-tracker you mentioned, did you mean the issue tracker on OCCT. When I register on the issue tracker, it shows that I am not authorized to access the page. I am new to OCCT, not familiar with the procedure. I don't know how to create an issue. If you can teach me, I would love to do it.