2011-03-10 8 views
9

Soy nuevo en programación y Ruby on Rails. Configurar mi entorno de desarrollo ha sido un infierno. Mi problema actual es la instalación de SQLite 3.¿Cómo instalo SQlite3 para Ruby on Rails mientras uso RVM

Cuando hago

$ bundle install 

consigo

Fetching source index for http://rubygems.org/ 
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.1) 
Using builder (2.1.2) 
Using i18n (0.4.2) 
Using activemodel (3.0.1) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.24) 
Using actionpack (3.0.1) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.15) 
Using actionmailer (3.0.1) 
Using arel (1.0.1) 
Using activerecord (3.0.1) 
Using activeresource (3.0.1) 
Using bundler (1.0.10) 
Using thor (0.14.6) 
Using railties (3.0.1) 
Using rails (3.0.1) 
Installing sqlite3 (1.3.3) with native extensions /home/oo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 

     /home/oo/.rvm/rubies/ruby-1.9.2-p180/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=/home/oo/.rvm/rubies/ruby-1.9.2-p180/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 


Gem files will remain installed in /home/oo/.rvm/gems/[email protected]/gems/sqlite3-1.3.3 for inspection. 
Results logged to /home/oo/.rvm/gems/[email protected]/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out 
    from /home/oo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions' 
    from /home/oo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each' 
    from /home/oo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions' 
    from /home/oo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start' 
    from /home/oo/.rvm/gems/[email protected]/gems/bundler-1.0.10/bin/bundle:13:in `<top (required)>' 
    from /home/oo/.rvm/gems/[email protected]/bin/bundle:19:in `load' 
    from /home/oo/.rvm/gems/[email protected]/bin/bundle:19:in `<main>' 

estoy usando Ubuntu 10.10

+0

posible duplicado de http://stackoverflow.com/questions/3458602/ sqlite3-ruby-install-error-on-ubuntu – Groovetrain

Respuesta

7

Te faltan bibliotecas compartidas para instalar sqlite3. Probablemente una cosa que la mayoría de las instrucciones de instalación o tutoriales de ROR no le dicen es que cuando se ejecuta en Linux necesita bibliotecas compartidas o si falta una dll de persona de Windows o es incompatible con la versión que intenta ejecutar.

Veo que también está ejecutando RVM. Entonces deberías probar esto.

sudo apt-get install libsqlite3-dev 
sudo gem install sqlite3-ruby 

Si todavía tiene problemas para instalar la gema intente esto - caer el sudo en la línea y acaba de instalar la gema

gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib 

Además no hace daño a actualizar todas sus bibliotecas para Ubuntu.

Ejecutar este primer antes de ejecutar las bibliotecas de sqlite3:

sudo apt-get update 
sudo apt-get upgrade 

es probable que tome algunos minutos para ejecutar la actualización o mejora. También puede ejecutar esto desde el área Admin -> Sistema. Hay un menú que le permite ejecutar todas las actualizaciones de la biblioteca y verifica las dependencias que pueden faltar.

También podría ejecutar la instalación de sqlite desde la GUI de las aplicaciones del sistema, ya que comprobará los programas de dependencia que también pueden ser necesarios.

Recuerde que cuando algo no se instala como el problema que tiene con Ruby on Rails, generalmente significa que faltan bibliotecas o que es necesaria la versión incorrecta.

+0

@ianN Con éxito 'sudo apt-get update sudo apt-get upgrade' y 'sudo apt-get install libsqlite3-dev'. Pero cuando hice 'sudo gem install sqlite3-ruby' recibí la respuesta 'sudo: gem: command not found' – OoTheNigerian

+0

@OoTheNigerian - lo siento compañero, olvidó que está ejecutando RVM. He actualizado mi respuesta – IanN

+0

@IanN. No puedo notar el cambio que hiciste. lo siento por ser una molestia. – OoTheNigerian