简体   繁体   English

无法安装 sqlite3 gem

[英]Cannot install sqlite3 gem

I am trying to run the bundle command to install all the gems for a todo application.我正在尝试运行 bundle 命令来安装 todo 应用程序的所有 gem。 All gems have downloaded without a problem but the sqlite3 gem has not.所有 gems 都下载没有问题,但 sqlite3 gem 没有。 I have no idea what the following means could somebody please explain what is going on and how to fix?我不知道以下是什么意思,有人可以解释一下发生了什么以及如何解决吗?

Installing sqlite3 1.3.8 with native extensions使用本机扩展安装 sqlite3 1.3.8

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Gem::Ext::BuildError: 错误:无法构建 gem 本机扩展。

/Users/tomfinet/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151208-

2023-1esrcfp.rb extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling backup.c
compiling database.c
compiling exception.c
compiling sqlite3.c
compiling statement.c
statement.c:261:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration]
      if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
          ^
./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
                       ^
statement.c:261:11: error: member reference type 'int' is not a pointer
      if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
          ^~~~~~~~~~~~~~~~~~
./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN'
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
                       ~~~~~~~~~~  ^
statement.c:261:32: error: use of undeclared identifier 'SIZEOF_BDIGITS'
      if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
                               ^
1 warning and 2 errors generated.
make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/sqlite3-1.3.8/gem_make.out
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.

What is the problem and how do I fix it?有什么问题,我该如何解决? Thanks.谢谢。

bundle update sqlite3

看看这个要点

You need the SQLite3 development headers for the gem's native extension to compile against.您需要针对 gem 的本机扩展的 SQLite3 开发头文件进行编译。 You can install them by running (possibly with sudo ):您可以通过运行(可能使用sudo )来安装它们:

apt-get install libsqlite3-dev

After which, be sure to run之后,一定要运行

bundle update sqlite3

Ah, looks like it's an issue with the sqlite3 v1.4.0 gem which was released on February 4.啊,看来是 2 月 4 日发布的 sqlite3 v1.4.0 gem 的问题。

Mention the following sqlite3 version in your gem file:在您的 gem 文件中提及以下 sqlite3 版本:

gem "sqlite3", "~> 1.3.6”宝石“sqlite3”,“〜> 1.3.6”

Then make sure to “bundle install”.然后确保“捆绑安装”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM