Broken pvpython: Some projects do not add an appropriate runpath to built libraries
I'm not sure the title is accurate, except in that pvpython
is broken in this particular build. I tried to be complete in my description of what went wrong, provided some description of my investigation of the issue, as well as providing steps to reproduce it. But please post a comment if more information is needed.
Summary of Issue
Using the newly added Ubuntu Dockerfile for building ParaView (pv master, sb master), the resulting pvpython
fails with:
pv-user@73d2bdc9d36f:/opt/paraview$ /opt/paraview/bin/pvpython
/opt/paraview/bin/pvpython: error while loading shared libraries: libsz.so.2: cannot open shared object file: No such file or directory
Some Details
It seems that "missing" library is actually in the installed lib
directory:
pv-user@73d2bdc9d36f:/opt/paraview$ find lib | grep -i libsz
lib/libsz.so.2.0.0
lib/libsz.so
lib/libsz.so.2
But whichever library needs it was maybe not build with the necessary runpath (something like $origin/../lib/...
), as indicated in the excerpted output from ldd
below:
pv-user@73d2bdc9d36f:/opt/paraview$ LD_DEBUG=libs ldd /opt/paraview/bin/pvpython
...
22:
22: find library=libsz.so.2 [0]; searching
22: search path=/usr/lib/x86_64-linux-gnu (system search path)
22: trying file=/usr/lib/x86_64-linux-gnu/libsz.so.2
22: search path=/usr/lib/i386-linux-gnu (LD_LIBRARY_PATH)
22: trying file=/usr/lib/i386-linux-gnu/libsz.so.2
22: search cache=/etc/ld.so.cache
22: search path=/lib/x86_64-linux-gnu/tls/haswell/x86_64:/lib/x86_64-linux-gnu/tls/haswell:/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/haswell/x86_64:/lib/x86_64-linux-gnu/haswell:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib/tls/haswell/x86_64:/lib/tls/haswell:/lib/tls/x86_64:/lib/tls:/lib/haswell/x86_64:/lib/haswell:/lib/x86_64:/lib:/usr/lib/tls/haswell/x86_64:/usr/lib/tls/haswell:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/haswell/x86_64:/usr/lib/haswell:/usr/lib/x86_64:/usr/lib (system search path)
22: trying file=/lib/x86_64-linux-gnu/tls/haswell/x86_64/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/tls/haswell/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/tls/x86_64/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/tls/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/haswell/x86_64/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/haswell/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/x86_64/libsz.so.2
22: trying file=/lib/x86_64-linux-gnu/libsz.so.2
22: trying file=/usr/lib/x86_64-linux-gnu/libsz.so.2
22: trying file=/lib/tls/haswell/x86_64/libsz.so.2
22: trying file=/lib/tls/haswell/libsz.so.2
22: trying file=/lib/tls/x86_64/libsz.so.2
22: trying file=/lib/tls/libsz.so.2
22: trying file=/lib/haswell/x86_64/libsz.so.2
22: trying file=/lib/haswell/libsz.so.2
22: trying file=/lib/x86_64/libsz.so.2
22: trying file=/lib/libsz.so.2
22: trying file=/usr/lib/tls/haswell/x86_64/libsz.so.2
22: trying file=/usr/lib/tls/haswell/libsz.so.2
22: trying file=/usr/lib/tls/x86_64/libsz.so.2
22: trying file=/usr/lib/tls/libsz.so.2
22: trying file=/usr/lib/haswell/x86_64/libsz.so.2
22: trying file=/usr/lib/haswell/libsz.so.2
22: trying file=/usr/lib/x86_64/libsz.so.2
22: trying file=/usr/lib/libsz.so.2
22:
...
libsz.so.2 => not found
...
libboost_thread.so.1.59.0 => not found
...
As shown above, libboost_thread.so.1.59
was also shown by ldd
to be not found
.
Trying to discover all the libraries that may be not found within this build turned up the following (I cut the duplicates from the output manually):
v-user@d98443452f88:/opt/paraview/lib$ ls | grep -e "\\.so$" | xargs ldd | grep -i "not found"
libtbb.so.2 => not found
libavutil.so.52 => not found
libavcodec.so.55 => not found
libboost_system.so.1.59.0 => not found
libsz.so.2 => not found
libhdf5.so.103 => not found
libblas.so => not found
libboost_thread.so.1.59.0 => not found
Steps to reproduce
Following are some steps to reproduce the issue, using the Dockerfile in this repo.
Build the image
The Dockerfile allows us to specify, among other things, the versions of the superbuild and paraview we want to build. In this case, I built with the master
version of both. I also used the nvidia-docker2
Ubuntu package on my host machine to build/test ParaView with EGL
, but the command line below avoids the need for any nvidia docker stuff if your machine doesn't have it. Here's how you can build an image yourself after updating your superbuild source tree:
cd <pv-sb-src>/Scripts/docker/ubuntu
docker build --rm \
--build-arg ubuntu:18.04 \
--build-arg RENDERING=osmesa \
--build-arg PARAVIEW_TAG=master \
--build-arg SUPERBUILD_TAG=master \
-t pv-master-osmesa-test .
For myself, I like to redirect all the resulting stdout/stderr to a file for record keeping, I just left it out of the command line above for simplicity.
Run the image
Once the image is built as shown above, you can run it and poke around to investigate the library issues as follows:
docker run --rm -ti pv-master-osmesa-test