sqlite3 gem无法安装 [英] sqlite3 gem fails to install

查看:175
本文介绍了sqlite3 gem无法安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在OS X 10.6上安装sqlite3-rubygem(或sqlite3gem)。我使用的是ruby-1.9.2,现在我得到了以下内容:

$ $ p $ $ $ $ c $ $ sqlite3 --version
3.7 .4
$ sudo gem install sqlite3
构建本机扩展。这可能需要一段时间...
错误:安装sqlite3-ruby时出错:
错误:无法构建gem本机扩展。

/Users/folken/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb
检查sqlite3.h ... *** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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:在`try_do'中:编译器未能生成可执行文件。 (RuntimeError)
您必须先安装开发工具。来自/ Users / folken的/Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in`try_cpp'
中的
/.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:在`block in checking_for'
from /Users/folken/.rvm/rubies/ruby-1.9.2-head/ lib / ruby​​ / 1.9.1 / mkmf.rb:280:在`block(2 levels)推迟'
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:在`block in postpone'
from /Users/folken/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in`open'$ b / b 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:位于/Users/folken/.rvm/rubies/ruby-1.9的`checking_for'
中。 2头/ LIB / ruby / 1.9.1 / mkmf.rb:852:在`find_header'中
from extconf.rb:28:在< main>中


Gem文件将保留安装在/Users/folken/.rvm/gems/ruby-1.9.2-head/gems/sqlite3-1.3.3中进行检查。

以下是其中& whereis和sqlite3.h位于/ opt / local / include:

  $哪个sqlite3 
/ opt / local / bin / sqlite3
$ whereis sqlite3
/ usr / bin / sqlite3

我也试过传递以下内容:

  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



结果如下:

 错误:安装sqlite3-ruby时出错:
错误:无法构建gem原生扩展。

/Users/folken/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with-sqlite3-dir / usr / bin / sqlite3
* ** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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>'

Users / folken / .rvm / gems / ruby​​-1.9.2-head / gems:
sqlite-ruby-2.2.3
sqlite3-1.3.3


在RVM下,我有ruby-1.8.7,sqlite3 gem加载的很好,但经过大量的搜索,我还没有找到适合我的解决方案。任何帮助非常感谢(即使它涉及到手动安装/ hackery工作)。

因为你在那里我已经安装了sqlite3,但sqlite3宝石不会安装。我看到一条错误消息如下,

  user-name-rajas-macbook-pro:rails3 user-namer $ gem install sqlite3 
构建原生扩展。这可能需要一段时间...
错误:安装sqlite3时出错:
错误:无法构建gem本机扩展。

/Users/user-namer/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
检查sqlite3.h ...是
在-lsqlite3中检查sqlite3_libversion_number()...没有
sqlite3丢失。尝试使用'port install sqlite3 + universal'
或'yum install sqlite3-devel'并检查共享库搜索路径(sqlite3共享库所在的
位置)。
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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文件将保留安装在/Users/user-namer/.rvm/gems/ruby-1.9.2-p180@rails_3/gems/sqlite3-1.3.3以供检查。
结果记录到/Users/user-namer/.rvm/gems/ruby-1.9.2-p180@rails_3/gems/sqlite3- 1.3.3 / ext / sqlite3 / gem_make.out
code>

以下是我的工作成果

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


I'm trying to install the "sqlite3-ruby" gem (or the "sqlite3" gem) on OS X 10.6. I'm using ruby-1.9.2 and I currently get the following:

 $ 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.

The following is the results of which & whereis, and the sqlite3.h is located in /opt/local/include:

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

I've tried passing in the following as well:

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

which results in the following:

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>'

Also under /Users/folken/.rvm/gems/ruby-1.9.2-head/gems: sqlite-ruby-2.2.3 sqlite3-1.3.3

Under RVM I have ruby-1.8.7 and the sqlite3 gem loads fine on that, but after much googling I have not found a solution that works for me. Any help is greatly appreciated (even if it involves manual installation / hackery to get working).

解决方案

I had an almost similar problem as you where I had sqlite3 installed and yet the sqlite3 gem would not install. I was seeing an error message as follows,

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-    p180@rails_3/gems/sqlite3-1.3.3 for inspection.
Results logged to /Users/user-namer/.rvm/gems/ruby-1.9.2-p180@rails_3/gems/sqlite3-    1.3.3/ext/sqlite3/gem_make.out

Here is what worked for me

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

这篇关于sqlite3 gem无法安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