Rails 3.1 应用程序无法安装 sqlite3 gem,因为库已过时
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以编译所需的 sqlite 版本的静态库。然后安装 sqlite3 gem 并引用新的静态库。
虽然我还没有测试过这个过程,但我可以看到这个过程是......
1。下载 SQLite 源代码并将其解压到新目录中。
2.配置、编译和安装。
3.A. (选项 1)安装 SQLite gem 并引用新的静态库。
3.B. (选项2)通过捆绑程序安装。 *假设 sqlite3 已添加到 Gemfile(感谢 Lester)
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.
2. Configure, compile, and install.
3.A. (option1) Install the SQLite gem with a reference to your new static lib.
3.B. (option2) Install via bundler. *Assuming sqlite3 has already been added to the Gemfile (thanks to Lester)
这些步骤对我来说很有效,只需稍作调整即可。步骤 3.A 使用 gem 1.3.7 和 Rails 3.1.0。我必须这样做:
中间额外的“--”允许选项不被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:
the extra "--" in the middle allowed option to not be parsed by the gem file
这对我在 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