Bugs: Browse | Submit New | Admin
Hi can you please add mingw as a calling convention so that gd2 works on Windows with RubyInstaller as well. RubyInstaller uses MingW as compiler. Please see: http://url.ba/cu4f Luis Lavena helped to debug this: Seems our mingw is not covered... let's do some small changes: 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 the code you need to add is "ming" on line 29. Best Zeno
Add A Comment:
Date: 2011-02-16 19:59 Sender: Zeno R.R. Davatz I am getting a very similar error on Max OS X 10.6.6 RuntimeError: dlopen(libgd.2.dylib, 9): image not found from /Library/Ruby/Gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `initialize' from /Library/Ruby/Gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `dlopen' from /Library/Ruby/Gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require' from (irb):2 from /Library/Ruby/Site/1.8/rubygems/specification.rb:668
Date: 2011-01-16 07:46 Sender: Zeno R.R. Davatz Thank you Jonas! I am also letting Luis Lavena now! Best Zeno
Date: 2011-01-15 20:49 Sender: Jonas Tingeborn Ooops, was a reverse patch :) Here's the proper one (in the right direction) diff --git a/lib/gd2.rb b/lib/gd2.rb index aaee294..b8f6080 100644 --- a/lib/gd2.rb +++ b/lib/gd2.rb @@ -30,7 +30,7 @@ module GD2 case Config::CONFIG['arch'] when /darwin/ 'libgd.2.dylib' - when /mswin32/, /cygwin/ + when /mswin32/, /cygwin/, /mingw/ 'bgd.dll' else 'libgd.so.2' @@ -39,7 +39,7 @@ module GD2 def self.name_for_symbol(symbol, signature) case Config::CONFIG['arch'] - when /mswin32/, /cygwin/ + when /mswin32/, /cygwin/, /mingw/ sum = -4 signature.each_byte do |char| sum += case char @@ -147,7 +147,14 @@ module GD2 :gdFontCacheShutdown => '0', :gdFTUseFontConfig => 'II', :gdFree => '0P' - }.inject({}) { |x, (k, v)| x[k] = LIB[name_for_symbol(k, v), v]; x } + }.inject({}) { |x, (k, v)| + begin + x[k] = LIB[name_for_symbol(k, v), v] + rescue + x[k] = LIB["_" + name_for_symbol(k, v), v] + end + x + } # Bit flags for Image#compare
Date: 2011-01-15 20:47 Sender: Jonas Tingeborn I've added the fix via a repo on github, based on the 1.1.1 release and added a fix for mingw (rubyinstaller). In addition, there was an also an issue with underscore prefixed function names in the bgd.dll I got from the latest binary release of gd2, so that went in as well. The commit is at https://github.com/jojje/gd2-ruby/commit/5bf06e8 37a9370633fd640ef9b1e2545d0ab3680 I've kept changes separate from the original source (in a mingw-fix branch) to make it easy to spot any "unofficial" changes. Below is the patch against 1.1.1 for this problem: diff --git a/lib/gd2.rb b/lib/gd2.rb index b8f6080..aaee294 100644 --- a/lib/gd2.rb +++ b/lib/gd2.rb @@ -30,7 +30,7 @@ module GD2 case Config::CONFIG['arch'] when /darwin/ 'libgd.2.dylib' - when /mswin32/, /cygwin/, /mingw/ + when /mswin32/, /cygwin/ 'bgd.dll' else 'libgd.so.2' @@ -39,7 +39,7 @@ module GD2 def self.name_for_symbol(symbol, signature) case Config::CONFIG['arch'] - when /mswin32/, /cygwin/, /mingw/ + when /mswin32/, /cygwin/ sum = -4 signature.each_byte do |char| sum += case char @@ -147,14 +147,7 @@ module GD2 :gdFontCacheShutdown => '0', :gdFTUseFontConfig => 'II', :gdFree => '0P' - }.inject({}) { |x, (k, v)| - begin - x[k] = LIB[name_for_symbol(k, v), v] - rescue - x[k] = LIB["_" + name_for_symbol(k, v), v] - end - x - } + }.inject({}) { |x, (k, v)| x[k] = LIB[name_for_symbol(k, v), v]; x } # Bit flags for Image#compare