Building fails generating wrap hierarchy for VTK::CommonCore unable to open libvtkWrappingTools.so.1

When building VTK 9.0.0 on openSUSE Leap systems, I encounter the following issue

[  172s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] [  2%] Building C object Wrapping/Tools/CMakeFiles/WrapHierarchy.dir/vtkWrapHierarchy.c.o
[  172s] cd /home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Wrapping/Tools && /usr/bin/gcc -DVTK_IN_VTK -I/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Wrapping/Tools -I/home/abuc
[  172s] [  2%] Linking C executable ../../bin/vtkWrapHierarchy
[  172s] cd /home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Wrapping/Tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/WrapHierarchy.dir/link.txt --verbose=1
[  172s] /usr/bin/gcc -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-c 
[  172s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] [  2%] Built target WrapHierarchy
[  172s] /usr/bin/make -f Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/build.make Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/depend
[  172s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] cd /home/abuild/rpmbuild/BUILD/VTK-9.0.0/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/abuild/rpmbuild/BUILD/VTK-9.0.0 /home/abuild/rpmbuild/BUILe
[  172s] Dependee "/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/DependInfo.cmake" is newer than depender "/home/abuild/rpm.
[  172s] Dependee "/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Common/Core/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/abuild/rpmbuild/BUILD/V.
[  172s] Scanning dependencies of target vtkCommonCore-hierarchy
[  172s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] /usr/bin/make -f Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/build.make Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/build
[  172s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] [  2%] Generating the wrap hierarchy for VTK::CommonCore
[  172s] cd /home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Common/Core && ../../bin/vtkWrapHierarchy @/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build/Common/Core/CMakeFiles/vtkComs
[  172s] ../../bin/vtkWrapHierarchy: error while loading shared libraries: libvtkWrappingTools.so.1: cannot open shared object file: No such file or directory
[  172s] make[2]: *** [Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/build.make:280: lib64/vtk/hierarchy/VTK/vtkCommonCore-hierarchy.txt] Error 127
[  172s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] make[1]: *** [CMakeFiles/Makefile2:9550: Common/Core/CMakeFiles/vtkCommonCore-hierarchy.dir/all] Error 2
[  172s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/VTK-9.0.0/build'
[  172s] make: *** [Makefile:161: all] Error 2

The build stops there. Full log (335.9 KB).

The odd thing is that, builds go fine on openSUSE Tumbleweed which has more recent system libraries. This leads me to believe that some library might be too old on the Leap systems where builds fail, but is not flagged as such by the cmake script. On the other hand, the shared lib in question libvtkWrappingTools.so does build even on systems where builds end up failing, so my hunch may be off target.

Thanks in advance for any help.

The problem is that you told VTK to build without any rpaths whatsoever:

-DCMAKE_SKIP_RPATH:BOOL=ON

What you really want is CMAKE_SKIP_INSTALL_RPATH instead. This allows the build tree to work while stripping the rpaths from the install tree.

1 Like

Yes, that does the trick, thanks!

I missed that because we use some distro-wide rpm macros for building with cmake and the %cmake macro explicitly does this for the Leaps (i.e. %suse_version <= 1500) (and not for Tumbleweed):

...
%if %suse_version <= 1500 \
        -DCMAKE_SKIP_RPATH:BOOL=ON \\\
%endif
... 

Ouch :man_facepalming:

Thanks a lot for your quick help.