'-Wl,-rpath' not executed when building version 8.2.0


I downloaded version 8.2.0 of VTK from the website and CMaked it with default settings (the only flag being CMAKE_INSTALL_PREFIX; CMake version 3.10.2 on Ubuntu 18.04.3 LTS). Now, running e.g.:

ldd -r ${HOME}/VTK/8.2.0/install/lib/libvtkRenderingOpenGL2-8.2.so

yields many undefined symbols: indeed it cannot find the VTK libraries it depends on, what suggests -Wl,-rpath was not included when building them.

However, if I build an executable (the only flag being VTK_DIR), -Wl,-rpath is included by default and adds to the binary the VTK libraries it immediately depends on, but these have their dependencies themselves and they remain undefined. A minimum CMakeLists.txt is used to build the executable:

cmake_minimum_required(VERSION 2.8.7)
find_package(VTK REQUIRED)
set(SOURCES example.cpp)
add_executable(example ${SOURCES})
target_link_libraries(example ${VTK_LIBRARIES})

Is this a desired behaviour in VTK installation? Is there a way to install it with cross-knowledge between its libraries’ locations?

Thank you very much,

This has been fixed on master and will be part of 9.0.

Note that RPATH entries may be different between the build and install trees, but there are CMake settings to control them at the distributor level (it’s not something the VTK source tree can dictate because things differ between various ways of distributing VTK). The RPATH-containing variables in this list would be the place to start.

Thanks Ben. Do you know which version of ParaView / Catalyst will inherit this change?

ParaView 5.7 should have the RPATH fix, but I can’t remember exactly if all the RPATH stuff was in by then. If not, 5.8 (due out within a month; rc1 is Friday) will have it.

1 Like

When I build and install VTK 8.2.0 into a non-standard location, I pass -DCMAKE_INSTALL_RPATH=<install prefix>/lib to CMake.

1 Like

I built ParaView 5.7.0 from source (the only flag being CMAKE_INSTALL_PREFIX) and confirm the VTK libraries know where their fellow dependees are.