在带有 Bitnami WordPress 堆栈的 Azure 上的 Ubuntu 18.04.4 LTS 上,我试图让 Imagemagick 和 Ghostscript 正常工作,以便 WordPress 将创建 PDF 缩略图。一个简单的转换测试会出错。当我搜索错误消息时,它们让我越来越深入地了解有关缺少库、手动添加符号链接、从源代码编译等的各种兔子洞。运行流行的图像转换程序似乎并不难。我错过了什么?
以下是版本和失败的测试:
/tmp$ sudo apt update
All packages are up to date.
/tmp$ sudo apt install imagemagick
imagemagick is already the newest version (8:6.9.7.4+dfsg-16ubuntu6.8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/tmp$ sudo apt install ghostscript
ghostscript is already the newest version (9.26~dfsg+0-0ubuntu0.18.04.12).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/tmp$ which convert
/opt/bitnami/common/bin/convert
/tmp$ convert -version
Version: ImageMagick 6.9.8-3 Q16 x86_64 2019-04-03 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl png tiff wmf xml zlib
/tmp$ which ghostscript
/usr/bin/ghostscript
/tmp$ gs -version
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
/tmp$ convert -verbose resume.pdf resume.jpg
'gs' -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' '-sOutputFile=/tmp/magick-38144ceME6-csnc4X%d' '-f/tmp/magick-38144tpfIz6n76qfI' '-f/tmp/magick-38144AH22zQfdNQqs'
gs: /opt/bitnami/common/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
.convert.bin: no images defined `resume.jpg' @ error/convert.c/ConvertImageCommand/3258.
编辑按照评论中的要求:
~$ echo $LD_LIBARY_PATH
~$ ldd $(which conver)
ldd: missing file arguments
Try `ldd --help' for more information.
~$ ldd $(which convert)
not a dynamic executable
~$ ldd /usr/bin/ghostscript
linux-vdso.so.1 (0x00007fffc5be3000)
libgs.so.9 => /usr/lib/x86_64-linux-gnu/libgs.so.9 (0x00007f3614e95000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3614aa4000)
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f361482d000)
libcupsimage.so.2 => /usr/lib/x86_64-linux-gnu/libcupsimage.so.2 (0x00007f3614624000)
libcups.so.2 => /usr/lib/x86_64-linux-gnu/libcups.so.2 (0x00007f3614398000)
libijs-0.35.so => /usr/lib/x86_64-linux-gnu/libijs-0.35.so (0x00007f3614192000)
libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f3613f60000)
libjbig2dec.so.0 => /usr/lib/x86_64-linux-gnu/libjbig2dec.so.0 (0x00007f3613d48000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f3613ae0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f36138c3000)
liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f361366b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f36132cd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f36130c9000)
libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007f3612e96000)
libpaper.so.1 => /usr/lib/x86_64-linux-gnu/libpaper.so.1 (0x00007f3612c92000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f3612a4d000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f3612799000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f361257a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3616241000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f3612354000)
libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f3612146000)
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f3611efb000)
libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f3611b95000)
libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007f3611989000)
libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007f3611778000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f3611546000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f3611270000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f361103e000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f3610e3a000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f3610c2f000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f3610900000)
libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f36106e3000)
libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f3610365000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f3610152000)
libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f360ff1c000)
libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f360fce8000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f360fa67000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f360f81a000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f360f616000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f360f3fb000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f360f1f3000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f360ef6f000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f360ed67000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f360eb4b000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f360e82f000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f360e61a000)
在Bitnami论坛上发布这个问题后,我收到了卸载Ghostscript 9.26并将9.27二进制文件直接从Github上传到服务器路径的建议。令我惊讶的是,这立即允许 Imagemagick 工作。WordPress 中的 PDF 缩略图生成也可以正常工作。
根据这篇文章,以下是我用来卸载 Ghostscript 并从 Github 获取 9.27 二进制文件的命令: