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

查看:120
本文介绍了为什么我不能安装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实际上并不是Ruby Gem,它是一个 C Gem,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 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天全站免登陆