「Ruby」カテゴリーアーカイブ

Rails2.1でタイムゾーンを扱う

mad.ly - Rails 2.1 Time Zone Support: An Overview --- Rails2.1のタイムゾーンサポートを詳しく解説している。サンプルのアプリもあり分かりやすい。後述する内容も書いてある。
Ruby On Rails ピチカート街道 - Rails 2.1・その12(DBに登録してあるUTC日付データを簡単変換) - --- コントローラで、以下のようにしてタイムゾーンを設定し直せる。

Time.zone = 'Tokyo'

Class: ActiveSupport::TimeZoneクラスを使用すると、Rails2.1のタイムゾーンサポートで設定したタイムゾーンを考慮したTimeオブジェクトの作成やUTCへの変換が簡単にできる。

# 設定したタイムゾーンでローカルのTimeを作成
t = Time.zone.local(2008, 9, 1, 0, 0)
#=> Mon, 01 Sep 2008 00:00:00 JST +09:00
# UTCに変換
utc = Time.zone.local_to_utc(t)
#=> Sun Aug 31 15:00:00 UTC 2008

gem install mysql でエラー

CentOS5.1にgemでrubyのMySQL API をインストールした。

$ sudo gem install mysql
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** 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/bin/ruby
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

MySQL/Rubyを参考にして、--with-mysql-configオプションをつけてみた。

$ sudo gem install mysql --with-mysql-config
ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --with-mysql-config

オプションのつけ方間違えた。

$ sudo gem install mysql -- --with-mysql-config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install mysql -- --with-mysql-config
checking for mysql_ssl_set()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** 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/bin/ruby
        --with-mysql-config
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

mysql-develをインストールする。

$ sudo yum install mysql-devel

改めてインストール。

$ sudo gem install mysql -- --with-mysql-config
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

OK。

RMagickのインストール

このエントリーでは、ImageMagickをyumでインストールする方法を説明しています。ImageMagickをyumでインストールした場合、バージョンが古いため最新のRMagick(rmagick-2.x.x)がインストールできないし、ソースからインストールした方が楽です。
ImageMagickをソースからインストールする方法は、
CentOSにImageMagickをソースからインストール → RMagickをインストール
をご覧ください。

RMagickをLinux(Fedora5, 6, CentOS5.1)にインストールした。

RAA - rmagick
RMagick Download Page
RMagick

ImageMagickのインストール

ImageMagickがインストールされているかどうかは、convertコマンドが実行できるかどうかでチェックできる。

$ convert logo: logo.gif

これで、logo.gifが作成されれば、インストールされている。
インストールされている場所は、

$ which convert
/usr/bin/convert

でチェック。

ImageMagickをインストール。

$ sudo yum install ImageMagick
$ sudo yum install ImageMagick-devel

RMagickのインストール

$ sudo gem install rmagick
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
	ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install rmagick
checking for Ruby version >= 1.8.2... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... no
Can't install RMagick 2.5.2. You must have ImageMagick 6.3.0 or later.
*** 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/bin/ruby
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.5.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.5.2/ext/RMagick/gem_make.out
$ convert --version
Version: ImageMagick 6.2.5 04/05/07 Q16 file:/usr/share/ImageMagick-6.2.5/doc/index.html
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC

ImageMagickのバージョンが6.3.0より下なので、gemで最新のRMagickはインストールできない。
rmagick-1.15.14.gemをダウンロードしてインストール。

$ wget http://rubyforge.org/frs/download.php/36807/rmagick-1.15.14.gem
$ sudo gem install rmagick-1.15.14.gem
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick-1.15.14.gem:
        ERROR: Failed to build gem native extension.
