错误:执行gem时...(ArgumentError)IPv4地址需要4个字节但需要1个字节 - Ruby On Rails

时间:2015-03-10 03:21:53

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

在编译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]

请帮忙。需要解决它。

2 个答案:

答案 0 :(得分:4)

您使用的是Ruby 2.2.0,而这个特定版本的sqlite3(1.3.8)并没有使用它。

因此,您应该安装较新版本的sqlite3。

您可以尝试:

gem install sqlite3

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

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

答案 1 :(得分:0)

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

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

gem install sqlite3

如果还是错误,你会删除你的Gemfile.lock,然后进行捆绑安装,它就可以了。