Ubuntu 上 sqlite3-ruby 安装错误
我在 sqlite3-ruby 安装过程中出现以下错误:
Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel' *** 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/bin/ruby1.8 --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 /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
sqlite3.h 位于 /usr/include/
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
无法正常工作
ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --without-sqlite3-include=/usr/include
Ubuntu 10.04
I have the following error during sqlite3-ruby install:
Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel' *** 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/bin/ruby1.8 --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 /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
sqlite3.h is located in /usr/include/
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
doesn't work
ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --without-sqlite3-include=/usr/include
Ubuntu 10.04
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(19)
您需要 Gem 的本机扩展的 SQLite3 开发标头进行编译。您可以通过运行(可能使用
sudo
)来安装它们:You need the SQLite3 development headers for the gem’s native extension to compile against. You can install them by running (possibly with
sudo
):你只需要一个
--
在那里。这指定选项不是直接gem,而是特定的gem。
You just need a
--
in there.That specifies that the option is not to gem directly, but the specific gem.
就我而言,我没有安装基本编译器,所以
解决了我的问题,但对于大多数人来说,我认为 https://stackoverflow.com/ a/3649005/417267 是解决方案。
In my case I have no basic compilers installed, so
solved my problem, but for most the people I think https://stackoverflow.com/a/3649005/417267 is the solution.
这就是我所做的:
来自: http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/
This is what I did:
from : http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/
如果您在 ubuntu 中运行,并使用 RVM for ruby on Rails,请首先添加:
或者您可以使用以下命令进行检查:
此命令将为您准备两个包:sqllite3 和 libsqlite3-dev
- 现在,安装 sqlite gem
- 使用 Ubuntu 不需要 sudo。
祝你好运!注意:我使用的是 Ubuntu 10.10,它可以正常工作。
If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:
OR You can check with these commands:
This command will prepare for you two packages : sqllite3 and libsqlite3-dev
-Now,install sqlite gem
-using Ubuntu doesn't need sudo.
Goodluck! Note: i'm using Ubuntu 10.10 and it's working.
这足以使其工作
感谢 marshluca
This was simply enough to make it work
Thanks to marshluca
尝试了所有其他解决方案,但没有任何帮助。
事实证明,您还需要 ruby 本身的开发包。对我来说,它有帮助,
虽然它有很多令人讨厌的依赖项(比如 emacs,wtf?),但
应该没问题。安装后(并且安装了 sqlite 和 sqlite-dev 软件包)后,
它就像一个魅力。
Tried ALL of other solutions, none helped.
It turned out that you also need dev package for ruby itself. For me, it helped
It has a lot of nasty dependencies though (like emacs, wtf?), just
should be fine. After it's installed (and you have the sqlite and sqlite-dev packages installed)
works like a charm.
来自sqlite3-ruby gem在ubuntu上找不到sqlite3.h :
您还需要安装 gcc 本身,所以总共会是:
显然,当实际问题是缺少 gcc 本身时,您会收到一个指向缺少 sqlite3.h 的错误错误。
From sqlite3-ruby gem can't find sqlite3.h on ubuntu:
You also need to install gcc itself, so in total it would be:
Apparently you get a wrong error pointing to a missing sqlite3.h when the actual problem is missing gcc itself.
这是 HEROKU - 无法运行 git push heroku master< 的更好答案/a>
由于您无法在 heroku 上使用 sqlite3,因此将其添加到您的 Gemfile 中:
Here's a better answer from HEROKU - cannot run git push heroku master
Since you can't use sqlite3 on heroku add this to your Gemfile:
解决方案是添加
--
将configure
参数与gem
参数分开。不要
尝试这个,全部在一行上,请确保在最后一个
gem
参数之后和configure
参数之前包含--
:这应该得到你遇到这个错误:
The solution is to add
--
to separateconfigure
parameters fromgem
parameters.instead of
try this, all on one line, make sure to include
--
after the lastgem
parameter and beforeconfigure
parameters:This should get you around this error:
遇到了同样的问题,以下方法对我有用:
将 sqlite3 编译为静态库,安装在主目录中的某个位置,然后为 gem 安装过程提供该选项。
转到下载页面并获取源代码。目前最新版本是 http://www.sqlite.org/sqlite- autoconf-3070400.tar.gz
tar -xf 文件或执行任何您通常执行的解压缩操作;进入目录
./configure --disable-shared --enable-static --prefix=/some/path/in/my/home
编译、安装,当你安装 gem...
gem install sqlite3-ruby - - --with-sqlite3-dir=/some/path/in/my/home
Had this same problem and the following worked for me:
compile sqlite3 as static library, install somewhere in your home directory and then provide that option for the gem install process.
Go to the download page and grab the source. Most recent version at this time is http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz
tar -xf on the file or do whatever you normally do to uncompress; enter directory
./configure --disable-shared --enable-static --prefix=/some/path/in/my/home
compile, install, and when you're installing the gem...
gem install sqlite3-ruby -- --with-sqlite3-dir=/some/path/in/my/home
即使安装了 ruby2.5-dev 和 libsqlite3-dev 后,上述解决方案都不适合我。然后尝试使用
PostgreSql
而不是sqlite
。效果很好。要使用 PostgreSql 而不是 sqlite,请在创建 Rails 项目时使用此命令。如果您想使用
MySql
,请使用mysql
而不是postgresql
。否则你可以尝试不使用
sqlite
。None of the above mentioned solution worked for me, even after installing
ruby2.5-dev
andlibsqlite3-dev
. Then tried usingPostgreSql
instead ofsqlite
. That worked fine. To usePostgreSql
instead of sqlite use this command when creatingrails
project.If you want to use
MySql
then usemysql
instead ofpostgresql
.Else you can try without
sqlite
.不是
--without-sqlite3-include=/usr/include
,而是--with-sqlite3-include=/usr/include
。Not
--without-sqlite3-include=/usr/include
, but--with-sqlite3-include=/usr/include
.这与我几周前遇到的问题完全相同。我发现我需要从 SQLite 下载页面下载最新的标头/库。尝试一下,希望这有帮助!
This is the exact same problem I had a few weeks ago. I found out I needed to download the most recent headers/libraries from the SQLite Download Page. Try it out, hope this helps!
对我来说,这个问题是通过获取 mkmf 解决的,它位于 ruby1.8-dev 中。
感谢 mentalized 的帮助。
For me the problem was solved by getting mkmf, which is in ruby1.8-dev.
Thanks to mentalized for that one.
我同意 Danya Vershinin 和EnotionZ。
如果无法使用 apt-get:
更多信息可以在自述文件中找到。
I agree with Danya Vershinin & EnotionZ.
If can't use apt-get:
More information can be found in the README.
您的 RVM 版本已损坏。 Ubuntu 对 RVM 做了一些操作,产生了大量错误,目前唯一安全的修复方法是: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … ,如果它没有帮助然后重新启动计算机。安装 RVM:\curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles 如果您发现需要一些帮助,请查看在 Ubuntu 12.04 上安装 Ruby,其中提供了更多说明
You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … , if it does not help then restart your computer. install RVM: \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanat
忘记一切并执行此操作,
对于 rhel运行
That,对于 ubuntu 运行相同。
Forget everything and do this,
run
That's for rhel, run same for ubuntu.
我刚刚降级到 sqlite3-ruby '1.2.2'
I just downgraded to sqlite3-ruby '1.2.2'