【问题标题】:ERROR: While executing gem ... (ArgumentError) IPv4 address expects 4 bytes but 1 bytes - Ruby On Rails错误:执行 gem 时 ...(ArgumentError)IPv4 地址需要 4 个字节,但需要 1 个字节 - Ruby On Rails
【发布时间】:2015-05-11 09:53:54
【问题描述】:

在编译 bundle install 时,我收到了这个错误:

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

    /home/bartsabayton/.rvm/rubies/ruby-2.2.0-preview1/bin/ruby -r ./siteconf20150310-8631-16gdgvg.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()... 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

make "DESTDIR=" clean

make "DESTDIR="
compiling statement.c
statement.c: In function ‘bind_param’:
statement.c:261:7: warning: implicit declaration of function ‘RBIGNUM’ [-Wimplicit-function-declaration]
statement.c:261:11: error: invalid type argument of ‘->’ (have ‘int’)
statement.c:261:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function)
statement.c:261:32: note: each undeclared identifier is reported only once for each function it appears in
statement.c: In function ‘reset_bang’:
statement.c:293:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
statement.c: In function ‘clear_bindings’:
statement.c:313:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/bartsabayton/.rvm/gems/ruby-2.2.0-preview1@e-law-landing/gems/sqlite3-1.3.8 for inspection.
Results logged to /home/bartsabayton/.rvm/gems/ruby-2.2.0-preview1@e-law-landing/extensions/x86-linux/2.2.0/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.

所以我做了gem install sqlite3 -v '1.3.8',但是这样做的时候,

ERROR:  While executing gem ... (ArgumentError)
    IPv4 address expects 4 bytes but 1 bytes

我检查了我的 rvm 并且,

RVM 列表:

bartsabayton@bartsabayton-All-Series:~/rails/landing$ rvm list

rvm rubies

   ruby-2.0.0-p0 [ i686 ]
   ruby-2.1.0 [ i686 ]
 * ruby-2.1.3 [ i686 ]
=> ruby-2.2.0-preview1 [ i686 ]

# => - current
# =* - current && default
#  * - default

我正在使用:

  • Ubuntu 12.04
  • Ruby 2.2.0preview1 (2014-09-17 trunk 47616) [i686-linux]

请帮忙。需要修复它。

【问题讨论】:

    标签: ruby-on-rails ruby sqlite gem rubygems


    【解决方案1】:

    您使用的是 Ruby 2.2.0,而这个特定版本的 sqlite3 (1.3.8) 无法在它上面运行。

    所以,你应该安装更新版本的 sqlite3。

    你可以试试:

    gem install sqlite3
    

    并确保您在系统上安装了sqlite3sqlite-devel

    注意:正如 Ismael 所注意到的,您还应该更新 Ruby。

    【讨论】:

    • 我还建议更新 ruby​​ 版本。由于 OP 使用的是预览版
    • Ismael,我无法更新我的 ruby​​ 版本。我们无法改变,因为我们有一个协议要遵循。所以我依赖 2.2.0 ruby​​ 版本
    • gem install sqlite3 安装了新版本,所以它安装了 1.3.10。但它没有解决。我也使用 1.3.7 但再次出现同样的错误。
    • 并安装了sqlite3sqlite-devel
    • 喜欢这个? sudo apt-get install libsqlite3-dev
    【解决方案2】:

    您正在使用 Ruby 更高版本,例如 2.x.x,而这个特定版本的 sqlite3 (1.3.8) 存在问题。

    所以使用下面的命令手动安装 sqlite3 -

    gem 安装 sqlite3

    如果仍然出错,您删除 Gemfile.lock 然后进行捆绑安装,它可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-13
      • 2015-09-12
      • 2015-09-29
      • 2015-07-08
      • 2020-04-23
      • 2015-12-08
      • 1970-01-01
      相关资源
      最近更新 更多