Qpdfview 0.4.14-1 unable to find shared libraries in non-standard location pointed-to by LD_LIBRARY_PATH on Ubuntu 16.04

Bug #1879168 reported by mj162
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qpdfview
Invalid
Undecided
Unassigned

Bug Description

## 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.

Revision history for this message
Adam Reichold (adamreichold) wrote :

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

Changed in qpdfview:
status: New → Incomplete
Revision history for this message
mj162 (mj162) wrote :

Adam, many thanks for an amazingly fast and helpful response.

Unfortunately building is not an option. The thin clients are
essentially appliances into which a USB stick of pre-packed apps are
inserted into. (They're probably unsuitable for development, anyway).

Thanks. I tried various settings of QPDFVIEW_PLUGIN_PATH without
success -- perhaps the version Canonical have in their repository
for V16.04 is just too old to support it.

As you say, since I am copying things about, moving the plugins is not
an issue. I just need to leave notes so that when there is a new
version, the procedure to modify where the components of the package are
deployed-to is followed.

When you say move the plugins to the directory the binary is in, I have
a question if I may please.

The plugins are in:

/media/GenericFlash_sdb1/usr/lib/x86_64-linux-gnu/qt5/plugins

But there are many plugins in subdirectories under there that will be
in-use by other packages.

Do I take that you were referring strictly to the sqldrivers plugins,
and that it is these that I should move/copy to the directory of the
binary? (and, if so, place the contents of sqldrivers in the same
directory as the binary, or place the sqldrivers directory within the
same directory containing the binary?)

Or have I misunderstood and that the solution you are proposing is to
move/copy the contents of qpdfview supplied libraries, for me, currently
in:

/media/GenericFlash_sdb1/usr/lib/qpldfview

Into the same directory as the binary?

Sorry for coming back at you, having tried the env variables, I just
wanted to make sure I understood the moving files solution correctly.

Thank you and stay safe.

Kind regards.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

with "plug-ins", I meant the libraries from /usr/lib/qpdfview like libqpdfview_pdf.so, not the Qt plug-ins. You just need to move those from /usr/lib/qpdfview to /usr/bin on your flash drive.

Best regards,
Adam

Revision history for this message
mj162 (mj162) wrote :

Thank you for your prompt reply.

I had in fact set `QT_PLUGIN_PATH` btw.

Regardless, I now have a working qpdfview 0.4.14-1, the latest version supported by HP's latest (2020) ThinPro 7.1 OS still based on Ubuntu 16.04 LTS.

### Resolution
The solution was to soft-link qpdfview's libraries to the same directory as the qpdfview binary:

```shell
# cd /media/GenericFlash_sdb1/usr/bin

# ls -l qpdfview
-rwxr-xr-x 1 root bin 1000128 May 17 2015 qpdfview

# ls -l ../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

# ln -s ../lib/qpdfview/libqpdfview_djvu.so libqpdfview_djvu.so
# ln -s ../lib/qpdfview/libqpdfview_pdf.so libqpdfview_pdf.so
# ln -s ../lib/qpdfview/libqpdfview_ps.so libqpdfview_ps.so
```

### Epilogue
Qpdfview was not the only PDF viewer that did not survive moving to USB stick. HP bundles the lightweight Zathura but is no minimalistic as to be only useful in-browser. Research was made of standalone PDF readers on https://alternativeto.net/?platform=linux applicable to the latest supported version of HP's Thin Client operating system.

#### Results
1. Atril (MATE Document Viewer 1.12.2) complains that it can't find backends. Not yet reported to developer so not currently known whether a fix or workaround will be made available.

2. Evince (GNOME Document). Will not run from non-installation directory and developers will not fix or provide a work-around (https://gitlab.gnome.org/GNOME/evince/-/issues/1412).

3. Foxit Reader 2.4.4.0911 (2017) Free version of commercial product. Modern, high-quality, interface runs straightforwardly.

4. MuPDF 0.9 (2011) Minimalistic. Runs straightforwardly.

5. PDF Studio Viewer 2019.2.2 (2019) Free version of commercial product. Runs straightforwardly (Java-based). Modern, high-quality (so impressed, have bought top-end 'Pro' product).

6. Qpdfview 0.4.14, Modern tabbed viewer with annotation capabilities. Will run if its supplied libraries are linked to execution directory.

Revision history for this message
mj162 (mj162) wrote :
Revision history for this message
mj162 (mj162) wrote :

Kindly moved to CLOSED -- WORKAROUND PROVIDED.

Thank you.

Changed in qpdfview:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.