From: jim@... Date: 2004-08-20T02:56:54+09:00 Subject: require and LD_LIBRARY_PATH Here is a little something interesting that I just stumbled across: I have a a library installed in a non-standard location and hence need to have LD_LIBRARY_PATH set so ld.so knows where to look when loading the shared library. Without LD_LIBRARY_PATH NOT set I get the following: % ruby -e "require 'ITKDb'" % ./ITKDb.so: libstdc++.so.5: cannot open shared object file: No such file or directory - ./ITKDb.so (LoadError) from -e:1 % But, if I set it I get: % setenv LD_LIBRARY_PATH /disk2/jfn/usr/local/lib % ruby -e "require 'ITKDb'" % So, I thought, that if I set LD_LIBRARY_PATH before I did a require, but inside the script, that I could still load the library. Well, it turns out that this doesn't work. % unsetenv LD_LIBRARY_PATH % ruby -e 'ENV["LD_LIBRARY_PATH"] = "/disk2/jfn/usr/local/lib"; require "ITKDb"' % ./ITKDb.so: libstdc++.so.5: cannot open shared object file: No such file or directory - ./ITKDb.so (LoadError) from -e:1 So, I assume that ENV['LD_LIBRARY_PATH'] = "/disk2/jfn/user/local/lib" is only setting a shell variable and not exporting it to the environment. Is this correct? If so, how do I export this variable? Thanks -- Jim Freeze