【问题标题】:Ubuntu Sqlite3 1.4.2 gem install error. Any ideas?Ubuntu Sqlite3 1.4.2 gem 安装错误。有任何想法吗?
【发布时间】:2021-05-03 05:14:23
【问题描述】:

我安装了 libsqlite3-dev,但它没有 帮助。我的 ruby​​ 版本是 3.0.0 。这是我的错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
/snap/ruby/201/bin/ruby -I /snap/ruby/201/lib/ruby/3.0.0 -r ./siteconf20210129-26408-4tihlx.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for rb_integer_pack()... no
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
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

current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
make "DESTDIR=" clean

current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
make "DESTDIR="
compiling aggregator.c
compiling backup.c
compiling database.c
database.c: In function ‘rb_sqlite3_open_v2’:
database.c:38:9: warning: unused variable ‘flags’ [-Wunused-variable]
   38 |   VALUE flags;
      |         ^~~~~
database.c: In function ‘exec_batch’:
database.c:726:57: warning: passing argument 3 of ‘sqlite3_exec’ from incompatible pointer type
[-Wincompatible-pointer-types]
  726 |     status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
|                                                         int (*)(VALUE,  int,  char **, char **) {aka int
(*)(long unsigned int,  int,  char **, char **)}
In file included from ./sqlite3_ruby.h:25,
                 from database.c:1:
/usr/include/sqlite3.h:409:9: note: expected ‘int (*)(void *, int,  char **, char **)’ but argument is of type ‘int
(*)(VALUE,  int,  char **, char **)’ {aka ‘int (*)(long unsigned int,  int,  char **, char **)’}
  409 |   int (*callback)(void*,int,char**,char**),  /* Callback function */
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:726:81: warning: passing argument 4 of ‘sqlite3_exec’ makes pointer from integer without a cast
[-Wint-conversion]
  726 |     status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
      |                                                                                 ^~~~~~~~~~~~
      |                                                                                 |
      |                                                                                 VALUE {aka long unsigned int}
In file included from ./sqlite3_ruby.h:25,
                 from database.c:1:
/usr/include/sqlite3.h:410:3: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
  410 |   void *,                                    /* 1st argument to callback */
      |   ^~~~~~
database.c:728:57: warning: passing argument 3 of ‘sqlite3_exec’ from incompatible pointer type
[-Wincompatible-pointer-types]
  728 |     status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
|                                                         int (*)(VALUE,  int,  char **, char **) {aka int
(*)(long unsigned int,  int,  char **, char **)}
In file included from ./sqlite3_ruby.h:25,
                 from database.c:1:
/usr/include/sqlite3.h:409:9: note: expected ‘int (*)(void *, int,  char **, char **)’ but argument is of type ‘int
(*)(VALUE,  int,  char **, char **)’ {aka ‘int (*)(long unsigned int,  int,  char **, char **)’}
  409 |   int (*callback)(void*,int,char**,char**),  /* Callback function */
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:728:84: warning: passing argument 4 of ‘sqlite3_exec’ makes pointer from integer without a cast
[-Wint-conversion]
  728 |     status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
      |                                                                                    ^~~~~~~~~~~~
      |                                                                                    |
|                                                                                    VALUE {aka long unsigned
int}
In file included from ./sqlite3_ruby.h:25,
                 from database.c:1:
/usr/include/sqlite3.h:410:3: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
  410 |   void *,                                    /* 1st argument to callback */
      |   ^~~~~~
database.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling exception.c
compiling sqlite3.c
sqlite3.c: In function ‘bignum_to_int64’:
sqlite3.c:33:27: warning: implicit declaration of function ‘RBIGNUM’; did you mean ‘T_BIGNUM’?
[-Wimplicit-function-declaration]
   33 | #   define RBIGNUM_LEN(x) RBIGNUM(x)->len
      |                           ^~~~~~~
sqlite3.c:35:20: note: in expansion of macro ‘RBIGNUM_LEN’
   35 |   const long len = RBIGNUM_LEN(value);
      |                    ^~~~~~~~~~~
sqlite3.c:33:37: error: invalid type argument of ‘->’ (have ‘int’)
   33 | #   define RBIGNUM_LEN(x) RBIGNUM(x)->len
      |                                     ^~
