title: ruby 2.0 bz2 gem installation in MacPorts MacOS
body: <p>Would anyone provide guidance on how to install the bzip2-ruby for ruby-2.0 in MacPorts environment? </p>
  
  <p>when I installed it, it complained about version.h not found.  I did a symlink of the version.h to ruby-2.0.0/version.h and then I got these:</p>
  
  <pre><code>~ &gt;$ 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 &lt; RARRAY(bz_internal_ary)-&gt;len; i++) {
                      ~~~~~~~~~~~~~~~~~~~~~~~  ^
  bz2.c:113:43: error: no member named 'ptr' in 'struct RArray'
          Data_Get_Struct(RARRAY(bz_internal_ary)-&gt;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)-&gt;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)-&gt;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-&gt;io)-&gt;fptr == (OpenFile *)ptr) {
                                            ^
  bz2.c:116:39: error: expected expression
                  RFILE(bziv-&gt;io)-&gt;fptr == (OpenFile *)ptr) {
                                                      ^
  bz2.c:218:46: error: no member named 'len' in 'struct RArray'
      for (i = 0; i &lt; RARRAY(bz_internal_ary)-&gt;len; i++) {
                      ~~~~~~~~~~~~~~~~~~~~~~~  ^
  bz2.c:219:34: error: no member named 'ptr' in 'struct RArray'
          elem = RARRAY(bz_internal_ary)-&gt;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-&gt;f) {
                  ^
  bz2.c:306:10: error: use of undeclared identifier 'file'
                  fclose(file-&gt;f);
                         ^
  bz2.c:307:3: error: use of undeclared identifier 'file'
                  file-&gt;f = 0;
                  ^
  bz2.c:309:10: error: use of undeclared identifier 'file'
              if (file-&gt;f2) {
                  ^
  bz2.c:310:10: error: use of undeclared identifier 'file'
                  fclose(file-&gt;f2);
                         ^
  bz2.c:311:3: error: use of undeclared identifier 'file'
                  file-&gt;f2 = 0;
                  ^
  bz2.c:399:23: error: no member named 'len' in 'struct RString'
      if (RSTRING(str)-&gt;len) {
          ~~~~~~~~~~~~  ^
  bz2.c:400:32: error: no member named 'ptr' in 'struct RString'
          rb_str_cat(obj, RSTRING(str)-&gt;ptr, RSTRING(str)-&gt;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
  </code></pre>