/usr/local/bin/ruby gem_extconf.rb install rmagick-1.15.14.gem
sh configure
Configuring RMagick 1.15.14
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking for ruby... /usr/local/bin/ruby
checking Ruby version... 1.8.7
checking for Magick-config... Magick-config
checking ImageMagick version... 6.2.5
checking for library containing InitializeMagick... -lMagick
checking for snprintf... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for sys/types.h... (cached) yes
checking for AcquireMagickMemory... yes
checking for AcquireStringInfo... yes
checking for AdaptiveBlurImageChannel... no
checking for AdaptiveResizeImage... no
checking for AdaptiveSharpenImage... no
checking for AdaptiveThresholdImage... yes
checking for AddDefinitions... no
checking for AddNoiseImageChannel... yes
checking for AllocateImageProfileIterator... no
checking for BilevelImageChannel... yes
checking for BlackThresholdImage... yes
checking for BlurImageChannel... yes
checking for ClearMagickException... no
checking for CompareImageChannels... yes
checking for CompareImageLayers... no
checking for CompositeImageChannel... no
checking for ContrastStretchImageChannel... no
checking for ConvertHSLToRGB... no
checking for ConvertRGBToHSL... no
checking for ConvolveImageChannel... yes
checking for EvaluateImageChannel... yes
checking for ExportImagePixels... yes
checking for FuzzyColorCompare... yes
checking for FxImageChannel... yes
checking for GammaImageChannel... yes
checking for GaussianBlurImageChannel... yes
checking for GetBlobSize... yes
checking for GetColorHistogram... no
checking for GetColorInfoArray... no
checking for GetColorInfoList... yes
checking for GetImageChannelDepth... yes
checking for GetImageChannelDistortion... yes
checking for GetImageChannelExtrema... yes
checking for GetImageChannelMean... yes
checking for GetImageClipMask... yes
checking for GetImageHistogram... yes
checking for GetImageProfile... yes
checking for GetImageProperty... no
checking for GetImageQuantumDepth... yes
checking for GetImageStatistics... no
checking for GetMagickInfoArray... no
checking for GetMagickPixelPacket... yes
checking for GetMagickInfoList... yes
checking for GetMagickResourceLimit... yes
checking for GetMultilineTypeMetrics... yes
checking for GetNextImageAttribute... yes
checking for GetNextImageProfile... yes
checking for GetTypeInfoList... yes
checking for GrayscalePseudoClassImage... no
checking for ImagesToBlob... yes
checking for ImportImagePixels... yes
checking for InheritException... yes
checking for InterpolatePixelColor... no
checking for InterpretImageAttributes... no
checking for IsColorSimilar... yes
checking for IsImageSimilar... no
checking for LinearStretchImage... no
checking for NegateImageChannel... yes
checking for NormalizeImageChannel... yes
checking for OrderedPosterizeImageChannel... no
checking for ParseSizeGeometry... yes
checking for PolaroidImage... no
checking for PosterizeImage... yes
checking for PreviewImage... yes
checking for QuantumOperatorRegionImage... no
checking for RadialBlurImage... yes
checking for RadialBlurImageChannel... yes
checking for RandomChannelThresholdImage... yes
checking for RandomThresholdImageChannel... yes
checking for RecolorImage... no
checking for RemoveFirstImageFromList... yes
checking for SeparateImageChannel... yes
checking for SepiaToneImage... yes
checking for SetImageBackgroundColor... yes
checking for SetImageChannelDepth... yes
checking for SetImageColorspace... yes
checking for SetImageExtent... yes
checking for SetImageInfoFile... yes
checking for SetImageOption... yes
checking for SetImageProperty... no
checking for SetImageRegistry... no
checking for SetImageStorageClass... no
checking for SetImageProgressMonitor... yes
checking for ShadowImage... yes
checking for SharpenImageChannel... yes
checking for SigmoidalContrastImageChannel... yes
checking for SketchImage... no
checking for SpliceImage... yes
checking for StripImage... yes
checking for ThresholdImageChannel... yes
checking for TintImage... yes
checking for TransposeImage... no
checking for TransverseImage... no
checking for UniqueImageColors... no
checking for UnsharpMaskImageChannel... yes
checking for VignetteImage... no
checking for WhiteThresholdImage... yes
checking for XImportImage... yes
checking for MagickBooleanType... yes
checking for magick_int64_t... no
checking for magick_uint64_t... no
checking for ExtendedSignedIntegralType... yes
checking for ExtendedUnsignedIntegralType... yes
checking for MagickOffsetType... yes
checking for MagickSizeType... yes
checking for MagickPixelPacket... yes
checking for ExceptionInfo.module... no
checking for Image.bias... yes
checking for Image.orientation... yes
checking for Image.quality... yes
checking for Image.ticks_per_second... yes
checking for Image.transparent_color... no
checking for Image.iptc_profile... yes
checking for Image.generic_profile... yes
checking for Image.generic_profiles... yes
checking for ImageInfo.orientation... yes
checking for ImageInfo.channel... yes
checking for Image.extract_info... yes
checking for CineonLogRGBColorspace enum value... no
checking for HSBColorspace enum value... yes
checking for LABColorspace enum value... yes
checking for Rec601LumaColorspace enum value... yes
checking for Rec601YCbCrColorspace enum value... yes
checking for Rec709LumaColorspace enum value... yes
checking for Rec709YCbCrColorspace enum value... yes
checking for LogColorspace enum value... yes
checking for ReplaceCompositeOp enum value... yes
checking for DstCompositeOp enum value... yes
checking for ColorDodgeCompositeOp enum value... yes
checking for IndexChannel enum value... yes
checking for GrayChannel enum value... yes
checking for AllChannels enum value... yes
checking for JPEG2000Compression enum value... yes
checking for UndefinedGravity enum value... yes
checking for QuantumPixel enum value... yes
checking for TransparentVirtualPixelMethod enum value... yes
checking for CoalesceLayer enum value... no
checking for MaxEvaluateOperator enum value... yes
checking for PaletteBilevelMatteType enum value... no
checking if GetImageQuantumDepth has only 1 argument... no
checking if GetColorInfoList has only 2 arguments... no
checking if GetTypeInfoList has only 2 arguments... no
checking if GetMagickInfoList has only 2 arguments... no
checking if RemoveImageProfile returns MagickBooleanType... yes
checking if ColorInfo.color is a MagickPixelPacket... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating ext/RMagick/extconf.rb
config.status: creating metaconfig
config.status: creating ext/RMagick/rmagick_config.h
configure:
This installation of RMagick 1.15.14 is configured for ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux] and ImageMagick 6.2.5.
RMagick configuration completed successfully.
make
if test -n "/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; then \
        RUBYLIBDIR=--rbdir="/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; \
