0

我正在尝试在我的 Xubuntu 13.04 x64 系统上安装 bzip2-ruby gem。

我正在使用 RVM(使用 ruby​​ 2.0.0),并通过以下命令进行安装:

宝石安装 bzip2-ruby

它无法安装,这是我收到的输出(取自编译日志):

/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for bzlib.h... yes
checking for BZ2_bzWriteOpen() in -lbz2... yes
creating Makefile

make
compiling bzip2.c
In file included from bzip2.c:5:0:
/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
bzip2.c: In function ‘bz_find_struct’:
bzip2.c:117:71: error: ‘OpenFile’ undeclared (first use in this function)
bzip2.c:117:71: note: each undeclared identifier is reported only once for each function it appears in
bzip2.c:117:81: error: expected expression before ‘)’ token
bzip2.c: In function ‘bz_io_data_finalize’:
bzip2.c:297:13: error: unknown type name ‘OpenFile’
bzip2.c:297:31: error: ‘OpenFile’ undeclared (first use in this function)
bzip2.c:297:41: error: expected expression before ‘)’ token
bzip2.c:298:21: error: request for member ‘f’ in something not a structure or union
bzip2.c:299:28: error: request for member ‘f’ in something not a structure or union
bzip2.c:300:21: error: request for member ‘f’ in something not a structure or union
bzip2.c:302:21: error: request for member ‘f2’ in something not a structure or union
bzip2.c:303:28: error: request for member ‘f2’ in something not a structure or union
bzip2.c:304:21: error: request for member ‘f2’ in something not a structure or union
bzip2.c: In function ‘bz_writer_init’:
bzip2.c:473:9: error: unknown type name ‘OpenFile’
bzip2.c:483:13: warning: assignment from incompatible pointer type [enabled by default]
bzip2.c:483:13: warning: passing argument 1 of ‘rb_io_check_closed’ from incompatible pointer type [enabled by default]
In file included from /home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward/rubyio.h:6:0,
                 from bzip2.c:5:
/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/io.h:179:6: note: expected ‘struct rb_io_t *’ but argument is of type ‘int *’
bzip2.c:484:13: warning: passing argument 1 of ‘rb_io_check_writable’ from incompatible pointer type [enabled by default]
In file included from /home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward/rubyio.h:6:0,
                 from bzip2.c:5:
/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/io.h:172:6: note: expected ‘struct rb_io_t *’ but argument is of type ‘int *’
bzip2.c: In function ‘bz_reader_init’:
bzip2.c:698:13: error: unknown type name ‘OpenFile’
bzip2.c:703:13: warning: assignment from incompatible pointer type [enabled by default]
bzip2.c:703:13: warning: passing argument 1 of ‘rb_io_check_closed’ from incompatible pointer type [enabled by default]
In file included from /home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward/rubyio.h:6:0,
                 from bzip2.c:5:
/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/io.h:179:6: note: expected ‘struct rb_io_t *’ but argument is of type ‘int *’
bzip2.c:704:13: warning: passing argument 1 of ‘rb_io_check_readable’ from incompatible pointer type [enabled by default]
In file included from /home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward/rubyio.h:6:0,
                 from bzip2.c:5:
/home/misutowolf/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/io.h:173:6: note: expected ‘struct rb_io_t *’ but argument is of type ‘int *’
bzip2.c: In function ‘bz_next_available’:
bzip2.c:779:18: warning: operation on ‘bzf->buf’ may be undefined [-Wsequence-point]
bzip2.c: In function ‘bz_reader_ungetc’:
bzip2.c:981:18: warning: operation on ‘bzf->buf’ may be undefined [-Wsequence-point]
bzip2.c: In function ‘bz_reader_ungets’:
bzip2.c:1025:18: warning: operation on ‘bzf->buf’ may be undefined [-Wsequence-point]
bzip2.c: In function ‘Init_bzip2_ext’:
bzip2.c:1726:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
make: *** [bzip2.o] Error 1

现在,我几乎没有使用 C/C++ 的经验,所以我什至无法开始调试它正在编译的 C 代码……但是……有人有什么想法吗?我需要一个 Ruby BZip2 gem 库用于我正在处理的项目,这是我找到的第一个,不确定是否有任何替代方案可以尝试。

4

1 回答 1

0

显然问题是这个 gem 似乎无法与 Ruby 2.0.0 一起工作(至少我无法让它工作)。我通过 RVM 安装了 1.9.3,安装它并且工作正常。我不太了解 C 来修复它以与 2.0.0 一起使用,所以我将在这个项目中使用 1.9.3。没什么大不了。

于 2013-10-18T03:00:33.793 回答