安装 sqlite3-ruby 时出现问题!

发布于 2024-09-13 19:23:47 字数 1334 浏览 1 评论 0原文

我在 crunchbang linux 上安装 sqlite3-ruby gem 时遇到问题。在谷歌搜索了过去几个小时并关注了几个遇到同样问题的人之后,我仍然没有让它工作。

这是我在尝试“sudo gem install sqlite3-ruby”

构建本机扩展后看到的内容。这可能需要一段时间...
错误:安装 sqlite3-ruby 时出错:
错误:无法构建 gem 本机扩展。

/usr/bin/ruby1.8 extconf.rb
检查 sqlite3.h...是
检查 -lsqlite3 中的 sqlite3_libversion_number()...是
检查 rb_proc_arity()...否
检查 sqlite3_initialize()...否
sqlite3-ruby仅支持sqlite3版本3.6.16+,请升级!
* extconf.rb 失败 *
由于某种原因无法创建 Makefile,可能缺少
必要的库和/或标头。检查 mkmf.log 文件了解更多信息
细节。您可能需要配置选项。

接下来我浏览了这个页面; http://groups.google.com/group /sqlite3-ruby/browse_thread/thread/f22d098b561c48af/6e754f7b2fc3cd75?#6e754f7b2fc3cd75

我下载了 sqlite-amalgamation-3.7.0.1.tar.gz 并发出以下命令:

tar zxvf sqlite-amalgamation-3.7.0.1.tar。广州
cd cd sqlite-3.7.0.1
mkdir $HOME/sqlite
./configure --prefix=$HOME/sqlite
制作&&进行安装
sudo gem install sqlite3-ruby -- --with-sqlite3-dir=$HOME/sqlite

但是,我仍然得到完全相同的错误。我已经使用了“sudo apt-get install sqlite3 libsqlite3-dev”,但我仍然遇到完全相同的错误。

有什么建议吗?

顺便说一句,为什么当我使用“sudo apt-get install sqlite3”时,它会获取 3.5.9 而不是我手动下载的 3.7.0.1?

I'm having issues installing the sqlite3-ruby gem on crunchbang linux. After googling the past few hours and following several people with the same problem, I still haven't gotten it to work.

Here is what I see after trying a 'sudo gem install 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... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
* 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.

Next I ran across this page;
http://groups.google.com/group/sqlite3-ruby/browse_thread/thread/f22d098b561c48af/6e754f7b2fc3cd75?#6e754f7b2fc3cd75

I downloaded sqlite-amalgamation-3.7.0.1.tar.gz and issued the following commands:

tar zxvf sqlite-amalgamation-3.7.0.1.tar.gz
cd cd sqlite-3.7.0.1
mkdir $HOME/sqlite
./configure --prefix=$HOME/sqlite
make && make install
sudo gem install sqlite3-ruby -- --with-sqlite3-dir=$HOME/sqlite

However, I still get the exact same error. I've used 'sudo apt-get install sqlite3 libsqlite3-dev' but I still get the exact same error.

Any advice?

