[英]Compiling ImageMagick: Cannot Find 'libwebp', compiled From Source on Amazon Linux 2
我正在嘗試重新編譯 ImageMagick 以啟用對 PHP 的 webp 支持。
問題似乎是,在使用./configure --with-webp=yes
編譯 Imagick 時,它找不到版本高於0.4.1
的 libwebp 庫。 亞馬遜 Linux 2 的回購只有 go 到版本0.3.1
。 這意味着從源代碼編譯 libwebp,這有效,但 Imagick 似乎無法識別它。
所以我的問題是,如何確保 ImageMagick 可以找到並使用 libwebp 庫?
為了從源代碼編譯,我做了以下工作:
cd /var
sudo wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz
sudo tar xvzf libwebp-1.1.0.tar.gz
cd libwebp-1.1.0
sudo ./configure
sudo make && sudo make install
/sbin/ldconfig -p | grep webp
/sbin/ldconfig -p | grep webp
顯示以下 output 這表明 libwebp 庫按預期存在於/usr/local/lib
目錄中並在 ld 配置中注冊。
libwebpdemux.so.2 (libc6,x86-64) => /usr/local/lib/libwebpdemux.so.2
libwebpdemux.so (libc6,x86-64) => /usr/local/lib/libwebpdemux.so
libwebp.so.7 (libc6,x86-64) => /usr/local/lib/libwebp.so.7
libwebp.so (libc6,x86-64) => /usr/local/lib/libwebp.so
然后我嘗試通過執行以下操作從源代碼編譯 Imagick:
cd /var
sudo wget https://imagemagick.org/download/ImageMagick.tar.gz
sudo tar xvzf ImageMagick.tar.gz
cd ImageMagick-7.1.0-7
sudo ./configure --with-webp=yes
sudo make && sudo make install
sudo ldconfig /usr/local/lib
但是,在運行./configure --with-webp=yes
時,我得到以下 output
...
-------------------------------------------------------------
checking for libwebp >= 0.4.1... no
checking for libwebpmux >= 0.5.0 libwebpdemux >= 0.5.0... no
checking if WMF package is complete... no
-------------------------------------------------------------
...
configure:
==============================================================================
ImageMagick 7.1.0-7 is configured as follows. Please verify that this
configuration matches your expectations.
Host system type: x86_64-pc-linux-gnu
Build system type: x86_64-pc-linux-gnu
Option Value
------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
Static libraries --enable-static=yes yes
Build utilities --with-utilities=yes yes
Module support --with-modules=no no
GNU ld --with-gnu-ld=yes yes
Quantum depth --with-quantum-depth=16 16
High Dynamic Range Imagery
--enable-hdri=yes yes
Install documentation: yes
Memory allocation library:
JEMalloc --with-jemalloc=no no
TCMalloc --with-tcmalloc=no no
UMem --with-umem=no no
Delegate library configuration:
BZLIB --with-bzlib=yes no
Autotrace --with-autotrace=no no
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=no no
FLIF --with-flif=yes no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes no
FreeType --with-freetype=yes no
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=yes no
HEIC --with-heic=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes yes
JPEG XL --with-jxl=no no
LCMS --with-lcms=yes no
LQR --with-lqr=yes no
LTDL --with-ltdl=no no
LZMA --with-lzma=yes no
Magick++ --with-magick-plus-plus=yes no (failed tests)
OpenEXR --with-openexr=yes no
OpenJP2 --with-openjp2=yes no
PANGO --with-pango=yes no
PERL --with-perl=no no
PNG --with-png=yes yes
RAQM --with-raqm=yes no
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes no
WMF --with-wmf=no no
X11 --with-x= no
XML --with-xml=yes no
ZIP --with-zip=yes no
ZLIB --with-zlib=yes yes
ZSTD --with-zstd=yes no
Delegate program configuration:
GhostPCL None pcl6 (unknown)
GhostXPS None gxps (unknown)
Ghostscript None gs (9.25)
Font configuration:
Apple fonts --with-apple-font-dir=default
Dejavu fonts --with-dejavu-font-dir=default none
Ghostscript fonts --with-gs-font-dir=default /share/ghostscript/fonts/
URW-base35 fonts --with-urw-base35-font-dir=default none
Windows fonts --with-windows-font-dir=default none
X11 configuration:
X_CFLAGS =
X_PRE_LIBS =
X_LIBS =
X_EXTRA_LIBS =
Options used to compile and link:
PREFIX = /usr/local
EXEC-PREFIX = /usr/local
VERSION = 7.1.0-7
CC = gcc
CFLAGS = -I/usr/include/libpng15 -fopenmp -Wall -g -O2 -mtune=haswell -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CPPFLAGS = -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PCFLAGS =
DEFS = -DHAVE_CONFIG_H
LDFLAGS =
LIBS = -ltiff -ljpeg -lpng15 -lz -lm -lpthread
CXX = g++
CXXFLAGS = -pthread
FEATURES = DPC HDRI Cipher OpenMP
DELEGATES = jng jpeg png ps tiff zlib
==============================================================================
https://github.com/rosell-dk/webp-convert/wiki/Installing-Imagick-extension-with-WebP-support https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=35892 添加WebP ImageMagick 8832478985188 7.3 WHM專用服務器https支持的格式https://library.roguewave.com/display/SUPPORT/How+to+compile+Imagick+PHP+extension+with+WebP+support
要找到庫,您必須確保 pkgconfig 看到 .pc 文件/usr/lib/pkgconfig
將export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
到您的.bash_profile
,獲取它並使用pkg-config --list-all | grep webp
pkg-config --list-all | grep webp
。 如果找到了庫,請再次嘗試./configure --with-webp=yes
。
我最近在 Amazon Linux 2022 上嘗試配置 ImageMagick-7.1.0 時遇到了類似的問題。
當我運行pkg-config --list-all | grep webp
pkg-config --list-all | grep webp
根據@Juukie14 的建議,我收到:
/usr/bin/pkg-config: line 8: /usr/bin/aarch64-redhat-linux-gnu-pkg-config: No such file or directory
無論出於何種原因,從 AL2022 package 存儲庫安裝的 pkg-config 正在尋找arch64-redhat-linux-gnu-pkg-config
而它應該是/usr/bin/aarch64-amazon-linux-gnu-pkg-config
。
作為解決方法,我創建了一個符號鏈接:
ln -s /usr/bin/aarch64-amazon-linux-gnu-pkg-config /usr/bin/aarch64-redhat-linux-gnu-pkg-config
在此之后,我運行./configure --with-webp=yes
並且它起作用了。
我通過將/usr/local/lib/pkgconfig
添加到 PKG_CONFIG_PATH 來解決問題
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
然后配置和安裝 ImageMagick 在 webp 支持下成功完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.