fi; \
if test -n "/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; then \
        RUBYARCHDIR=--sodir="/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; \
fi; \
/usr/local/bin/ruby setup.rb config $RUBYLIBDIR $RUBYARCHDIR --data-dir=/share
---> lib
---> lib/rvg
<--- lib/rvg
<--- lib
---> ext
---> ext/RMagick
/usr/local/bin/ruby /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick/extconf.rb
creating Makefile
<--- ext/RMagick
<--- ext
/usr/local/bin/ruby setup.rb setup
---> lib
---> lib/rvg
<--- lib/rvg
<--- lib
---> ext
---> ext/RMagick
make
make[1]: Entering directory `/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick'
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmmain.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rminfo.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmimage.c
rmimage.c: In function 'Image_aref':
rmimage.c:594: 警告: assignment discards qualifiers from pointer target type
rmimage.c: In function 'Image_aset':
rmimage.c:654: 警告: assignment discards qualifiers from pointer target type
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmilist.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmfill.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmdraw.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmutil.c
gcc -shared -o RMagick.so rmmain.o rminfo.o rmimage.o rmilist.o rmfill.o rmdraw.o rmutil.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib -lfreetype -lz -L/usr/lib  -lMagick -ltiff -lfreetype -ljpeg -lgs -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread -ldl -lcrypt -lm   -lc
make[1]: Leaving directory `/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick'
<--- ext/RMagick
<--- ext
setup.rb: entering post-setup phase...
post-setup.rb: setting up documentation...
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Adispatch.rb (example 1 of 183)
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick InitialCoords.rb (example 2 of 183)
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from InitialCoords.rb:22
post-setup.rb: InitialCoords.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick NewCoordSys.rb (example 3 of 183)
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from NewCoordSys.rb:31
post-setup.rb: NewCoordSys.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick OrigCoordSys.rb (example 4 of 183)
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from OrigCoordSys.rb:17
post-setup.rb: OrigCoordSys.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick PreserveAspectRatio.rb (example 5 of 183)
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/arial.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from PreserveAspectRatio.rb:204
post-setup.rb: PreserveAspectRatio.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick RotateScale.rb (example 6 of 183)
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from RotateScale.rb:36
setup.rb:             Too many examples failed. Search for "Help!" at
            http://rmagick.rubyforge.org/install-faq.html.
