## Problem Description ##
Qpdfview executes, but if given a pdf on the command-line (or a pdf subsequently opened by the File->Open dialogue), qpdfview complains, posting the alert box: "Critical: Could not load plug-in for file type 'PDF'!"
## Platform ##
Linux version 4.20.2-hp Ubuntu 16.04.11 Mon Mar 04 09:11:05 MST 2019
HP ThinPro 7X71018 2GB Image GNU/Linux x86_64 7.0.0 build 15
## Related Bug ###
https://answers.launchpad.net/qpdfview/+question/669568
## Steps to Reproduce ##
1. Install qpdfview for Xenial from packages.ubuntu.com. Repository delivers qpdfview 0.4.14-1
2. copy installation files to a USB stick (target platforms must run apps from USB without installing them otherwise HP Support eligibility is invalidated)
3. Install USB stick on target, set documented environment variables and attempt to execute qpdfview passing a sound pdf on the command-line:
```shell
LD_DEBUG=files \
LD_LIBRARY_PATH=/media/GenericFlash_sdb1/usr/lib/qpdfview:/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu \
QT_PLUGIN_PATH=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins \
/media/GenericFlash_sdb1/usr/bin/qpdfview example.pdf
...
3214: calling init: /lib/x86_64-linux-gnu/libbsd.so.0
3214: calling init: /lib/x86_64-linux-gnu/libtinfo.so.5
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libedit.so.2
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libLLVM-6.0.so.1
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libelf.so.1
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2
3214: calling init: /media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libsensors.so.4
3214: calling init: /usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so
3214: opening file=/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so [0]; direct_opencount=1
3214: closing file=/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1; direct_opencount=0
Could not load plug-in in first attempt: ""
"The shared library was not found."
Could not load plug-in in second attempt: ""
"The shared library was not found."
...
```
As the wind-down continues it's clear that while the plugins were found qpdfview's pdf libraries were not:
```shell
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqdds.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqgif.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqicns.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqico.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqjp2.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libjasper.so.1 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqjpeg.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqmng.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libmng.so.2 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/liblcms2.so.2 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqsvg.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqtga.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqtiff.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libtiff.so.5 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libjpeg.so.8 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libjbig.so.0 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqwbmp.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqwebp.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libwebp.so.5 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlite.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libsqlite3.so.0 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/iconengines/libqsvgicon.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libQt5Svg.so.5 [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/styles/libqt5ct-style.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/xcbglintegrations/libqxcb-glx-integration.so [0]; destroying link map
9703: file=/tmp/tmpfs/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libXi.so.6 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libSM.so.6 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libICE.so.6 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-render.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-image.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-icccm.so.4 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-randr.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-keysyms.so.1 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libfontconfig.so.1 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 [0]; destroying link map
9703: file=/lib/x86_64-linux-gnu/libuuid.so.1 [0]; destroying link map
9703: file=/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/libxcb-util.so.1 [0]; destroying link map
```
Qpdfview's included libraries were included in the LD_LIBRARY_PATH but not referred-to in ld.so's output.
```shell
$ ls -l /media/GenericFlash_sdb1/usr/lib/qpdfview
total 328
-rw-r--r-- 1 root bin 76848 May 17 2015 libqpdfview_djvu.so
-rw-r--r-- 1 root bin 192784 May 17 2015 libqpdfview_pdf.so
-rw-r--r-- 1 root bin 60136 May 17 2015 libqpdfview_ps.so
```
## Attempts Made to Resolve ##
1. Checked man page for mention of any environment variables to set when running qpdfview from a non-standard directory.
2. Inspected qpdfview's user configuration file ~/.config/qpdfview/qpdfview.conf for any mention of hard-coded directories
Assistance in running the available binary for Ubuntu 16.04 from other than the installation directory would gratefully be appreciated.
Hello mj162,
LD_LIBRARY_PATH has no effect as the plug-ins are loaded directly instead of by the system loader (which is why you need to set QT_PLUGIN_PATH instead of LD_LIBRARY_PATH for Qt's plug-ins).
I see various options to resolve this:
1. I modify the plug-in handler to check an environment variable like QPDFVIEW_ PLUGIN_ PATH during runtime in parallel to QT_PLUGIN_PATH. I did decide to against that in the past to reduce complexity as it isn't strictly necessary for a "portable" installation.
2. You can move the plug-ins into the same folder as the binary itself (since you are copying around the files anyway), as qpdfview will look for the plug-ins right next to the binary first.
3. You can use a build of qpdfview that statically includes the plugins which would give you a single binary.
In your case for an existing system, just moving the plug-in files as 2 is probably the easiest solution. However, since 0.4.14 is also quite old, you might want to consider building the current version from source using static plug-ins as in 3.
Best regards,
Adam