And as a small aside, how come when I use 'sudo apt-get install sqlite3', it grabs 3.5.9 instead of the 3.7.0.1 I manually downloaded?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(7

來不及說愛妳 2024-09-20 19:23:47

安装较低版本的 sqlite3-ruby 应该可以解决您的问题:

sudo gem install sqlite3-ruby --version=1.2.5

Install a lower version of sqlite3-ruby should resolve your problem:

sudo gem install sqlite3-ruby --version=1.2.5
嘦怹 2024-09-20 19:23:47

这是因为在组合 Makefile 之前测试函数时 extconf.rb 选择了旧的 3.5.9 库。

缩短这个时间的一种解决方案是 apt-get 删除 sqlite3 并重试

sudo gem install sqlite3-ruby -- --with-sqlite3-dir=$HOME/sqlite

如果您想使用 sqlite3 命令行二进制文件,这可能会避免不兼容问题。

另一个解决方案是将新的 ~/sqlite/lib/libsqlite3.a 复制到 gem 的构建目录中(请参阅 gem env,例如 gems/sqlite3-ruby-1.3.1/ext/sqlite3)并重试

sudo gem install sqlite3-ruby

测试应该选择现在就建立你的新库并安装好。

This is due to extconf.rb picking up your old 3.5.9 library when testing for functions before putting together the Makefile.

One solution to cut this short is to apt-get remove sqlite3 and retry

sudo gem install sqlite3-ruby -- --with-sqlite3-dir=$HOME/sqlite

This may save you from incompatibilities if you want to use sqlite3 command line binary.

Another solution is to copy your new ~/sqlite/lib/libsqlite3.a into the build directory of your gem (see gem env, something like gems/sqlite3-ruby-1.3.1/ext/sqlite3) and retry

sudo gem install sqlite3-ruby

The test should pick up your new library now and install fine.

梦与时光遇 2024-09-20 19:23:47

根据 sqlite3-ruby(现在名为 sqlite3)README.rdoc,您可以使用以下方法定向到正确的库:

如果您在非标准位置安装了 sqlite3,您可以指定
include 和 lib 的位置
通过执行以下操作来创建文件:

gem install sqlite3 -- --with-sqlite3-include=/opt/local/include \

--with-sqlite3-lib=/opt/local/lib

Per the sqlite3-ruby (now named sqlite3) README.rdoc, you can use the following method to direct to the correct libraries:

If you have sqlite3 installed in a non-standard location, you can specify
the location of the include and lib
files by doing:

gem install sqlite3 -- --with-sqlite3-include=/opt/local/include \

--with-sqlite3-lib=/opt/local/lib

时光无声 2024-09-20 19:23:47

肖恩,让我试着详细说明一下。

Ruby 通过编译小示例并验证编译是否成功来适应 sqlite3 库。这将使用旧的库,其中不包含所需的功能。

第一个解决方案是删除旧库并将 ruby​​ 定向到您下载新版本的目录。根据您使用的系统,您必须选择正确的软件包管理器:apt-get、dpkg、yum、yast、ipkg...以删除过时的软件包。这可以确保您的构建不会拾取任何旧部件。然后,您必须确保使用 --with-sqlite3-dir 选项将 ruby​​ 指向新库所在的正确目录。

第二种解决方案是一种 hack。它依赖于 C 编译器先于其他目录选取当前目录中的文件。您可以使用 cp、mc 或任何其他文件管理器将 .a 库和 .h 标头复制到构建目录。构建应该没问题,但是您的 sqlite3 命令仍然是旧命令,可能与使用新库创建的数据库不兼容。

HTH,贾里克

Shawn, let me try to elaborate.

Ruby is adapting to the sqlite3 library by compiling petty examples and verifying if compile was successfull. This picks up the old library, which does not include the required functions.

The first solution is to remove the old library and to direct ruby to the directory you downloaded the new version to. Depending on the system you are using you have to choose the right package manager: apt-get, dpkg, yum, yast, ipkg, ... to remove the obsolete package. This makes sure your build is not picking up any old pieces. Then you have to make sure you are pointing ruby to the right directory where the new library is located with --with-sqlite3-dir option.

The second solution is a kind of a hack. It relies on C compiler picking up the files in the current directory before the others. You can use cp, mc, or any other file manager to copy the .a libraries and .h headers to the build directory. The build shoud be ok, but your sqlite3 command will still be the old one, possibly incompatible with the databases created with your new library.

HTH, Jarek

牵你手 2024-09-20 19:23:47

我遇到了类似的问题 - 我只是将项目目录中的 ./Gemfile 中的以下烦人的行注释掉为:

# gem 'sqlite3-ruby', :require => 'sqlite3'

并执行:

bundle install

script/rails 服务器再次正常工作。唷!

似乎 sqlite3 是重复的 - 奇怪

I had a similar issue - I simply commented out the following annoying line from ./Gemfile in the project directory to:

# gem 'sqlite3-ruby', :require => 'sqlite3'

and did:

bundle install

script/rails server was working fine again. Phew!

Seems like sqlite3 is duplicated - weird

凡间太子 2024-09-20 19:23:47

我在 OSX 10.5.8 上遇到了同样的问题

解决方案非常简单:

1.-从 Apple dev 下载 Xcode:xcode314_2809_developerdvd.dmg(需要注册)
2.- 下载并安装 macports: http://distfiles.macports .org/MacPorts/MacPorts-1.9.2-10.5-Leopard.dmg
3.- sudo port install sqlite3

一切都按预期工作。

希望这个结果有用!

I ran into the same issue on OSX 10.5.8

The solutions was pretty simple:

1.- Xcode downloaded from apple dev.: xcode314_2809_developerdvd.dmg (require registration)
2.- Download and install macports: http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.5-Leopard.dmg
3.- sudo port install sqlite3

And Everything was working as intended.

Hope this result useful!

各空 2024-09-20 19:23:47

我遇到了完全相同的问题。当我将所有文件(不仅仅是 libsqlite3.a)从 ~/sqlite/lib 移动到 gems/sqlite3-ruby-1.3.1 时,Jarek 的解决方案起作用了/ext/sqlite3

I had the exact same problem. Jarek's solution worked when I moved all of the files (not just libsqlite3.a) from ~/sqlite/lib to gems/sqlite3-ruby-1.3.1/ext/sqlite3.

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