2011-02-17 15 views
16

Estoy tratando de instalar la gema "sqlite3-ruby" (o la gema "sqlite3") en OS X 10.6. Estoy usando rubí 1.9.2 y actualmente me sale el siguiente:sqlite3 gem no se puede instalar

$ sqlite3 --version 
3.7.4 
$ sudo gem install sqlite3 
Building native extensions. This could take a while... 
ERROR: Error installing sqlite3-ruby: 
    ERROR: Failed to build gem native extension. 

/Users/folken/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb 
checking for sqlite3.h... *** 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=/Users/folken/.rvm/rubies/ruby-1.9.2-head/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 
/Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in `postpone' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for' 
    from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:852:in `find_header' 
    from extconf.rb:28:in `<main>' 


Gem files will remain installed in /Users/folken/.rvm/gems/ruby-1.9.2-head/gems/sqlite3-1.3.3 for inspection. 

Los siguientes son los resultados de los cuales & whereis, y el sqlite3.h se encuentra en/opt/local/include:

$ which sqlite3 
/opt/local/bin/sqlite3 
$ whereis sqlite3 
/usr/bin/sqlite3 

he intentado pasar en el siguiente, así:

sudo gem install sqlite3 -- --with-sqlite3-include /opt/local/include --with-sqlite3-lib /opt/local/lib 
sudo gem install sqlite3 -- --with-sqlite3-dir /opt/local/bin 

que se traduce en lo siguiente:

ERROR: Error installing sqlite3-ruby: 
    ERROR: Failed to build gem native extension. 

/Users/folken/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with-sqlite3-dir /usr/bin/sqlite3 
*** 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=/Users/folken/.rvm/rubies/ruby-1.9.2-head/bin/ruby 
    --with-sqlite3-dir 
/Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:1336:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError) 
    from extconf.rb:9:in `<main>' 

También bajo /Users/folken/.rvm/gems/ruby-1.9.2-head/gems: sqlite-rubí 2.2.3 sqlite3-1.3.3

Bajo RVM tengo rubí -1.8.7 y la gema sqlite3 se carga bien en eso, pero después de mucho google no he encontrado una solución que me funcione. Cualquier ayuda es muy apreciada (incluso si se trata de instalación manual/piratería para ponerse a trabajar).

+1

¿Revisó el registro del archivo como se lo indicaron? ¿Qué contenía? – jergason

+0

¿Tiene gcc? Intente escribir gcc en su shell –

+1

@Michael - sí, tengo gcc, @Jergason - No estoy seguro de dónde está este mkmf.el archivo de registro se está produciendo, no está en /Users/folken/.rvm/log/ruby-1.9.2-head (o en cualquier lugar cercano, ¿a dónde normalmente se destina?) – Folken

Respuesta

3

Parece que no ha instalado XCode.

13

Tuve un problema casi similar al que tuve cuando instalé sqlite3 y, sin embargo, la gema sqlite3 no se instaló. Yo estaba viendo un mensaje de error de la siguiente manera,

user-name-rajas-macbook-pro:rails3 user-namer$ gem install sqlite3 
Building native extensions. This could take a while... 
    ERROR: Error installing sqlite3: 
    ERROR: Failed to build gem native extension. 

     /Users/user-namer/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb 
checking for sqlite3.h... yes 
checking for sqlite3_libversion_number() in -lsqlite3... no 
sqlite3 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 
    --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=/Users/user-namer/.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 
    --with-sqlite3lib 
    --without-sqlite3lib 


Gem files will remain installed in /Users/user-namer/.rvm/gems/ruby-1.9.2- [email protected]_3/gems/sqlite3-1.3.3 for inspection. 
Results logged to /Users/user-namer/.rvm/gems/[email protected]_3/gems/sqlite3- 1.3.3/ext/sqlite3/gem_make.out 

Esto es lo que funcionó para mí

gem install sqlite3 -- --with-sqlite3-dir=/opt/local 
+0

Gracias por esto, me costó muchísimo descifrar esto. – adriandz

+0

gracias, esto funcionó para mí en freeBSD también! – Tiago

+0

Muchas gracias, esto ahorró otras horas de agonía! – Wasabi

6

estaba siguiendo el libro Rails3 en acción con RVM usando rubí 1.9.2.p180 y carriles 3.1. 0.rc6 usando Mac OS X 10.5.8 (Leopard) y cuando me encontré:

rake cucumber:ok 

llegué:

Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (can't activate sqlite3 (~> 1.3.4, runtime), already activated sqlite3-1.3.3. Make sure all dependencies are added to Gemfile.) 

luego hice:

gem install sqlite3 -- --with-sqlite3-dir=/opt/local 

seguido de:

bundle install 

suerte, voy a encontrar mi propia respuesta en Internet cuando se requiere SQLite 1.3.5.

2

Para osx, asegúrese de tener Xcode instalado y de haber aceptado los términos. Para mí, no había aceptado los términos (por alguna razón, tal vez Xcode se instaló o actualizó recientemente en mi computadora).

  1. Abra Xcode
  2. Si un pop-up aparece a continuación, de acuerdo con los términos (si no obtiene un pop-up, entonces probablemente ya han aceptado los términos).
Cuestiones relacionadas