Debian ほぼ最小インストールにrubyをソースインストール、rails開始

estis2011/10/23 (日) 07:25 に投稿

と、rails new store とかしたら、

Installing sqlite3 (1.3.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --enable-local
        --disable-local


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.4), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.4'` succeeds before bundling.

と、
Installing sqlite3 (1.3.4) with native extensions
で、エラー。

gem install sqlite3 -v '1.3.4'
とあったので、素直に実行したら、また同じエラーが、

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

/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --enable-local
        --disable-local


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out

なるほど、yum install sqlite3-devel か、しかしここはDebianだ、ということで、
aptitude install sqlite3-devel
したが、
名前か説明が "sqlite3-devel" にマッチするパッケージは見つかりませんでした
と言われる。

しかたがないので、aptitude search sqlite3 した。

p   bacula-director-sqlite3                           - ネットワークバックアップ、リカバリおよび検証 - Director 用 S
p   bacula-sd-sqlite3                                 - ネットワークバックアップ、リカバリおよび検証 - SQLite 3 SD
p   cl-sql-sqlite3                                    - CLSQL database backend, SQLite3
p   haskell-haskelldb-hsql-sqlite3-doc                - API documentation of haskelldb-hsql-sqlite3
p   haskell-hsql-sqlite3-doc                          - API documentation of the hsql-sqlite3 library for Haskell
v   libaprutil1-dbd-sqlite3                           -
p   libdataobjects-sqlite3-ruby1.8                    - sqlite3 adapter for libdataobjects-ruby1.8
p   libdbd-sqlite3                                    - SQLite3 database driver for libdbi
p   libdbd-sqlite3-perl                               - Perl DBI driver with a self-contained RDBMS
p   libdbd-sqlite3-ruby                               - Ruby/DBI driver for SQLite3
p   libdbd-sqlite3-ruby1.8                            - Ruby/DBI SQLite driver for Ruby 1.8
p   libdspam7-drv-sqlite3                             - DSPAM is a scalable and statistical anti-spam filter
p   libghc6-haskelldb-hsql-sqlite3-dev                - GHC6 library for HaskellDB support for the HSQL SQLite3 driv
p   libghc6-hdbc-sqlite3-dev                          - Sqlite v3 HDBC (Haskell Database Connectivity) Driver for GH
p   libghc6-hsql-sqlite3-dev                          - SQLite driver of the HSQL library for GHC6
p   libghc6-hsql-sqlite3-prof                         - SQLite driver of the HSQL profiling library for GHC6
p   libhk-classes-sqlite3                             - SQLite 3 driver plugin for hk_classes
p   libhugs-hdbc-sqlite3                              - Sqlite v3 HDBC (Haskell Database Connectivity) Driver for Hu
p   libkaya-sqlite3-dev                               - SQLite binding for kaya
p   liblua5.1-sql-sqlite3-2                           - luasql library for the lua language version 5.1
p   liblua5.1-sql-sqlite3-dev                         - luasql development files for the lua language version 5.1
p   libsoci-sqlite3-gcc                               - C++ Database Access Library (SQLite3 backend)
i   libsqlite3-0                                      - SQLite 3 共有ライブラリ
p   libsqlite3-0-dbg                                  - SQLite 3 debugging symbols
p   libsqlite3-dev                                    - SQLite 3 開発用ファイル
p   libsqlite3-gst                                    - SQLite bindings for GNU Smalltalk
p   libsqlite3-ocaml                                  - Embeddable SQL Database for OCaml Programs
p   libsqlite3-ocaml-dev                              - Embeddable SQL Database for OCaml Programs
p   libsqlite3-ruby                                   - SQLite3 interface for Ruby
p   libsqlite3-ruby1.8                                - SQLite3 interface for Ruby 1.8
p   libsqlite3-tcl                                    - SQLite 3 Tcl bindings
p   libyada-sqlite3-4                                 - yet another database abstraction layer - sqlite backend
p   pdns-backend-sqlite3                              - sqlite backend for PowerDNS
i   sqlite3                                           - SQLite 3 用コマンドラインインターフェイス
p   sqlite3-doc                                       - SQLite 3 documentation
p   ulogd-sqlite3                                     - SQLite 3 extension to ulogd

なるほど、libsqlite3-dev だ。

aptitude install libsqlite3-dev
して、
gem install sqlite3 -v '1.3.4'
してから、
rails new store

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
になった。

# bundle show
Gems included by the bundle:
  * actionmailer (3.1.1)
  * actionpack (3.1.1)
  * activemodel (3.1.1)
  * activerecord (3.1.1)
  * activeresource (3.1.1)
  * activesupport (3.1.1)
  * ansi (1.3.0)
  * arel (2.2.1)
  * builder (3.0.0)
  * bundler (1.0.21)
  * coffee-rails (3.1.1)
  * coffee-script (2.2.0)
  * coffee-script-source (1.1.2)
  * erubis (2.7.0)
  * execjs (1.2.9)
  * hike (1.2.1)
  * i18n (0.6.0)
  * jquery-rails (1.0.16)
  * json (1.6.1)
  * mail (2.3.0)
  * mime-types (1.16)
  * multi_json (1.0.3)
  * polyglot (0.3.2)
  * rack (1.3.5)
  * rack-cache (1.1)
  * rack-mount (0.8.3)
  * rack-ssl (1.3.2)
  * rack-test (0.6.1)
  * rails (3.1.1)
  * railties (3.1.1)
  * rake (0.9.2)
  * rdoc (3.11)
  * sass (3.1.10)
  * sass-rails (3.1.4)
  * sprockets (2.0.3)
  * sqlite3 (1.3.4)
  * thor (0.14.6)
  * tilt (1.3.3)
  * treetop (1.4.10)
  * turn (0.8.3)
  * tzinfo (0.3.30)
  * uglifier (1.0.4)