Ubuntu 上 sqlite3-ruby 安装错误

发布于 2024-09-13 20:35:11 字数 1521 浏览 6 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

尾戒 2024-09-20 20:35:11

您需要 Gem 的本机扩展的 SQLite3 开发标头进行编译。您可以通过运行(可能使用 sudo)来安装它们:

apt-get install libsqlite3-dev

You need the SQLite3 development headers for the gem’s native extension to compile against. You can install them by running (possibly with sudo):

apt-get install libsqlite3-dev
唠甜嗑 2024-09-20 20:35:11

你只需要一个 -- 在那里。

sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include

这指定选项不是直接gem,而是特定的gem。

You just need a -- in there.

sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include

That specifies that the option is not to gem directly, but the specific gem.

汹涌人海 2024-09-20 20:35:11

就我而言,我没有安装基本编译器,所以

sudo apt-get install build-essential

解决了我的问题,但对于大多数人来说,我认为 https://stackoverflow.com/ a/3649005/417267 是解决方案。

In my case I have no basic compilers installed, so

sudo apt-get install build-essential

solved my problem, but for most the people I think https://stackoverflow.com/a/3649005/417267 is the solution.

慢慢从新开始 2024-09-20 20:35:11

这就是我所做的:

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

来自: http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/

This is what I did:

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

from : http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/

り繁华旳梦境 2024-09-20 20:35:11

如果您在 ubuntu 中运行,并使用 RVM for ruby​​ on Rails,请首先添加:

sudo apt-get install libxslt-dev libxml2-dev

或者您可以使用以下命令进行检查:

此命令将为您准备两个包:sqllite3 和 libsqlite3-dev

sudo apt-get install sqlite3
libsqlite3-dev

- 现在,安装 sqlite gem

 [sudo] gem install sqlite3-ruby

- 使用 Ubuntu 不需要 sudo。

祝你好运!注意:我使用的是 Ubuntu 10.10,它可以正常工作。

If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:

sudo apt-get install libxslt-dev libxml2-dev

OR You can check with these commands:

This command will prepare for you two packages : sqllite3 and libsqlite3-dev

sudo apt-get install sqlite3
libsqlite3-dev

-Now,install sqlite gem

 [sudo] gem install sqlite3-ruby

-using Ubuntu doesn't need sudo.

Goodluck! Note: i'm using Ubuntu 10.10 and it's working.

朱染 2024-09-20 20:35:11

这足以使其工作

sudo apt-get install libsqlite3-dev

感谢 marshluca

This was simply enough to make it work

sudo apt-get install libsqlite3-dev

Thanks to marshluca

谁的年少不轻狂 2024-09-20 20:35:11

尝试了所有其他解决方案,但没有任何帮助。

事实证明,您还需要 ruby​​ 本身的开发包。对我来说,它有帮助,

sudo apt-get install ruby-full

虽然它有很多令人讨厌的依赖项(比如 emacs,wtf?),但

sudo apt-get install ruby1.8-dev

应该没问题。安装后(并且安装了 sqlite 和 sqlite-dev 软件包)后,

sudo gem install sqlite3-ruby

它就像一个魅力。

Tried ALL of other solutions, none helped.

It turned out that you also need dev package for ruby itself. For me, it helped

sudo apt-get install ruby-full

It has a lot of nasty dependencies though (like emacs, wtf?), just

sudo apt-get install ruby1.8-dev

should be fine. After it's installed (and you have the sqlite and sqlite-dev packages installed)

sudo gem install sqlite3-ruby

works like a charm.

北陌 2024-09-20 20:35:11

来自sqlite3-ruby gem在ubuntu上找不到sqlite3.h

您还需要安装 gcc 本身,所以总共会是:

sudo apt-get install gcc libsqlite3-dev ruby1.8-dev
sudo gem install sqlite3

显然,当实际问题是缺少 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:

sudo apt-get install gcc libsqlite3-dev ruby1.8-dev
sudo gem install sqlite3

Apparently you get a wrong error pointing to a missing sqlite3.h when the actual problem is missing gcc itself.

随梦而飞# 2024-09-20 20:35:11

这是 HEROKU - 无法运行 git push heroku master< 的更好答案/a>

由于您无法在 heroku 上使用 sqlite3,因此将其添加到您的 Gemfile 中:

