RMagick as a local gem on Dreamhost

As DH refused to install new version of RMagick gem “globally” I had
to install it locally. Here my install details:

Local gems installed in:
/home/user/.gems
/home/user/.gems/gems/rmagick-1.14.0

Local libs installed in:
/home/user/lib

My app located in:
/home/user/apps/tptest/current

On top of my config/enviroment.rb:
ENV[‘GEM_PATH’] = ‘/home/user/.gems:/usr/lib/ruby/gems/1.8’
ENV[‘GEM_HOME’] = ‘/home/user/.gems’

My .bashrc and .bash_profile:

~/.bash_profile: executed by bash(1) for login shells.

umask 002
PS1=’[\h]$ ’

export PATH=/home/user/bin:$PATH
export GEM_PATH=/home/user/.gems:/usr/lib/ruby/gems/1.8
export GEM_HOME=/home/user/.gems

export LD_LIBRARY_PATH=/home/user/lib

~/.bashrc: executed by bash(1) for non-login shells.

export PATH=/home/user/bin:$PATH
export GEM_PATH=/home/user/.gems:/usr/lib/ruby/gems/1.8
export GEM_HOME=/home/user/.gems

export LD_LIBRARY_PATH=/home/user/lib


When I run my scripts from console the local version gets loaded:

[jurupa]$ ruby script/console

require_gem ‘rmagick’
=> true

require ‘RMagick’
=> true

Magick::Long_version
=> “This is RMagick 1.14.0 ($Date: 2006/09/27 21:26:35 $) Copyright
© 2006 by Timothy P. Hunter\nBuilt with ImageMagick 6.2.9 10/03/06
Q16 http://www.imagemagick.org\nBuilt for ruby 1.8.2 (2005-04-11)
[i386-linux]\nWeb page: http://rmagick.rubyforge.org\nEmail:
[email protected]\n”


When I run it “live” from web I get the following exception:
RMagick.rb:28: uninitialized constant Magick::Enum (NameError)

Browsing the web reveals that it should be a problem of:
LD_LIBRARY_PATH

That is why I use:
export LD_LIBRARY_PATH=/home/user/lib
in .bashrc

AND

PassEnv LD_LIBRARY_PATH
in .htaccess

Still no luck. Are there any other issues I’m missing? It seems like
FastCGI is not “using” the correct LD_LIBRARY_PATH… HELP!

Hi Wiktor,

A late reply I know, but I have come across the exact same problem with
my hosting company as well. I also installed ImageMagick locally and
RMagick as a local gem. I can get RMagick loaded without problem in my
./script/console but it will not load via Apache/FastCGI.

I got the same message you got once while playing around with several
things (think it may have been when I was playing around with
“require_gem ‘RMagick’”). But I took it down to a simple “require
‘RMagick’” in my environment.rb and get:

libMagick.so.10: cannot open shared object file: No such file
or directory - /home/myusername/gems/gems/rmagick-1.14.1/lib/RMagick.so

I also echoed out LD_LIBRARY_PATH after the load failure and it was set
to the correct path, so I think you are on the right track with the
theory that FastCGI is getting a different value for LD_LIBRARY_PATH for
some bizaar reason.

I hope someone who has seen (and hopefully solved) this problem will
spot this thread and give us a hand because I have been going around in
circles on this issue for almost a week. My hosting company said they
would install RMagick system wide but it has been quiet on that front
for several days now so I am not sure if they will. Anyway I would like
to see the solution to this because there will not doubt be a call to
load up another gem at a later date that uses an external .so library.

Cheers, and let me know if you make any new discoveries - I will be sure
to post here if I do.

Chad.

Just wanting to bump this thread.

I’m facing the same issue.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs