gem - 在 MacPorts macOS 中,ruby 2.0 bz2 gem 安装

  显示原文与译文双语对照的内容
0 0

是否有人提供关于如何在MacPorts环境中安装 ruby-2.0的bzip2-ruby指南?

安装时,它抱怨 version.h 没有找到。 我做了 version.h 到 ruby-2.0.0/版本的链接,然后我得到了这些:


~> $ 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

时间: 原作者:

0 0

我不使用MacPorts抱歉。

但是如果你想更新你的ruby macOS,, 还想选择回到前一个版本,我详细的在一篇博客文章中( 链接下方) 以来我想我会解释这对机器或做一遍我用于测试。

更新 macOS 到 ruby 2.0

...