post-setup.rb: RotateScale.rb example returned error code 256
make: *** [all] エラー 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/gem_make.ou

`get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/arial.ttf' (Magick::ImageMagickError)
`get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
フォントがないというエラーらしい。
TRIBLOG
MuraTaka 速記メモ / 2008-07
CentOS4.5にRMagickをインストール - プログラマ 福重 伸太朗 ~基本へ帰ろう~
を参考にして、フォントをインストールして、フォントへのシンボリックリンクを作成する。

http://www.mjmwired.net/resources/mjm-fedora-f7.html#ttf
からフォントのRPMをダウンロードしてインストール。

$ sudo rpm -ivh msttcorefonts-2.0-1.noarch.rpm
$ sudo /etc/init.d/xfs restart

フォントがインストールされた場所を確認。

$ rpm -ql msttcorefonts
/usr/share/fonts/msttcorefonts
/usr/share/fonts/msttcorefonts/andalemo.ttf
/usr/share/fonts/msttcorefonts/arial.ttf
/usr/share/fonts/msttcorefonts/arialbd.ttf
/usr/share/fonts/msttcorefonts/arialbi.ttf
/usr/share/fonts/msttcorefonts/ariali.ttf
/usr/share/fonts/msttcorefonts/ariblk.ttf
/usr/share/fonts/msttcorefonts/comic.ttf
/usr/share/fonts/msttcorefonts/comicbd.ttf
/usr/share/fonts/msttcorefonts/cour.ttf
/usr/share/fonts/msttcorefonts/courbd.ttf
/usr/share/fonts/msttcorefonts/courbi.ttf
/usr/share/fonts/msttcorefonts/couri.ttf
/usr/share/fonts/msttcorefonts/fonts.dir
/usr/share/fonts/msttcorefonts/georgia.ttf
/usr/share/fonts/msttcorefonts/georgiab.ttf
/usr/share/fonts/msttcorefonts/georgiai.ttf
/usr/share/fonts/msttcorefonts/georgiaz.ttf
/usr/share/fonts/msttcorefonts/impact.ttf
/usr/share/fonts/msttcorefonts/tahoma.ttf
/usr/share/fonts/msttcorefonts/times.ttf
/usr/share/fonts/msttcorefonts/timesbd.ttf
/usr/share/fonts/msttcorefonts/timesbi.ttf
/usr/share/fonts/msttcorefonts/timesi.ttf
/usr/share/fonts/msttcorefonts/trebuc.ttf
/usr/share/fonts/msttcorefonts/trebucbd.ttf
/usr/share/fonts/msttcorefonts/trebucbi.ttf
/usr/share/fonts/msttcorefonts/trebucit.ttf
/usr/share/fonts/msttcorefonts/verdana.ttf
/usr/share/fonts/msttcorefonts/verdanab.ttf
/usr/share/fonts/msttcorefonts/verdanai.ttf
/usr/share/fonts/msttcorefonts/verdanaz.ttf
/usr/share/fonts/msttcorefonts/webdings.ttf

