ruby-gd captcha インストールメモ

ruby-gdインストールしようとしたらエラーが出たのでメモ

まずは、何も考えずインストール

%sudo gem install ruby-gd -- --build-flag --with-freetype                                                                                            

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-gd:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install ruby-gd -- --build-flag --with-freetype
checking for main() in -lfreetype... yes
checking for main() in -lz... yes
checking for main() in -lpng... yes
checking for gdImagePng() in -lgd... 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-gd-dir
        --without-gd-dir
        --with-gd-include
        --without-gd-include=${gd-dir}/include
        --with-gd-lib
        --without-gd-lib=${gd-dir}/lib
        --with-xpm
        --without-xpm
        --with-jpeg
        --without-jpeg
        --with-ttf
        --without-ttf
        --with-xpm
        --without-xpm
        --with-freetype
        --with-freetypelib
        --without-freetypelib
        --with-zlib
        --without-zlib
        --with-pnglib
        --without-pnglib
        --with-gdlib
        --without-gdlib

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/ruby-gd-0.7.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/ruby-gd-0.7.4/gem_make.out

パッケージ freetype,libpng3,libpng-dev,libgd-devあたりを入れる

%sudo apt-get   build-dep freetype 
%sudo apt-get   install freetype
%sudo aptitude instlal libpng-dev
%sudo aptitude instlal libpng3 libpng3-dev
%sudo aptitude install libgd-dev

再度インストール

%sudo gem install ruby-gd -- --build-flag --with-freetype                                                                                            

Building native extensions.  This could take a while...
Successfully installed ruby-gd-0.7.4
1 gem installed
Installing ri documentation for ruby-gd-0.7.4...
Installing RDoc documentation for ruby-gd-0.7.4...

最後にcaptcha

%sudo gem install captcha

About this entry