Zlib.so Problem on MIPS target platform

Hi

You'll have to forgive me if I miss some obvious details, as I've never actually programmed in ruby. I've been tasked to install ruby and supporting applications, gems, etc.

I've built an embedded linux system cross-compiled on the MIPS platform. I'm currently in the process of getting ruby installed and running. My build platform is Redhat FC4. Target platform is the 2.6.10 kernel on MIPS AU1000 processor (Little Endian).

Using the following:

ruby-1.8.4
rubygems-0.9.0
sqlite-2.8.17
sqlite-ruby-2.2.3
zlib-1.2.1

Due to filesystem space limits, all apps are currently compiled against uClibc, rather than libc as is normally found on most systems.

Ruby is installed and running on the target. Sqlite is also installed. Sqlite-ruby is also installed. I'm now attempting to install rubygems, and subsequently, install other gems such as rake, mongrel, etc.

Now, here's my problem, ruby is using zlib when working with the gems. I have been unsuccessful so far, to get rubygems installed correctly due to the zlib.so file. I receive the following error message when installing rubygems, or any gem.

..................................................................................................................
As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.

/usr/local/lib/ruby/1.8/mipsel-linux/zlib.so: Unable to resolve symbol - /usr/local/lib/ruby/1.8)
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:9
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:7
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:93:in `manage_gems'
         from /home/maccontrol/rubygems-0.9.0/./post-install.rb:70:in `install_sources'
         from /home/maccontrol/rubygems-0.9.0/./post-install.rb:81:in `try_run_hook'
         from setup.rb:577:in `run_hook'
         from setup.rb:1315:in `exec_task_traverse'
         from setup.rb:1168:in `exec_install'
         from setup.rb:887:in `exec_install'
         from setup.rb:710:in `invoke'
         from setup.rb:674:in `invoke'
         from setup.rb:1352
......................................................................................................................

Unable to resolve symbol. Ok, that leads me to believe there is a problem with the library i just built from zlib-1.2.1. I have installed libz.so.1.2.1. Checking the dependencies on libz.so.1.2.1, i can see that all required dependencies are available and it is properly linked to uclibc. Included in the zlib-1.2.1 package are two test applications, minigzip and example. Both test apps run perfectly on the target platform with the newly created libz.so.1.2.1 library. So it seems that the library is functioning correctly and ruby is able to FIND the library. But it fails to load within ruby.

I have also attempted to compile (rather than libz.so.1.2.1), the zlib source included with ruby (ext/zlib), as well as ruby-zlib-0.6.0. Neither of these two options have successfully cross-compiled against mipsel-uclibc to generate a working libz.so. And from what i understand....ruby-1.6.(something) and later does not require, or use its own zlib object, but rather uses the one installed on the system.?.?.

So anyway, back to the original problem...."Unable to resolve symbol". I can't seem to find a problem with the library, yet ruby does not like it. Is there any way to gather more information from ruby concerning this error? Anyone have suggestions as to what might be causing this problem? Can i create a small test app to load the library exactly the same way as ruby does, and perhaps pull a little more error information?

I'm also able to produce the error on the target simply by using irb and giving it the command
  require 'zlib'

Again, "Unable to resolve symbol".

Any info someone can provide regarding zlib.so and ruby would be appreciated.

Thanks

Stefan Willmert

Unable to resolve symbol. Ok, that leads me to believe there is a
problem with the library i just built from zlib-1.2.1. I have
installed libz.so.1.2.1. Checking the dependencies on libz.so.1.2.1,
i can see that all required dependencies are available and it is
properly linked to uclibc. Included in the zlib-1.2.1 package are two
test applications, minigzip and example. Both test apps run perfectly
on the target platform with the newly created libz.so.1.2.1 library.
So it seems that the library is functioning correctly and ruby is
able to FIND the library. But it fails to load within ruby.

Do note that zlib.so is the ruby extension, but libz.so.foo is the zlib
library. They're not the same thing. Sounds like you have a zlib.so
linked against another libz, but that's a guess.

Aria

so...zlib.so extension IS required by ruby? I thought I had read somewhere that the zlib.so extension was deprecated after 1.6.(something). And I could simply use the libz.so from the system.

Currently, I simply have ln -s /usr/lib/libz.so.1.2.1 /usr/local/lib/ruby/1.8/mipsel-linux/zlib.so .... so, just a link to the systems libz. Is that the problem? And if so...does it matter whether i use the included ruby/ext/zlib or the ruby-zlib-0.6.0 package? Are they the same thing? (Besides the fact that I can't seem to get either to cross compile correctly without some major tweaking).

Stefan Willmert

···

On Oct 24, 2006, at 8:50 PM, Aredridel wrote:

Unable to resolve symbol. Ok, that leads me to believe there is a
problem with the library i just built from zlib-1.2.1. I have
installed libz.so.1.2.1. Checking the dependencies on libz.so.1.2.1,
i can see that all required dependencies are available and it is
properly linked to uclibc. Included in the zlib-1.2.1 package are two
test applications, minigzip and example. Both test apps run perfectly
on the target platform with the newly created libz.so.1.2.1 library.
So it seems that the library is functioning correctly and ruby is
able to FIND the library. But it fails to load within ruby.

Do note that zlib.so is the ruby extension, but libz.so.foo is the zlib
library. They're not the same thing. Sounds like you have a zlib.so
linked against another libz, but that's a guess.

Aria

so...zlib.so extension IS required by ruby? I thought I had read
somewhere that the zlib.so extension was deprecated after 1.6.
(something). And I could simply use the libz.so from the system.

Currently, I simply have ln -s /usr/lib/libz.so.1.2.1 /usr/local/lib/
ruby/1.8/mipsel-linux/zlib.so .... so, just a link to the systems
libz. Is that the problem? And if so...does it matter whether i use
the included ruby/ext/zlib or the ruby-zlib-0.6.0 package? Are they
the same thing? (Besides the fact that I can't seem to get either to
cross compile correctly without some major tweaking).

It is -- you don't need an externally supplied zlib.so, hence the
obsolescence of that package, but it is included in ruby 1.8:

aredridel@arcturus:~$ ls /usr/lib/ruby/1.8/i686-linux/zlib.so
/usr/lib/ruby/1.8/i686-linux/zlib.so

Aria