Mac install GraphicsMagick

安装GraphicsMagick时遇到的问题,拿出来做个记录:

首先到ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/delegates/下载两个组件:

1.ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/delegates/libjpeg-6b.zip

2.ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/delegates/libpng-1.5.13.tar.xz

下载后解压安装

./configure

make

make install

 

下面开始安装GraphicsMagick

下载GraphicsMagick

url:ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.8.tar.gz

 

然后解压,在解压的目录下允许:

./configure

make

make install

直接这样安装有时会出现一些问题,下面讲解一些我使用到的参数.

 

confiure命令后面的CC=clang。它指定了编译器为Mac下推荐使用的clang。如果没有这个参数,Makefile将会使用系统默认的编译器进行编译,而这个编译器不是GraphicsMagic所推荐的,并且在make的过程中会出现以下错误:

Undefined symbols for architecture x86_64:
  "___builtin_object_size", referenced from:
      _BlurImageScanlines.omp_fn.6 in libGraphicsMagick.a(magick_libGraphicsMagick_la-effect.o)
      _XShearImage.omp_fn.0 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)
      _YShearImage.omp_fn.1 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [utilities/gm] Error 1
make: *** [all] Error 2

之前安装的组件会默认安装到/usr/local/lib下,所以在执行configure时要加上LDFLAGS='-L/usr/local/lib'  否则会出现下面错误:

Undefined symbols for architecture x86_64:
  "_png_set_check_for_invalid_index", referenced from:
      _WriteOnePNGImage in libGraphicsMagick.a(magick_libGraphicsMagick_la-png.o)
      _ReadOnePNGImage in libGraphicsMagick.a(magick_libGraphicsMagick_la-png.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [utilities/gm] Error 1
make: *** [all] Error 2

所以修改安装命令为:

./configure LDFLAGS='-L/usr/local/lib' CC=clang

make

make install

make clean

 

你可能感兴趣的:(gm mac)