Rails 3.1应用程序无法安装sqlite3 gem,因为库已过期 [英] Rails 3.1 app can't install sqlite3 gem because libraries are out of date
问题描述
CentOS 5.6上安装的最新SQLite3库是版本3.3.6。这是我的理解,sqlite3 gem需要版本3.6或更高版本。
The latest SQLite3 library available on CentOS 5.6 and which is installed is version 3.3.6. It's my understanding that the sqlite3 gem needs version 3.6 or higher.
如何让我的应用程序使用SQLite3而不升级我的服务器上的库?
How do I get my app to work with SQLite3 without upgrading the library on my server? It's in a work environment and I'm simply not allowed to upgrade it.
推荐答案
您可以编译版本的静态库的sqlite。然后安装sqlite3 gem并引用您的新静态库。
You could compile a static library of the version of sqlite you require. Then install the sqlite3 gem with a reference to your new static library.
虽然我没有测试这个程序,我可以看到过程是...
While I haven't tested this procedure, I could see the process being...
1。 下载并解压缩SQLite源码。
1. Download and extract the SQLite source in a new directory.
mkdir $HOME/sqlite3.7.7.1
cd $HOME/sqlite3.7.7.1
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar -zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
2。
./configure --disable-shared --enable-static --prefix=$HOME/sqlite3.7.7.1
make && make install
3.A。 (选项1)安装SQLite gem并引用您的新静态库。
gem install sqlite3 --with-sqlite3-dir=$HOME/sqlite3.7.7.1
3.B。 (选项2)通过bundler安装。 *假设sqlite3已经添加到Gemfile (感谢Lester )
bundle config build.sqlite3 \
--with-sqlite3-include=$HOME/sqlite3.7.7.1/include \
--with-sqlite3-lib=$HOME/sqlite3.7.7.1/lib \
--with-sqlite3-dir=$HOME/sqlite3.7.7.1/bin
bundle install
这篇关于Rails 3.1应用程序无法安装sqlite3 gem,因为库已过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!