Page 1 of 1

Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Thu Oct 07, 2010 1:48 am
by Nitrodist
Trying to compile Ruby here so I can run Ruby on Rails on that NAS, the DS209+II.

I updated to the latest firmware (3.0) and tried to get to wokr. Installed the ipkg package maintainer for some things.

Tried to use the built in ruby package (1.9.1) that's on the ipkg repo, but that failed miserably when trying to run rails.

So, I decided to update to 1.9.2 (or use 1.8.7 -- either is fine, really). Unfortunately, having some problems here.

gcc is installed (so is zlib and a couple of other things such as make, automake, etc.) and I had to install a bunch of standard utilities since the box doesn't come with them or they're gimped by the Busybox thing that they have on there by default.

Got it to configure fine (yay!) but 'make' and 'make test' fail. I'm using the ruby-1.9.2-p0 (ftp link) to compile from.

This is some of the stuff that I've been seeing. Does anybody have any suggestions? These are the installed packages. List of available packages. Getting tired here... so very tired because linux is so addicting XD

Any help would be greatly appreciated.

edit: Got ruby 1.8.7 compiled and installed (somehow... don't ask me how) and now I'm running into some zlib issues. I have zlib installed through the package manager, but it's giving me some errors when I want to require the zlib library.

nastrg> ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [powerpc-linux]
nastrg> gem -v
1.3.7
nastrg> cat test.rb
puts "Hello, world."
nastrg> ruby test.rb
Hello, world.
nastrg> ruby -rzlib test.rb
/usr/local/lib/ruby/1.8/powerpc-linux/zlib.so: libz.so.1: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.8/powerpc-linux/zlib.so (LoadError)
nastrg>


Any way to diagnose this and fix? Add linked files to somewhere? How to check where it's looking? What I should do? :lol:

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Thu Oct 07, 2010 8:24 am
by notfred
ldd on the executable will help determine what libraries it is looking for and what it has and hasn't found:
nreilly@nreilly-lnx:~$ which cat
/bin/cat
nreilly@nreilly-lnx:~$ ldd /bin/cat
   linux-gate.so.1 =>  (0x0012e000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00cad000)
   /lib/ld-linux.so.2 (0x00111000)
nreilly@nreilly-lnx:~$

There's the environment variable LD_LIBRARY_PATH that you can set to specify additional paths to search for libraries, but this is very bad practice. You may want to look at what options are being passed to the linker (ld), specifically the -L specifies the library path to search at build time (in addition to the compiler defaults) and -rpath adds it to the default list of directories to search at run time. The default directories to search are specified in /etc/ld.so.conf and you may just have the zlib directory missing from there.

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Thu Oct 07, 2010 2:45 pm
by Nitrodist
Unfortunately, ldd isn't included with this linux box (ld is though). Is there a way of getting it somehow? Googling 'install ldd linux' etc. only brings up results of how to use ldd or someone who is having trouble installing other piece of software (and then subsequently using ldd to troubleshoot).

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Thu Oct 07, 2010 4:19 pm
by notfred
Just set the environment variable LD_TRACE_LOADED_OBJECTS to 1 and then run ld on it, that's all that ldd does (it's just a shell script).

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Thu Oct 07, 2010 11:45 pm
by Nitrodist
Got it sorted out notfred, thanks. RoR is now running!

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Tue Jan 11, 2011 4:32 am
by peresleguine
Nitrodist, notfred, please help. Can't figure out what ld command should I type to solve similar problem (NAS DS710+)?
Studio> ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
Studio> gem -v
1.3.7
Studio> gem list
ERROR:  Loading command: list (LoadError)
    libz.so.1: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.9.1/i686-linux/zlib.so
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::ListCommand

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Tue Jan 11, 2011 8:27 am
by Nitrodist
I really wish I documented what I did to get it going... :roll:

What I remember doing was having zlib installed through the package manager (used the ipkg package manager), but the kicker was that it was installed in a place that ruby wasn't looking for it. I think the package manager installs it to /opt/... or something.

Anyway, what I did to fix it was literally copy the file from there to the place that the ruby library was looking. I had a look at my Ubuntu installation as to where it had installed its zlib library and then put it there. Worked magically after that.

I may have put the so files in /lib and /usr/lib/, so you may want to try that first.

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Tue Jan 11, 2011 9:29 am
by notfred
Running ld with the environment variable LD_TRACE_LOADED_OBJECTS to 1 should tell you where it is looking for it.

Re: Compiling Ruby onto a PowerPC Arch (DS209+II NAS)

Posted: Tue Jan 11, 2011 10:18 am
by peresleguine
It was that simple! Just invalid link to older version of libz.so.1.
Studio> ls -la /lib/libz.so.1
lrwxrwxrwx 1 root root 22 Jul 27 20:36 /lib/libz.so.1 -> /opt/lib/libz.so.1.2.3


I have libz.so.1.2.5
So this did the trick:
ln -s /opt/lib/libz.so.1.2.5 /opt/lib/libz.so.1.2.3


Thanks! :)