有人会提供有关如何在 MacPorts 环境中为 ruby-2.0 安装 bzip2-ruby 的指导吗?
当我安装它时,它抱怨没有找到 version.h。我做了一个 version.h 到 ruby-2.0.0/version.h 的符号链接,然后我得到了这些:
~ >$ sudo gem install bz2
Password:
Building native extensions. This could take a while...
ERROR: Error installing bz2:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby2.0 extconf.rb
checking for BZ2_bzWriteOpen() in -lbz2... yes
creating Makefile
make
compiling bz2.c
In file included from bz2.c:2:
/opt/local/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
bz2.c:85:19: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
rb_raise(exc, msg);
^~~
bz2.c:112:46: error: no member named 'len' in 'struct RArray'
for (i = 0; i < RARRAY(bz_internal_ary)->len; i++) {
~~~~~~~~~~~~~~~~~~~~~~~ ^
bz2.c:113:43: error: no member named 'ptr' in 'struct RArray'
Data_Get_Struct(RARRAY(bz_internal_ary)->ptr[i], struct bz_iv, bziv);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/ruby-2.0.0/ruby/ruby.h:1026:17: note: expanded from macro 'Data_Get_Struct'
Check_Type((obj), T_DATA); \
^
/opt/local/include/ruby-2.0.0/ruby/ruby.h:539:47: note: expanded from macro 'Check_Type'
#define Check_Type(v,t) rb_check_type((VALUE)(v),(t))
^
bz2.c:113:43: error: no member named 'ptr' in 'struct RArray'
Data_Get_Struct(RARRAY(bz_internal_ary)->ptr[i], struct bz_iv, bziv);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/ruby-2.0.0/ruby/ruby.h:1027:30: note: expanded from macro 'Data_Get_Struct'
(sval) = (type*)DATA_PTR(obj);\
^
/opt/local/include/ruby-2.0.0/ruby/ruby.h:985:30: note: expanded from macro 'DATA_PTR'
#define DATA_PTR(dta) (RDATA(dta)->data)
^
/opt/local/include/ruby-2.0.0/ruby/ruby.h:1103:37: note: expanded from macro 'RDATA'
#define RDATA(obj) (R_CAST(RData)(obj))
^~~
bz2.c:116:29: error: use of undeclared identifier 'OpenFile'
RFILE(bziv->io)->fptr == (OpenFile *)ptr) {
^
bz2.c:116:39: error: expected expression
RFILE(bziv->io)->fptr == (OpenFile *)ptr) {
^
bz2.c:218:46: error: no member named 'len' in 'struct RArray'
for (i = 0; i < RARRAY(bz_internal_ary)->len; i++) {
~~~~~~~~~~~~~~~~~~~~~~~ ^
bz2.c:219:34: error: no member named 'ptr' in 'struct RArray'
elem = RARRAY(bz_internal_ary)->ptr[i];
~~~~~~~~~~~~~~~~~~~~~~~ ^
bz2.c:304:6: error: use of undeclared identifier 'OpenFile'
OpenFile *file = (OpenFile *)ptr;
^
bz2.c:304:16: error: use of undeclared identifier 'file'
OpenFile *file = (OpenFile *)ptr;
^
bz2.c:304:24: error: use of undeclared identifier 'OpenFile'
OpenFile *file = (OpenFile *)ptr;
^
bz2.c:304:34: error: expected expression
OpenFile *file = (OpenFile *)ptr;
^
bz2.c:305:10: error: use of undeclared identifier 'file'
if (file->f) {
^
bz2.c:306:10: error: use of undeclared identifier 'file'
fclose(file->f);
^
bz2.c:307:3: error: use of undeclared identifier 'file'
file->f = 0;
^
bz2.c:309:10: error: use of undeclared identifier 'file'
if (file->f2) {
^
bz2.c:310:10: error: use of undeclared identifier 'file'
fclose(file->f2);
^
bz2.c:311:3: error: use of undeclared identifier 'file'
file->f2 = 0;
^
bz2.c:399:23: error: no member named 'len' in 'struct RString'
if (RSTRING(str)->len) {
~~~~~~~~~~~~ ^
bz2.c:400:32: error: no member named 'ptr' in 'struct RString'
rb_str_cat(obj, RSTRING(str)->ptr, RSTRING(str)->len);
~~~~~~~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make: *** [bz2.o] Error 1
Gem files will remain installed in /opt/local/lib/ruby2.0/gems/2.0.0/gems/bz2-0.2.2 for inspection.
Results logged to /opt/local/lib/ruby2.0/gems/2.0.0/gems/bz2-0.2.2/ext/bz2/gem_make.out