LoginSignup
7
5

More than 5 years have passed since last update.

さくらのレンタルサーバに ImageMagick をインストールする方法

Last updated at Posted at 2016-02-17

さくらのレンタルサーバにパッケージを導入する場合、pspkg というツールが非常に便利ですが、残念ながら ImageMagick は pspkg では導入できませんでした。

ということで自前でインストールします。

$ mkdir ~/works
$ cd ~/works
$ wget -c http://www.imagemagick.org/download/ImageMagick.tar.gz
$ tar xf ImageMagick.tar.gz
$ cd ImageMagick-6.9.3-4/
$ ./configure --prefix=$HOME/usr --disable-openmp --disable-opencl
$ make
$ make install
$ echo "export PATH=\$HOME/usr/bin:\$PATH" >> ~/.bash_profile
$ echo "export PKG_CONFIG_PATH=\$HOME/usr/lib/pkgconfig" >> ~/.bash_profile
$ source ~/.bash_profile

./configure --prefix=$HOME/usr --disable-openmp --disable-opencl がポイントです。さくらのレンタルサーバが使用する FreeBSD 環境がなのが、その環境が使用する clang がなのかはわかりませんが、とにかく OpenMP がサポートされていないため、--disable-openmp オプションなしでビルドすると undefined reference to omp_destroy_lock@OMP_3.0 というたぐいの実行時エラーが発生します。ImageMagick のライブラリとのリンク時にも同様のエラーが発生します。このオプションで OpenMP と、ついでに --disable-opencl で OpenCL も無効にします。

最後の 3 行は実行ファイルへパス、ImageMagick のライブラリに対して pkg-config が適切な結果を返すようにするための環境変数の整備です。

インストールに成功していれば、以下の様な結果を返すはずです。

$ which convert
/home/xxx/usr/bin/convert
$ convert -version
Version: ImageMagick 6.9.3-4 Q16 x86_64 2016-02-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC 
Delegates (built-in): bzlib fftw fontconfig freetype fpx jbig jng jpeg lcms lqr png tiff xml
$ pkg-config --libs ImageMagick
-L/home/xxx/usr/lib -lMagickCore-6.Q16
7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5