sqlite3.c:35:20: note: in expansion of macro ‘RBIGNUM_LEN’
   35 |   const long len = RBIGNUM_LEN(value);
      |                    ^~~~~~~~~~~
sqlite3.c:40:19: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function); did you mean ‘SIZEOF_INT’?
   40 |   if (len > 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) return 0;
      |                   ^~~~~~~~~~~~~~
      |                   SIZEOF_INT
sqlite3.c:40:19: note: each undeclared identifier is reported only once for each function it appears in
sqlite3.c:42:11: error: unknown type name ‘BDIGIT’
   42 |     const BDIGIT *digits = RBIGNUM_DIGITS(value);
      |           ^~~~~~
sqlite3.c:42:28: warning: implicit declaration of function ‘RBIGNUM_DIGITS’; did you mean ‘RBIGNUM_SIGN’?
[-Wimplicit-function-declaration]
   42 |     const BDIGIT *digits = RBIGNUM_DIGITS(value);
      |                            ^~~~~~~~~~~~~~
      |                            RBIGNUM_SIGN
sqlite3.c:42:28: warning: initialization of ‘const int *’ from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
sqlite3.c:43:5: error: unknown type name ‘BDIGIT’; did you mean ‘ISDIGIT’?
   43 |     BDIGIT blast = digits[len-1];
      |     ^~~~~~
      |     ISDIGIT
sqlite3.c:44:5: error: unknown type name ‘BDIGIT’; did you mean ‘ISDIGIT’?
   44 |     BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
      |     ^~~~~~
      |     ISDIGIT
sqlite3.c:44:20: error: ‘BDIGIT’ undeclared (first use in this function); did you mean ‘ISDIGIT’?
   44 |     BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
      |                    ^~~~~~
      |                    ISDIGIT
sqlite3.c:44:27: error: expected ‘,’ or ‘;’ before numeric constant
   44 |     BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
      |                           ^~~
sqlite3.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
make: *** [Makefile:245: sqlite3.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/nurlaney/.gem/gems/sqlite3-1.4.2 for inspection.
Results logged to /home/nurlaney/.gem/extensions/x86_64-linux/3.0.0/sqlite3-1.4.2/gem_make.out

An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sqlite3

我查看了其他主题,但没有一个有帮助。我应该像在 Windows 中一样安装 DevKit 吗?如果这个可以安装,怎么样? 我从 snap 通道安装了 ruby​​。 我尝试安装 sqlite3 gem,但它再次返回相同的错误。然后我尝试在本地安装 gem,但它再次没有帮助。所以我卡住了。我不知道如何解决。有什么想法吗?

【问题讨论】:

  • 安装 libsqlite3-dev 的命令是什么?
  • Ubuntu 20.04。现在我陷入了这个错误
  • sudo apt-get install libsqlite3-dev

标签: ruby-on-rails ruby ubuntu rubygems sinatra


【解决方案1】:

请检查以下简单步骤在Ubuntu 20.04中安装sqlite3

sudo apt update
sudo apt install sqlite3
sqlite3 --version

如果上述注释不适用于您的机器,您可以直接在此处下载.deb 文件并安装https://ubuntu.pkgs.org/20.04/ubuntu-main-amd64/libsqlite3-dev_3.31.1-4_amd64.deb.html

安装sqlite3 Gem

sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

如果您需要任何帮助,请告诉我:)

【讨论】:

  • 这不是我想要的。我只想在我的机器上安装 gem,而不是整个 sqlite3。你能告诉我这是安装 sqlite3 gem 的唯一方法还是只是选项?
  • @NurlanYusifli 我已经更新了我的答案,请检查。我们需要在您的机器上安装 sqlite3,然后只有 gem 可以在您的本地机器上运行
  • 我已经尝试过你的命令,它再次返回。我也安装了 sqlite3
  • 在安装 sqlite3 gem 时你得到了什么?
  • 安装成功但返回同样的错误。无论如何我解决了这个问题,只需从我的机器中删除所有 ruby​​,然后使用 RVM 再次安装。就是这样!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-06-30
  • 2011-06-28
  • 2016-03-13
  • 2023-03-15
  • 2011-04-01
  • 2021-04-19
  • 2012-04-17
相关资源
最近更新 更多