フォントを置くディレクトリを作成(エラーメッセージに出ていたディレクトリ)して、フォントへのシンボリックリンクを作成。

$ sudo mkdir /usr/share/fonts/default/TrueType
$ cd /usr/share/fonts/default/TrueType
$ sudo ln -s ../../msttcorefonts/verdana.ttf
$ sudo ln -s ../../msttcorefonts/arial.ttf

再びrmagick-1.15.14をインストール。

$ sudo gem install rmagick-1.15.14.gem
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick-1.15.14.gem:
        ERROR: Failed to build gem native extension.
/usr/local/bin/ruby gem_extconf.rb install rmagick-1.15.14.gem
sh configure
Configuring RMagick 1.15.14
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking for ruby... /usr/local/bin/ruby
checking Ruby version... 1.8.7
checking for Magick-config... Magick-config
checking ImageMagick version... 6.2.5
checking for library containing InitializeMagick... -lMagick
checking for snprintf... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for sys/types.h... (cached) yes
checking for AcquireMagickMemory... yes
checking for AcquireStringInfo... yes
checking for AdaptiveBlurImageChannel... no
checking for AdaptiveResizeImage... no
checking for AdaptiveSharpenImage... no
checking for AdaptiveThresholdImage... yes
checking for AddDefinitions... no
checking for AddNoiseImageChannel... yes
checking for AllocateImageProfileIterator... no
checking for BilevelImageChannel... yes
checking for BlackThresholdImage... yes
checking for BlurImageChannel... yes
checking for ClearMagickException... no
checking for CompareImageChannels... yes
checking for CompareImageLayers... no
checking for CompositeImageChannel... no
checking for ContrastStretchImageChannel... no
checking for ConvertHSLToRGB... no
checking for ConvertRGBToHSL... no
checking for ConvolveImageChannel... yes
checking for EvaluateImageChannel... yes
checking for ExportImagePixels... yes
checking for FuzzyColorCompare... yes
checking for FxImageChannel... yes
checking for GammaImageChannel... yes
checking for GaussianBlurImageChannel... yes
checking for GetBlobSize... yes
checking for GetColorHistogram... no
checking for GetColorInfoArray... no
checking for GetColorInfoList... yes
checking for GetImageChannelDepth... yes
checking for GetImageChannelDistortion... yes
checking for GetImageChannelExtrema... yes
checking for GetImageChannelMean... yes
checking for GetImageClipMask... yes
checking for GetImageHistogram... yes
checking for GetImageProfile... yes
checking for GetImageProperty... no
checking for GetImageQuantumDepth... yes
checking for GetImageStatistics... no
checking for GetMagickInfoArray... no
checking for GetMagickPixelPacket... yes
checking for GetMagickInfoList... yes
checking for GetMagickResourceLimit... yes
checking for GetMultilineTypeMetrics... yes
checking for GetNextImageAttribute... yes
checking for GetNextImageProfile... yes
checking for GetTypeInfoList... yes
checking for GrayscalePseudoClassImage... no
checking for ImagesToBlob... yes
checking for ImportImagePixels... yes
checking for InheritException... yes
checking for InterpolatePixelColor... no
checking for InterpretImageAttributes... no
checking for IsColorSimilar... yes
checking for IsImageSimilar... no
checking for LinearStretchImage... no
checking for NegateImageChannel... yes
checking for NormalizeImageChannel... yes
checking for OrderedPosterizeImageChannel... no
checking for ParseSizeGeometry... yes
checking for PolaroidImage... no
checking for PosterizeImage... yes
checking for PreviewImage... yes
checking for QuantumOperatorRegionImage... no
checking for RadialBlurImage... yes
checking for RadialBlurImageChannel... yes
checking for RandomChannelThresholdImage... yes
checking for RandomThresholdImageChannel... yes
checking for RecolorImage... no
checking for RemoveFirstImageFromList... yes
checking for SeparateImageChannel... yes
checking for SepiaToneImage... yes
checking for SetImageBackgroundColor... yes
checking for SetImageChannelDepth... yes
checking for SetImageColorspace... yes
checking for SetImageExtent... yes
checking for SetImageInfoFile... yes
checking for SetImageOption... yes
checking for SetImageProperty... no
checking for SetImageRegistry... no
checking for SetImageStorageClass... no
checking for SetImageProgressMonitor... yes
checking for ShadowImage... yes
checking for SharpenImageChannel... yes
checking for SigmoidalContrastImageChannel... yes
checking for SketchImage... no
checking for SpliceImage... yes
checking for StripImage... yes
checking for ThresholdImageChannel... yes
checking for TintImage... yes
checking for TransposeImage... no
checking for TransverseImage... no
checking for UniqueImageColors... no
checking for UnsharpMaskImageChannel... yes
checking for VignetteImage... no
checking for WhiteThresholdImage... yes
checking for XImportImage... yes
checking for MagickBooleanType... yes
checking for magick_int64_t... no
checking for magick_uint64_t... no
checking for ExtendedSignedIntegralType... yes
checking for ExtendedUnsignedIntegralType... yes
checking for MagickOffsetType... yes
checking for MagickSizeType... yes
checking for MagickPixelPacket... yes
checking for ExceptionInfo.module... no
checking for Image.bias... yes
checking for Image.orientation... yes
checking for Image.quality... yes
checking for Image.ticks_per_second... yes
checking for Image.transparent_color... no
checking for Image.iptc_profile... yes
checking for Image.generic_profile... yes
checking for Image.generic_profiles... yes
checking for ImageInfo.orientation... yes
checking for ImageInfo.channel... yes
checking for Image.extract_info... yes
checking for CineonLogRGBColorspace enum value... no
checking for HSBColorspace enum value... yes
checking for LABColorspace enum value... yes
checking for Rec601LumaColorspace enum value... yes
checking for Rec601YCbCrColorspace enum value... yes
checking for Rec709LumaColorspace enum value... yes
checking for Rec709YCbCrColorspace enum value... yes
checking for LogColorspace enum value... yes
checking for ReplaceCompositeOp enum value... yes
checking for DstCompositeOp enum value... yes
checking for ColorDodgeCompositeOp enum value... yes
checking for IndexChannel enum value... yes
checking for GrayChannel enum value... yes
checking for AllChannels enum value... yes
checking for JPEG2000Compression enum value... yes
checking for UndefinedGravity enum value... yes
checking for QuantumPixel enum value... yes
checking for TransparentVirtualPixelMethod enum value... yes
checking for CoalesceLayer enum value... no
checking for MaxEvaluateOperator enum value... yes
checking for PaletteBilevelMatteType enum value... no
checking if GetImageQuantumDepth has only 1 argument... no
checking if GetColorInfoList has only 2 arguments... no
checking if GetTypeInfoList has only 2 arguments... no
checking if GetMagickInfoList has only 2 arguments... no
checking if RemoveImageProfile returns MagickBooleanType... yes
checking if ColorInfo.color is a MagickPixelPacket... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating ext/RMagick/extconf.rb
config.status: creating metaconfig
config.status: creating ext/RMagick/rmagick_config.h
config.status: ext/RMagick/rmagick_config.h is unchanged
configure:
This installation of RMagick 1.15.14 is configured for ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux] and ImageMagick 6.2.5.
RMagick configuration completed successfully.
make
if test -n "/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; then \
        RUBYLIBDIR=--rbdir="/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; \
