Rails 3.1 应用程序无法安装 sqlite3 gem,因为库已过时

发布于 2024-12-03 14:12:28 字数 141 浏览 4 评论 0原文

CentOS 5.6 上提供并安装的最新 SQLite3 库版本为 3.3.6。据我了解,sqlite3 gem 需要版本 3.6 或更高版本。

如何让我的应用程序与 SQLite3 一起使用而不升级服务器上的库?它在工作环境中,我根本不被允许升级它。

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.

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.

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

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

发布评论

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

评论(3

送你一个梦 2024-12-10 14:12:28

您可以编译所需的 sqlite 版本的静态库。然后安装 sqlite3 gem 并引用新的静态库。

虽然我还没有测试过这个过程,但我可以看到这个过程是......

1。下载 SQLite 源代码并将其解压到新目录中。

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)通过捆绑程序安装。 *假设 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

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. 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, compile, and install.

./configure --disable-shared --enable-static --prefix=$HOME/sqlite3.7.7.1
make && make install

3.A. (option1) Install the SQLite gem with a reference to your new static lib.

gem install sqlite3 --with-sqlite3-dir=$HOME/sqlite3.7.7.1

3.B. (option2) Install via bundler. *Assuming sqlite3 has already been added to the Gemfile (thanks to 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
潇烟暮雨 2024-12-10 14:12:28

这些步骤对我来说很有效,只需稍作调整即可。步骤 3.A 使用 gem 1.3.7 和 Rails 3.1.0。我必须这样做:

gem install sqlite3 -- --with-sqlite3-dir=$HOME/sqlite3.7.7.1 --with-sqlite3-lib=$HOME/sqlite3.7.7.1/lib

中间额外的“--”允许选项不被gem文件解析

The steps worked for me with one minor tweak. With gem 1.3.7 and rails 3.1.0 for step 3.A. I had to do:

gem install sqlite3 -- --with-sqlite3-dir=$HOME/sqlite3.7.7.1 --with-sqlite3-lib=$HOME/sqlite3.7.7.1/lib

the extra "--" in the middle allowed option to not be parsed by the gem file

路还长,别太狂 2024-12-10 14:12:28

这对我在 MacBook 上有效,MacBook 上有一些多年来积累的不同版本的 sqlite3。

对我来说,gem 安装是:

gem install sqlite3 -- --with-sqlite3-dir=/path/to/sqlite3/directory

换句话说,我只需要列出主要的 sqlite3 开发目录,但我确实必须使用额外的“--”。

这允许在 Max OS X Lion 下安装 Rails 3.1

This worked for me on a MacBook which had some different versions of sqlite3 that had accumulated over the years.

For me, the gem install was:

gem install sqlite3 -- --with-sqlite3-dir=/path/to/sqlite3/directory

In other words, I did only have to list the main sqlite3 development directory, but I did have to use the extra "--".

This allowed the installation of Rails 3.1 under Max OS X Lion

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