Ghostscript error while trying to read PDF file using Imagick package in Laravel

Asked by Pankaj S Y

Laravel version is 8

Below is the Laravel code->

$imgExtension = new Imagick();
$imgExtension->setResolution(300,300);
$imgExtension->readImage($file);

Below error is seen in the Apache error logs for the 3rd line ->

gs: /opt/lampp/lib/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libgs.so.9)
gs: symbol lookup error: /usr/lib/x86_64-linux-gnu/libgs.so.9: undefined symbol: FT_Property_Set

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu imagemagick Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

"/opt/lampp/lib/libtiff.so.5:"
The Ubuntu-provided version is /usr/lib/x86_64-linux-gnu/libtiff.so.5

For diagnostic purposes please provide the output that you receive for the commands

uname -a
lsb_release -crid
apt-cache policy libtiff5 libgs9 libfreetype6 ghostscript
ls -l /usr/lib/x86_64-linux-gnu/libtiff.so.5
ls -l /opt/lampp/lib/libtiff.so.5
which gs
ldd /usr/bin/gs

Revision history for this message
Pankaj S Y (pankajsy9) said :
#2

Linux fast 4.15.0-147-generic #151-Ubuntu SMP Fri Jun 18 19:21:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic

libtiff5:
  Installed: 4.0.9-5ubuntu0.4
  Candidate: 4.0.9-5ubuntu0.4
  Version table:
 *** 4.0.9-5ubuntu0.4 500
        500 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     4.0.9-5 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libgs9:
  Installed: 9.26~dfsg+0-0ubuntu0.18.04.14
  Candidate: 9.26~dfsg+0-0ubuntu0.18.04.14
  Version table:
 *** 9.26~dfsg+0-0ubuntu0.18.04.14 500
        500 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     9.22~dfsg+1-0ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libfreetype6:
  Installed: 2.8.1-2ubuntu2.1
  Candidate: 2.8.1-2ubuntu2.1
  Version table:
 *** 2.8.1-2ubuntu2.1 500
        500 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.8.1-2ubuntu2 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
ghostscript:
  Installed: 9.26~dfsg+0-0ubuntu0.18.04.14
  Candidate: 9.26~dfsg+0-0ubuntu0.18.04.14
  Version table:
 *** 9.26~dfsg+0-0ubuntu0.18.04.14 500
        500 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     9.22~dfsg+1-0ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

lrwxrwxrwx 1 root root 16 Feb 25 18:07 /usr/lib/x86_64-linux-gnu/libtiff.so.5 -> libtiff.so.5.3.0

lrwxrwxrwx 1 root root 16 Jan 29 2021 /opt/lampp/lib/libtiff.so.5 -> libtiff.so.5.0.6

which gs->
        /usr/local/sbin/gs

ldd /usr/bin/gs->
 linux-vdso.so.1 (0x00007ffc4584d000)
 libgs.so.9 => /usr/lib/x86_64-linux-gnu/libgs.so.9 (0x00007fbe9dcc4000)
 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbe9d8d3000)
 libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007fbe9d65c000)
 libcupsimage.so.2 => /usr/lib/x86_64-linux-gnu/libcupsimage.so.2 (0x00007fbe9d453000)
 libcups.so.2 => /usr/lib/x86_64-linux-gnu/libcups.so.2 (0x00007fbe9d1c7000)
 libijs-0.35.so => /usr/lib/x86_64-linux-gnu/libijs-0.35.so (0x00007fbe9cfc1000)
 libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fbe9cd8f000)
 libjbig2dec.so.0 => /usr/lib/x86_64-linux-gnu/libjbig2dec.so.0 (0x00007fbe9cb77000)
 libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fbe9c90f000)
 libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbe9c6f2000)
 liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007fbe9c49a000)
 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbe9c0fc000)
 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbe9bef8000)
 libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007fbe9bcc5000)
 libpaper.so.1 => /usr/lib/x86_64-linux-gnu/libpaper.so.1 (0x00007fbe9bac1000)
 libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fbe9b87c000)
 libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fbe9b5c8000)
 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbe9b3a9000)
 /lib64/ld-linux-x86-64.so.2 (0x00007fbe9f071000)
 liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fbe9b183000)
 libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007fbe9af75000)
 libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fbe9ad2a000)
 libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007fbe9a9c4000)
 libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007fbe9a7b8000)
 libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007fbe9a5a7000)
 libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fbe9a375000)
 libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fbe9a09f000)
 libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fbe99e6d000)
 libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fbe99c69000)
 libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fbe99a5e000)
 libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fbe9972f000)
 libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007fbe99510000)
 libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007fbe99192000)
 libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fbe98f7f000)
 libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007fbe98d49000)
 libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007fbe98b13000)
 libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fbe98892000)
 libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fbe98645000)
 libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fbe98441000)
 libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fbe98227000)
 libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fbe9801f000)
 libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fbe97d9b000)
 librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbe97b93000)
 liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fbe97977000)
 libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fbe9765b000)
 libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fbe97446000)

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