fi; \
if test -n "/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; then \
        RUBYARCHDIR=--sodir="/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib"; \
fi; \
/usr/local/bin/ruby setup.rb config $RUBYLIBDIR $RUBYARCHDIR --data-dir=/share
---> lib
---> lib/rvg
<--- lib/rvg
<--- lib
---> ext
---> ext/RMagick
/usr/local/bin/ruby /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick/extconf.rb
creating Makefile
<--- ext/RMagick
<--- ext
/usr/local/bin/ruby setup.rb setup
---> lib
---> lib/rvg
<--- lib/rvg
<--- lib
---> ext
---> ext/RMagick
make
make[1]: Entering directory `/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick'
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmmain.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rminfo.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmimage.c
rmimage.c: In function 'Image_aref':
rmimage.c:594: 警告: assignment discards qualifiers from pointer target type
rmimage.c: In function 'Image_aset':
rmimage.c:654: 警告: assignment discards qualifiers from pointer target type
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmilist.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmfill.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmdraw.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick -DRUBY_VERSION=0x187  -I/usr/include -fPIC   -c rmutil.c
gcc -shared -o RMagick.so rmmain.o rminfo.o rmimage.o rmilist.o rmfill.o rmdraw.o rmutil.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib -lfreetype -lz -L/usr/lib  -lMagick -ltiff -lfreetype -ljpeg -lgs -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread -ldl -lcrypt -lm   -lc
make[1]: Leaving directory `/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/ext/RMagick'
<--- ext/RMagick
<--- ext
setup.rb: entering post-setup phase...
post-setup.rb: setting up documentation...
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Adispatch.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick InitialCoords.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick NewCoordSys.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick OrigCoordSys.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick PreserveAspectRatio.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick RotateScale.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Skew.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Use01.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Use02.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Use03.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick ViewBox.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick Zconstitute.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick adaptive_threshold.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick add_noise.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick affine.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick affine_transform.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick arc.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick arcpath.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick arcs01.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick arcs02.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick average.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick axes.rb
axes.rb:59:in `draw': unable to read font `/usr/share/fonts/default/TrueType/arialbi.ttf' (Magick::ImageMagickError)
        from axes.rb:59