group :production do
  gem 'pg'
end
group :development, :test do
  gem 'sqlite3'
end

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:

group :production do
  gem 'pg'
end
group :development, :test do
  gem 'sqlite3'
end
温柔女人霸气范 2024-09-20 20:35:11

解决方案是添加 --configure 参数与 gem 参数分开。

不要

sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include

尝试这个,全部在一行上,请确保在最后一个 gem 参数之后和 configure 参数之前包含 --

sudo gem install sqlite3 --
--with-sqlite3-lib=/somewhere/local/lib
--with-sqlite3-include=/somewhere/local/include

这应该得到你遇到这个错误:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-sqlite3-include=/usr/include

The solution is to add -- to separate configure parameters from gem parameters.

instead of

sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include

try this, all on one line, make sure to include -- after the last gem parameter and before configure parameters:

sudo gem install sqlite3 --
--with-sqlite3-lib=/somewhere/local/lib
--with-sqlite3-include=/somewhere/local/include

This should get you around this error:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-sqlite3-include=/usr/include
转角预定愛 2024-09-20 20:35:11

遇到了同样的问题,以下方法对我有用:

将 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

把梦留给海 2024-09-20 20:35:11

即使安装了 ruby​​2.5-dev 和 libsqlite3-dev 后,上述解决方案都不适合我。然后尝试使用 PostgreSql 而不是 sqlite。效果很好。要使用 PostgreSql 而不是 sqlite,请在创建 Rails 项目时使用此命令。

rails [_VERSION_] new project_name -d postgresql

如果您想使用MySql,请使用mysql而不是postgresql

rails [_VERSION_] new project_name -d mysql

否则你可以尝试不使用sqlite

bundle install --without sqlite

None of the above mentioned solution worked for me, even after installing ruby2.5-dev and libsqlite3-dev. Then tried using PostgreSql instead of sqlite. That worked fine. To use PostgreSql instead of sqlite use this command when creating rails project.

rails [_VERSION_] new project_name -d postgresql

If you want to use MySql then use mysql instead of postgresql.

rails [_VERSION_] new project_name -d mysql

Else you can try without sqlite.

bundle install --without sqlite
花期渐远 2024-09-20 20:35:11

不是 --without-sqlite3-include=/usr/include,而是 --with-sqlite3-include=/usr/include

Not --without-sqlite3-include=/usr/include, but --with-sqlite3-include=/usr/include.

随风而去 2024-09-20 20:35:11

这与我几周前遇到的问题完全相同。我发现我需要从 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!

单调的奢华 2024-09-20 20:35:11

对我来说,这个问题是通过获取 mkmf 解决的,它位于 ruby​​1.8-dev 中。

sudo apt-get install ruby1.8-dev

感谢 mentalized 的帮助。

For me the problem was solved by getting mkmf, which is in ruby1.8-dev.

sudo apt-get install ruby1.8-dev

Thanks to mentalized for that one.

东走西顾 2024-09-20 20:35:11

我同意 Danya VershininEnotionZ

如果无法使用 apt-get:

  1. compile &通过指定您自己的“前缀”路径从源安装 sqlite3。
    更多信息可以在自述文件中找到。
  2. 然后将此路径传递给 sqlite3-ruby 安装程序(不要忘记“--”)。

I agree with Danya Vershinin & EnotionZ.

If can't use apt-get:

  1. compile & install sqlite3 from sources by specifying your own "prefix" path.
    More information can be found in the README.
  2. Then passed this path to the sqlite3-ruby installer (don't forget the "--").
極樂鬼 2024-09-20 20:35:11

您的 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

謸气贵蔟 2024-09-20 20:35:11

忘记一切并执行此操作,

对于 rhel运行

yum install ruby-devel sqlite sqlite-devel ruby-rdoc
yum install make gcc
gem install sqlite3-ruby
bundle install

That,对于 ubuntu 运行相同。

Forget everything and do this,

run

yum install ruby-devel sqlite sqlite-devel ruby-rdoc
yum install make gcc
gem install sqlite3-ruby
bundle install

That's for rhel, run same for ubuntu.

姜生凉生 2024-09-20 20:35:11

我刚刚降级到 sqlite3-ruby '1.2.2'

I just downgraded to sqlite3-ruby '1.2.2'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文