Forum: Ruby on Rails My GD2 is not working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
tomingy (Guest)
on 2006-04-26 17:30
I installed GD2 1.0/1.1, but they are both not working, does anyone
knows why? Great Thanks!

With GD 1.0 I got:
========================================================
RuntimeError
unknown symbol "gdImageSquareToCircle"
RAILS_ROOT:
/home/virtual/site1/fst/var/www/html/imodesite/public/../config/..

Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122:in `[]'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`inject'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:182:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
`require_gem_with_options'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem'
#{RAILS_ROOT}/app/helpers/application_helper.rb:2
#{RAILS_ROOT}/app/controllers/application.rb:3
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122:in `[]'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`inject'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:182:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
`require_gem_with_options'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
`load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in
`require_or_load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
`depend_on'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in
`require_dependency'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/helpers.rb:114:in
`default_helper_module!'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/helpers.rb:127:in
`inherited_without_api'
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/container/action_controller_container.rb:86:in
`inherited_without_action_controller'
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:34:in
`inherited'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
`load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in
`require_or_load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
`depend_on'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in
`require_dependency'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:69:in
`prepare_application'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:37:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
/home/virtual/site1/fst/var/www/html/imodesite/public/dispatch.fcgi:24
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122:in `[]'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`inject'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:182:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
`require_gem_with_options'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem'
#{RAILS_ROOT}/app/helpers/application_helper.rb:2
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
`load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in
`require_or_load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
`depend_on'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in
`require_dependency'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/helpers.rb:114:in
`default_helper_module!'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/helpers.rb:127:in
`inherited_without_api'
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/container/action_controller_container.rb:86:in
`inherited_without_action_controller'
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:34:in
`inherited'
#{RAILS_ROOT}/app/controllers/application.rb:3
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
`load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in
`require_or_load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
`depend_on'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in
`require_dependency'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:69:in
`prepare_application'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:37:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
/home/virtual/site1/fst/var/www/html/imodesite/public/dispatch.fcgi:24
This error occured while loading the following files:
   application.rb
   application_helper.rb
   gd2

With GD 1.1, I got
========================================================

NameError in ProductController#product_image
uninitialized constant SYM
RAILS_ROOT:
/home/virtual/site1/fst/var/www/html/imodesite/public/../config/..

Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2/image.rb:120:in `load'
#{RAILS_ROOT}/app/helpers/application_helper.rb:46:in `resize_image'
#{RAILS_ROOT}/app/controllers/product_controller.rb:387:in
`draw_image_for'
#{RAILS_ROOT}/app/controllers/product_controller.rb:149:in
`product_image'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2/image.rb:120:in `load'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
`perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
/home/virtual/site1/fst/var/www/html/imodesite/public/dispatch.fcgi:24
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2/image.rb:120:in `load'
#{RAILS_ROOT}/app/helpers/application_helper.rb:46:in `resize_image'
#{RAILS_ROOT}/app/controllers/product_controller.rb:387:in
`draw_image_for'
#{RAILS_ROOT}/app/controllers/product_controller.rb:149:in
`product_image'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
`perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
/home/virtual/site1/fst/var/www/html/imodesite/public/dispatch.fcgi:24
This error occured while loading the following files:
   gd2/sym.rb
Robert Thau (Guest)
on 2006-04-26 17:45
(Received via mailing list)
tomingy writes:
 > I installed GD2 1.0/1.1, but they are both not working, does anyone
 > knows why? Great Thanks!
 >
 > With GD 1.0 I got:
 > ========================================================
 > RuntimeError
 > unknown symbol "gdImageSquareToCircle"
 > RAILS_ROOT:
 > /home/virtual/site1/fst/var/www/html/imodesite/public/../config/..

This message I've seen before.  (The GD-1.1 message, I haven't).  I
got it when the GD gem was having trouble locating the GD shared
library (the .so file).  It was as if something within Rails was
messing with LD_LIBRARY_PATH; I worked around it by doing

  require 'rubygems'
  require_gem 'GD2'

in environment.rb *before* it invokes Rails::Initializer.run.
(Which still requires libgd.so to exist in a place where
a search along LD_LIBRARY_PATH can find it).

rst
Guest (Guest)
on 2006-05-01 04:55
Robert Thau wrote:
> This message I've seen before.  (The GD-1.1 message, I haven't).  I
> got it when the GD gem was having trouble locating the GD shared
> library (the .so file).  It was as if something within Rails was
> messing with LD_LIBRARY_PATH; I worked around it by doing
>
>   require 'rubygems'
>   require_gem 'GD2'
>
> in environment.rb *before* it invokes Rails::Initializer.run.
> (Which still requires libgd.so to exist in a place where
> a search along LD_LIBRARY_PATH can find it).
>
> rst


Hi Robert, thanks for your response.
I have tested the GD2-Gem both 1.0 and 1.1 with the following

-----------------------------------------------------------
Testing File: testgd2.rb

#!/usr/bin/ruby
require 'rubygems'
require_gem 'gd2'
include GD2

image = Image.import('./test.png')
image.resize! 200, 300
image.export('new-image.png')
-----------------------------------------------------------

Result 1 - FAILED with both GD2 1.0 & 1.1:
flowersa@antinous [~]# ruby -v
ruby 1.8.4 (2005-12-24) [i386-linux]

flowersa@antinous [~]# rails -v
Rails 1.0.0

flowersa@antinous [~]# ruby testgd2.rb
/usr/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122:in `[]': unknown
symbol "gdFTUseFontConfig" (Runti
meError)
        from /usr/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
        from /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`inject'
        from /usr/lib/ruby/gems/1.8/gems/gd2-1.1/lib/gd2.rb:122
        from /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
        from /usr/lib/site_ruby/1.8/rubygems.rb:182:in `activate'
        from /usr/lib/site_ruby/1.8/rubygems.rb:181:in `activate'
        from /usr/lib/site_ruby/1.8/rubygems.rb:37:in
`require_gem_with_options'
        from /usr/lib/site_ruby/1.8/rubygems.rb:31:in `require_gem'
        from testgd2.rb:5

-----------------------------------------------------------

Result 2 - SUCCESSED with GD2 1.0:

[vs140728@svc037 vs140728]$ ruby -v
ruby 1.8.2 (2004-12-25) [i686-linux]

[vs140728@svc037 vs140728]$ rails -v
Rails 0.14.3

-----------------------------------------------------------

It seems something wrong with GD2 with new version of Ruby??

Does anyone know how to fix this?

Great thanks.
myy
Robert Thau (Guest)
on 2006-05-03 20:57
(Received via mailing list)
Guest writes:
 > It seems something wrong with GD2 with new version of Ruby??

I don't think that's it --- I've used it successfully with Ruby 1.8.4.
But this sort of problem could arise if Ruby 1.8.2 and 1.8.4 were
compiled
with different config flags.

Once again, I'd check for libgd.so on LD_LIBRARY_PATH ... but that is
just a guess.

Robert Thau
removed_email_address@domain.invalid
This topic is locked and can not be replied to.