post-setup.rb: axes.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick baseline_shift01.rb
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/arialbd.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:84:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:70:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:69:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:69:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from baseline_shift01.rb:17
post-setup.rb: baseline_shift01.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick bilevel_channel.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick blur_image.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick border.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick bounding_box.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier1.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier2.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier3.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier4.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier5.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cbezier6.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick channel.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick charcoal.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick chop.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick circle.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick circle01.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick clip_path.rb
clip_path.rb:34: warning: `composite' can cause memory leaks when RMagick was built with ImageMagick 6.2.5.
Upgrade to ImageMagick 6.3.4 or later to prevent this behavior.
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick coalesce.rb
This may take a few seconds...
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick color_fill_to_border.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick color_floodfill.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick color_histogram.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick color_reset.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick colorize.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick colors.rb
colors.rb:47:in `annotate': unable to read font `/usr/share/fonts/default/TrueType/arialbd.ttf' (Magick::ImageMagickError)
        from colors.rb:47
Creating colors.miff. This may take a few seconds...
        Creating color swatches...
        Creating montage...
post-setup.rb: colors.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick composite.rb
composite.rb:128: warning: `texture=' can cause memory leaks when RMagick was built with ImageMagick 6.2.5.
Upgrade to ImageMagick 6.3.4 or later to prevent this behavior.
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick contrast.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick crop.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick crop_resized.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick crop_with_gravity.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cubic01.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cubic02.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick cycle_colormap.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick dissolve.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick drawcomp.rb
drawcomp.rb:26: warning: `composite' can cause memory leaks when RMagick was built with ImageMagick 6.2.5.
Upgrade to ImageMagick 6.3.4 or later to prevent this behavior.
drawcomp.rb:32: warning: `composite' can cause memory leaks when RMagick was built with ImageMagick 6.2.5.
Upgrade to ImageMagick 6.3.4 or later to prevent this behavior.
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick drop_shadow.rb
drop_shadow.rb:29:in `annotate': unable to read font `/usr/share/fonts/default/TrueType/arialbi.ttf' (Magick::ImageMagickError)
        from drop_shadow.rb:29
