From: "Gray, Jeff" Date: 2002-07-26T10:02:49+09:00 Subject: Search path for 'nested' .so files... I'm making my first foray into the land of C extensions to Ruby and am having the following problem. Mind you, I have virtually no practical experience with developing in C, so my apologies for what is probably a completely boneheaded question... The problem is that my compiled C extension gives the following error when require'd: dumstr.rb:3:in `require': libruby.so: cannot open shared object file: No such file or directory - ./Dumstr.so (LoadError) Here's the rest of the picture: * I am using a "private" installation of Ruby 1.6.7 (as opposed to our site installation of 1.6.5). The .so file was compiled using the makefile that was produced by a simple extconf.rb, but needed to be hacked a bit to get it to find/use the 1.6.7 libruby.so. This is relevant because using the site installation of 1.6.5 for both the Makefile generation and execution of the script produces a .so that doesn't have a LoadError. [It just core dumps, which is certainly my own fault. :^)] * I'm running the Ruby script that requires the .so as follows (this is on a Linux box): % cat dumstr.rb puts $: require 'Dumstr' % alias ruby167 /users/jgray/pkgs/ruby/ruby-1.6.7/ruby -I"/users/jgray/pkgs/ruby/ruby-1.6.7:/users/jgray/pkgs/ruby/ruby-1.6.7/lib" % ls -l /users/jgray/pkgs/ruby/ruby-1.6.7/lib/libruby.so -rwxr-xr-x 1 jgray 1636210 Jul 24 12:31 /users/jgray/pkgs/ruby/ruby-1.6.7/lib/libruby.so* % ls -l ./libruby.so lrwxrwxrwx 1 jgray 48 Jul 25 17:11 ./libruby.so -> /users/jgray/pkgs/ruby/ruby-1.6.7/lib/libruby.so* % ls -l /users/jgray/pkgs/ruby/ruby-1.6.7/ruby -rwxr-xr-x 1 jgray 1475058 Jun 4 18:29 /users/jgray/pkgs/ruby/ruby-1.6.7/ruby* % ls -l /users/jgray/pkgs/ruby/ruby-1.6.7/libruby.so lrwxrwxrwx 1 jgray 14 Jul 25 17:21 /users/jgray/pkgs/ruby/ruby-1.6.7/libruby.so -> lib/libruby.so % ruby167 dumstr.rb /users/jgray/pkgs/ruby/ruby-1.6.7 /users/jgray/pkgs/ruby/ruby-1.6.7/lib /usr/local/lib/ruby/site_ruby/1.6 /usr/local/lib/ruby/site_ruby/1.6/i686-linux /usr/local/lib/ruby/site_ruby /usr/local/lib/ruby/1.6 /usr/local/lib/ruby/1.6/i686-linux . dumstr.rb:3:in `require': libruby.so: cannot open shared object file: No such file or directory - ./Dumstr.so (LoadError) from dumstr.rb:3 Basically, I'm completely stumped as to why libruby.so can't be found... it's linked to or resides in three places that are all on the search path, one of which is the cwd. What am I doing wrong here? Thanks, - jeff