验证码图片显示错误,ImageMgick编译安装的问题

起初是怀疑没有字体

rmagick安装之后,可以通过下面的命令来查看字体:
# convert -list  font


把另一台机器上的字体弄过去之后,还是不行

因为这个ImageMgick不是我装的,于是我打算重新编译一下
重新./configure
发现很多东西check 的结果都是 no

google了一下发现在编译之前需要安装其他的包,虽然这些包,你提前不装,他也不会出错,但是用的时候就出错了。

tiff
libpng
jpegsrc
freetype
ghostscript-fonts-std
ghostscript


安装完成之后,你再去imagemagick源文件下。./configure 你就会发现他check的结果都是true了。

中间又出现了一个依赖包
jasper

下载编译之前需要执行下面命令
export CFLAGS="-O2 -fPIC"

然后再编译jasper
否在在编译安装ImageMagick的时候,它会报错,报错如下:

libjasper.a(jas_cm.o): relocation R_X86_64_32 against `a localsymbol' can not be used when making a shared object;   
recompile with -fPIC/usr/local/lib/libjasper.a: could not read symbols: Badvalue 



这里推荐一下这个文章,如何正确编译安装ImageMagick
http://blog.csdn.net/shixing_11/article/details/6938396

========================================

另一个问题

cannot open shared object file: No such file or directory - /usr/local/ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.so (LoadError)

装完magick后没有引导环境变量里面。解决方法:
export LD_LIBRARY_PATH=/usr/local/lib


===========
安装rmagick的gem出错:

No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found

Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/ruby/bin/ruby



解决:

ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand 
ln -s /usr/local/include/ImageMagick/magick /usr/local/include/magick

你可能感兴趣的:(image)