view · edit · sidebar · attach · print · history

Installing the gd2 gem on Windows

<< Dbi | Index | Gd2SnowLeopard >>

I do

 gem install gd2

then I start up oddbd (de.oddb) and that results in

 C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `initialize': unknown error (RuntimeError)
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `dlopen'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/turing-0.0.11/lib/turing/image.rb:13
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/turing-0.0.11/lib/turing.rb:34
         ... 34 levels...
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/de.oddb-2.0.0/bin/oddbd:11
        from C:/Ruby-1.8.6-oniguruma/bin/oddbd:19:in `load'
        from C:/Ruby-1.8.6-oniguruma/bin/oddbd:19

the main part seems to be the dlopen problem. Luis Lavena also commented on that here

 http://url.ba/p1pa

so it must have something to do with the calling convention

 http://unixwiz.net/techtips/win32-callconv.html

trying to install

 gem install rgd2-ffij

that results in

 C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': 
 Could not find RubyGem gd2 (>= 1.0) (Gem::LoadError)
        from C:/Ruby-1.8.6-oniguruma/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'

gd2 does work on windows if you change the calling convention on

 line 29 

do

   def self.gd_library_name
    case RbConfig::CONFIG['host_os']
    when /darwin/
      'libgd.2.dylib'
    when /mingw|mswin/, /cygwin/
      'bgd.dll'
    else
      'libgd.so.2'
    end
  end

mingw has to be added and then you can load gd2 in irb as so

 C:\Users\zdavatz>irb
 irb(main):001:0> require 'rubygems'
 => true
 irb(main):002:0> require 'gd2'
 => true
 irb(main):003:0>

But you need the bdg.dll from here

 http://www.boutell.com/gd/http/gdwin32.zip

If you are on Ruby 1.8.6 you will need to correct this

 http://redmine.ruby-lang.org/issues/show/4156

in

 C:/Ruby-1.8.6-oniguruma/lib/ruby/1.8/e2mmap.rb
view · edit · sidebar · attach · print · history
Page last modified on March 22, 2011, at 04:45 PM