print/acroread8: LD_LIBRARY_PATH breaks helper programs

Bengt Ahlgren bengta at sics.se
Mon Dec 8 14:15:48 PST 2008


Hi!

When testing acroread8 (on 7.1-PRE) I got the following error when
trying to print using KDE's kprinter on i386:

The following error occurred while printing...
'/libexec/ld-elf.so.1: /usr/local/Adobe/Reader8/ENU/Adobe/Reader8/Reader/intellinux/lib/libstdc++.so.6: unsupported file layout'

and on amd64:

The following error occurred while printing...
'/libexec/ld-elf.so.1: Shared object "libm.so.6" not found, required by "libstdc++.so.6"'

The reason is that the acroread launch script sets LD_LIBRARY_PATH to:

LD_LIBRARY_PATH=/usr/local/Adobe/Reader8/ENU/Adobe/Reader8/Reader/intellinux/lib:/usr/local/Adobe/Reader8/ENU/Adobe/Reader8/Reader/intellinux/sidecars:/..//usr/local/lib/linux-nvu

which makes (some) helper programs fail to link its shared libs if it
happens to pick up a (Linux) library from the above.  libstdc++.so.6
is one of them.

The problem is easily worked around for the print program - you can do
"env -u LD_LIBRARY_PATH kprinter" for instance directly in the print
dialogue.  But that does not work for the browser executable set in
the "edit/preferences/internet" dialogue.  So if you want to be able
to launch a browser from acroread, you need a wrapper script.

Question: is there a proper fix for these problems???

I see that the Linux dynamic linker
(/usr/compat/linux/lib/ld-linux.so.2) has a flag:

  --library-path PATH   use given PATH instead of content of the environment
                        variable LD_LIBRARY_PATH

so I tried to patch the acroread launch script in
/usr/local/Adobe/Reader8/ENU/Adobe/Reader8/bin with:

--- acroread.orig	2008-10-08 06:28:27.000000000 +0200
+++ acroread	2008-12-08 22:59:46.000000000 +0100
@@ -16,7 +16,9 @@
 LaunchBinary()
 {
     if [ "`uname -s`" = "Linux" ] && [ ! -x /lib/ld-lsb.so.3 ]; then
-        exec /lib/ld-linux.so.2 ${1+"$@"}
+        TEMP_LIB_PATH="$LD_LIBRARY_PATH"
+        unset LD_LIBRARY_PATH
+        exec /lib/ld-linux.so.2 --library-path "$TEMP_LIB_PATH" ${1+"$@"}
     else
         exec ${1+"$@"}
     fi

which indeed works!

Bengt


More information about the freebsd-ports mailing list