post-setup.rb: drop_shadow.rb example returned error code 256
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick edge.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick ellipse.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick ellipse01.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick emboss.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick enhance.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick equalize.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick evenodd.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick flatten_images.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick flip.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick flop.rb
/usr/local/bin/ruby -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib -I /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./ext/RMagick font_styles.rb
/usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/arialbd.ttf' (Magick::ImageMagickError)
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:321:in `render'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/misc.rb:696:in `text'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/text.rb:65:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/container.rb:72:in `add_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
        from /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/./lib/rvg/rvg.rb:236:in `draw'
        from font_styles.rb:31
setup.rb:             Too many examples failed. Search for "Help!" at
            http://rmagick.rubyforge.org/install-faq.html.
post-setup.rb: font_styles.rb example returned error code 256
make: *** [all] エラー 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.14/gem_make.out

`get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/arialbd.ttf' (Magick::ImageMagickError)
arialbdへのシンボリックリンクも作成。

$ sudo ln -s ../../msttcorefonts/arialbd.ttf

今度こそと思って、rmagick-1.15.14をインストールしたら、またエラー。
verdanabがない。

$ sudo ln -s ../../msttcorefonts/verdanab.ttf

結局、以下の4つのシンボリックリンクが必要だった。

$ cd /usr/share/fonts/default/TrueType
$ sudo ln -s ../../msttcorefonts/arial.ttf
$ sudo ln -s ../../msttcorefonts/arialbd.ttf
$ sudo ln -s ../../msttcorefonts/verdana.ttf
$ sudo ln -s ../../msttcorefonts/verdanab.ttf

そして、またrmagick-1.15.14をインストール。

$ sudo gem install rmagick-1.15.14.gem
Password:
Building native extensions.  This could take a while...
Successfully installed rmagick-1.15.14
1 gem installed

やっとインストールできた。

ruby、rubygemsのインストール

最新安定版であるruby 1.8.7-p72(2008-08-28現在)をインストール。
ダウンロード

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
$ tar xzvf ruby-1.8.7-p72.tar.gz
$ cd ruby-1.8.7-p72
$ ./configure
$ make
$ sudo make install

rubygemsをインストール。

$ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
$ tar xvzf rubygems-1.2.0.tgz
$ cd rubygems-1.2.0
$ sudo ruby setup.rb

ここでzlibがないというエラーになる場合は、
zlib-develをインストール。

$ sudo yum install zlib-devel

rubyのソースを解凍したディレクトリに移動しext/zlibに行き、zlibの設定。

$cd ~/src/cd ruby-1.8.7-p72/ext/zlib
$ ruby extconf.rb --with-zlib-include=/usr/include -with-zlib-lib=/usr/lib
$ make
$ sudo make install

再びrubygemsのインストール。

$ sudo ruby setup.rb

RubyGems Manuals

MAMPの環境にrubyのMySQLアダプタをインストールする

MAMPの環境でgem install mysqlを実行すると、以下のエラーになる。

$ sudo gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out

MAMPのmysqlは、ヘッダファイル、ライブラリがデフォルトの/usr/local/lib、/usr/local/includeにないので、オプションを指定する必要がある。オプションはいろいろあるが、--with-mysql-configを使うと便利。
MySQL/Ruby

--with-mysql-config[=/path/to/mysql_config]
    mysql_config コマンドの結果からコンパイルパラメータを得ます。 

mysql_config コマンドにパスが通るように、.bash_profileなどで、PATHにMAMPのディレクトリを追加しておくか、--with-mysql-config=/Applications/MAMP/Library/bin/mysql_configを指定する。
ここでは、PATHを設定します。

export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5/bin:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin:$PATH

再度、インストール。

$ sudo gem install mysql -- --with-mysql-config
Building native extensions.  This could take a while...Successfully installed mysql-2.7
1 gem installed

OK。