让Ruby on Rails环境工作并安装sqlite3 [英] Getting Ruby on Rails environment working and installing sqlite3

查看:469
本文介绍了让Ruby on Rails环境工作并安装sqlite3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试升级到最新版本的Ruby on Rails。

  C:\ Users \benjaminw> ruby​​ --version 
ruby​​ 2.0.0p0(2013-02-24)[x64-mingw32]

C:\Users\benjaminw> rails -v
Rails 3.2.13

我遵循Ruby on Rails书籍的教学指南,但它有点过时。下一步说下载sqlite3数据库并将这些文件解压到以下文件夹C:/ Ruby200 / bin

然后运行以下命令以确保数据库是正确安装

  C:\ Users \benjaminw> sqlite3 --version 
3.7.16 2013-03- 18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90

这是问题出现的地方。当我输入下一个命令时,我得到一个错误,看起来正确设置环境很重要。有谁知道以下的含义以及如何解决它?哦,我在我的Windows 7电脑上安装了这个版本的开发包DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe。

  C:\ Users \benjaminw> gem install sqlite3-ruby 
临时增强PATH以包含DevKit ...
构建本机扩展。这可能需要一段时间...
错误:安装sqlite3-ruby时出错:
错误:无法构建gem本机扩展。

C:/Ruby200/bin/ruby.exe extconf.rb
检查sqlite3.h ...没有
sqlite3.h丢失。首先从http://www.sqlite.org/安装SQLite3。
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。

提供的配置选项:
--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 = C:/ Ruby200 / bin / ruby​​
--with-sqlite3-dir
--without-sqlite3-dir
- -with-sqlite3-include
--without-sqlite3-include = $ {sqlite3-dir} / include
--with-sqlite3-lib
--without-sqlite3-lib = $ {sqlite3-dir} /
--enable-local
--disable -local


Gem文件将保持安装在C:/ Ruby200 / lib / ruby /gems/2.0.0/gems/sqlite3-1
.3.7进行检查。
记录到C的结果:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out
/ p>

解决方案



转到以下网址,让这个问题摆脱了下一步编译通过预编译的其他Rails 4 gems希望使用Windows的Rubyists:此链接

使用 -with-opt-dir =< Sqlite.3 bin,lib,include和share文件夹的路径> 命令。唯一棘手的部分是官方sqlite3网站提供的文件是预编译的,这可能是非常难以考虑的问题。



如果您在使用Ruby 2.0和Rails 4.0.0.0beta1时遇到麻烦,我可以给您进一步说明。



对于您现在使用Sqlite3和Rails,在Windows上使用Ruby 2.0应该是完全正确的。请注意避免使用Rails 4.0.0beta1中的Ruby 2.0 64位,因为Rails 4的一个依赖项将错误地标记为您的计算机的cpu与其gem需求不兼容;这很快就会得到解决。



编辑:注意我并没有像我更明确的说明那样有帮助;已经提供了一个已经花时间这样做的人以及需要启动和运行的文件的链接。

@Brian Petro:实际上,如果您知道一天结束时Gems和.h文件在构建时如何工作,那么解决这个问题很容易。这个问题根源于Ruby 2.0如何处理一些 gem;从Ruby 2.0预编译的宝石开始,如果它们有ABI Breakage,那么对于以前版本的Ruby来说很方便; Sqlite3宝石是其中之一:


Trying to upgrade to the latest version of Ruby on Rails. I got ruby and rails installed ok (I think).

C:\Users\benjaminw>ruby --version
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

C:\Users\benjaminw>rails -v
Rails 3.2.13

I'm following an instructional guide out of a Ruby on Rails book but it's a little out of date. The next step says to download the sqlite3 db and extract the the files to the following folder C:/Ruby200/bin

Then run the following command to make sure the db was installed correctly

C:\Users\benjaminw>sqlite3 --version
3.7.16 2013-03-18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90

Here is where the problem arises. When I enter the next command I get an ERROR and it seems like it's important to setting up the environment properly. Does anyone know what the following means and how to fix it? Oh and I installed this version of the devkit on my windows 7 computer DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe.

C:\Users\benjaminw>gem install sqlite3-ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

C:/Ruby200/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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=C:/Ruby200/bin/ruby
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/
    --enable-local
    --disable-local


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1
.3.7 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out

解决方案

I absolutely have had no problems with Ruby 2.0 and SQLite as a result of compiling SQLITE.h

Solution

Go the following URL to have this issue squared away by someone who took the next step of compiling the gem over the pre-compiled gems for other Rails 4 Rubyists who wish to use Windows: this link.

With a command like -with-opt-dir=<Path of Sqlite.3 bin, lib, include, and share folders> command. The only tricky part was the files the official sqlite3 website provides are precompiled, which can be extremely hard to consider that being the problem.

I can give you further instructions if you still have any trouble doing such actions towards using Ruby 2.0 and Rails 4.0.0.0beta1.

Using Ruby 2.0 with Windows should be perfectly fine for you now regarding Sqlite3 and Rails. Do note to avoid Ruby 2.0 64-bit when it comes to Rails 4.0.0beta1 because one of the dependent gems for Rails 4 flags incorrectly that the cpu of your computer is not compatible with its gem requirements; that's being resolved soon.

Edit: Noticed I wasn't as helpful as I should have with more explicit instructions; Have provided you a link by someone who's already taken the time to do so and the files needed to get up and running.

@Brian Petro : Actually, solving this issue is easy if you know how Gems and .h files at the end of the day works sometimes with the construction of them. The issue is rooted from how some gems are handled with Ruby 2.0; starting with Ruby 2.0 precompiled gems that were convenient for previous versions of Ruby won't work if they have ABI Breakage; Sqlite3 gem is one of them:

这篇关于让Ruby on Rails环境工作并安装sqlite3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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