You are also using a foreign version of gs (ghostscript)

What is the output of the commands

ls -l /usr/bin/gs
ls -l /usr/local/sbin/gs
ldd /usr/local/sbin/gs

Revision history for this message
Pankaj S Y (pankajsy9) said :
#4

-rwxr-xr-x 1 root root 10232 Jan 6 2021 /usr/bin/gs

lrwxrwxrwx 1 root root 11 Aug 3 20:09 /usr/local/sbin/gs -> /usr/bin/gs

 linux-vdso.so.1 (0x00007fff52572000)
 libgs.so.9 => /usr/lib/x86_64-linux-gnu/libgs.so.9 (0x00007f3650329000)
 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f364ff38000)
 libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f364fcc1000)
 libcupsimage.so.2 => /usr/lib/x86_64-linux-gnu/libcupsimage.so.2 (0x00007f364fab8000)
 libcups.so.2 => /usr/lib/x86_64-linux-gnu/libcups.so.2 (0x00007f364f82c000)
 libijs-0.35.so => /usr/lib/x86_64-linux-gnu/libijs-0.35.so (0x00007f364f626000)
 libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f364f3f4000)
 libjbig2dec.so.0 => /usr/lib/x86_64-linux-gnu/libjbig2dec.so.0 (0x00007f364f1dc000)
 libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f364ef74000)
 libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f364ed57000)
 liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f364eaff000)
 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f364e761000)
 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f364e55d000)
 libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007f364e32a000)
 libpaper.so.1 => /usr/lib/x86_64-linux-gnu/libpaper.so.1 (0x00007f364e126000)
 libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f364dee1000)
 libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f364dc2d000)
 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f364da0e000)
 /lib64/ld-linux-x86-64.so.2 (0x00007f36516d6000)
 liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f364d7e8000)
 libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f364d5da000)
 libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f364d38f000)
 libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f364d029000)
 libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007f364ce1d000)
 libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007f364cc0c000)
 libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f364c9da000)
 libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f364c704000)
 libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f364c4d2000)
 libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f364c2ce000)
 libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f364c0c3000)
 libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f364bd94000)
 libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f364bb75000)
 libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f364b7f7000)
 libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f364b5e4000)
 libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f364b3ae000)
 libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f364b178000)
 libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f364aef7000)
 libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f364acaa000)
 libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f364aaa6000)
 libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f364a88c000)
 libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f364a684000)
 libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f364a400000)
 librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f364a1f8000)
 liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f3649fdc000)
 libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f3649cc0000)
 libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f3649aab000)

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

This is now a bit unexpected. In the output of the commands, there is no reference to the files that are listed in the error messages in your original question.

In any case, the cause seems to be duplicate libraries in different versions in different directories.
Looking at the output
lrwxrwxrwx 1 root root 16 Feb 25 18:07 /usr/lib/x86_64-linux-gnu/libtiff.so.5 -> libtiff.so.5.3.0
lrwxrwxrwx 1 root root 16 Jan 29 2021 /opt/lampp/lib/libtiff.so.5 -> libtiff.so.5.0.6
you should consider removing library files that are in /opt/lampp/lib in a lower version than in /usr/lib/x86_64-linux-gnu

Revision history for this message
Pankaj S Y (pankajsy9) said :
#6

I think the XAMPP server is taking the files from /opt/lampp folder.

How to remove the the library files from /opt/lampp ?

Revision history for this message
Pankaj S Y (pankajsy9) said :
#7

If I directly remove from "rm" command then will it work ?

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

I do not know how the files were installed in the /opt/lampp directory, but I guess that simply removing them should work.

Can you help with this problem?

Provide an answer of your own, or ask Pankaj S Y for more information if necessary.

To post a message you must log in.