为什么我不能安装 SQLite gem? [英] Why can't I install the SQLite gem?

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

问题描述

我尝试在带有 Ruby 1.8.6、Rails 2.2.2、gem 1.3 和 sqlite-3.5.9 的 Fedora 9 Linux 机器上安装 SQLite gem.这是我正在运行的命令及其结果:

I'm try to install the SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results:

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/ruby extconf.rb install sqlite3-ruby
can't find header files for ruby.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

gem_make.out 只是重复已经发送到控制台的内容.我该如何安装这个 gem?

gem_make.out just repeats what was already sent to the console. How can I install this gem?

推荐答案

SQLite RubyGem 实际上不是 RubyGem,而是CGem",IOW它是用 C 编写的.这意味着它必须在安装时编译并链接到 Ruby 解释器,为了做到这一点,它需要 Ruby 解释器的 C 头文件.

The SQLite RubyGem isn't actually a RubyGem, it's a "CGem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.

如果你自己编译 Ruby,这些头文件会自动安装,但是,在 RedHat-ish 系统中,这些头文件通常打包在一个单独的包中,称为 <whatever>-dev.因此,在这种情况下,您需要安装 ruby-dev 包,可能还需要安装 libsqlite3-dev (Ubuntu) 或 sqlite-devel (Fedora) 包也是如此.

If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.

但是,您最好只安装操作系统的预打包 libsqlite3-ruby 包,这样所有依赖项都会自动得到满足.

However, you might be better off just installing your Operating System's pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.

(注意:所有的包名都是凭空而来的,在你的系统上可能会有所不同.)

(Note: all package names pulled out of thin air, might be different on your system.)

这篇关于为什么我不能安装 SQLite gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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