centos8/linux:通过源码编译安装imagemagick7(ImageMagick 7.1.0-51)

一,ImageMagick的相关文档:

1,官网:

https://imagemagick.org/

2,下载页

https://imagemagick.org/script/download.php#linux

如图:

二,下载源码包:

1,说明:imagemaigck 7.1的rpm包最低只支持到rhel/centos8.3

[root@blog imagemagick]# rpm -Uvh ImageMagick-7.1.0-51.x86_64.rpm
error: Failed dependencies:
        ImageMagick-libs(x86-64) = 7.1.0-51 is needed by ImageMagick-7.1.0-51.x86_64
        libMagickCore-7.Q16HDRI.so.10()(64bit) is needed by ImageMagick-7.1.0-51.x86_64
        libMagickWand-7.Q16HDRI.so.10()(64bit) is needed by ImageMagick-7.1.0-51.x86_64
        libMagickWand-7.Q16HDRI.so.10(VERS_10.0)(64bit) is needed by ImageMagick-7.1.0-51.x86_64
        libc.so.6(GLIBC_2.34)(64bit) is needed by ImageMagick-7.1.0-51.x86_64
        rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by ImageMagick-7.1.0-51.x86_64

我们的linux当前版本是centos8.0.x, 所以我们选择编译安装

2,wget命令下载:

[root@blog imagemagick]# wget https://imagemagick.org/archive/ImageMagick.tar.gz

3,下载完成后解压:

[root@blog imagemagick]# tar -zxvf ImageMagick.tar.gz

三,安装:

1,配置:

[root@blog ImageMagick-7.1.0-51]# ./configure --prefix=/usr/local/soft/imagemagick --disable-shared    

2,编译:

[root@blog ImageMagick-7.1.0-51]# make

时间较长,如报错参见下面的处理

3,安装

[root@blog ImageMagick-7.1.0-51]# make install

四,编译时报错:

  CCLD     MagickWand/libMagickWand-7.Q16HDRI.la
  CXXLD    utilities/magick
libtool:   error: unsupported hardcode properties See the libtool documentation for more information. Fatal configuration error.
make[1]: *** [Makefile:8147: utilities/magick] Error 1
make[1]: Leaving directory '/usr/local/source/imagemagick/ImageMagick-7.1.0-51'
make: *** [Makefile:6202: all] Error 2

解决:升级gcc

[root@blog ~]# gcc --version
gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

升级

[root@blog ~]# yum update gcc

 把c++也安装上

[root@blog ~]# yum install gcc-c++

查看升级后的gcc版本:

[root@blog ImageMagick-7.1.0-51]# gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

再次编译会正常通过

五,测试效果

从gif中抽取一帧

[lhdop@blog img2]$ /usr/local/soft/imagemagick/bin/convert dog.gif[49] dogp-49.png 

gif:

 png:

说明:刘宏缔的架构森林—专注it技术的博客,
网址:https://imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/06/03/centos8-linux-tong-guo-yuan-ma-bian-yi-an-zhuang/
代码: https://github.com/liuhongdi/https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com

六,查看imagemagick的版本:

imagemagick的版本:

[root@blog ImageMagick-7.1.0-51]# /usr/local/soft/imagemagick/bin/convert --version
Version: ImageMagick 7.1.0-51 Q16-HDRI x86_64 20499 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib freetype jng jpeg lzma png xml zip zlib
Compiler: gcc (8.5) 
QR:centos8/linux:通过源码编译安装imagemagick7(ImageMagick 7.1.0-51)

发表回复