Statically linking ruby extensions - build problem

From: Daniel Carrera >Date: Sun, 12 Jan 2003 04:30:03 +0900Hi Daniel,Ok, here’s some more info:>ruby -e ‘puts $LOAD_PATH’/boot/home/Programming/Ruby/Extensions/sys-uname-516>ruby -e ‘puts $LOAD_PATH’/boot/home/config/lib/ruby/site_ruby/1.8/boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/boot/home/config/lib/ruby/site_ruby/boot/home/config/lib/ruby/1.8/boot/home/config/lib/ruby/1.8/i586-beos.Looks alright.The extconf.rb for uname is simply (after I removed the solaris specific have_header):require 'mkmf’create_makefile(‘sys/uname’)Output of manually building uname in its own directory:/boot/home/Programming/Ruby/Extensions/sys-uname-538>makegcc -g -O2 -I. -I/boot/home/config/lib/ruby/1.8/i586-beos -I/boot/home/config/lib/ruby/1.8/i586-beos -I. -c uname.cld -shared -L/boot/develop/lib/x86 -lbe -lroot -L"/boot/home/config/lib" -o uname.so uname.o -lruby/boot/home/Programming/Ruby/Extensions/sys-uname-539>make installuname.so → /boot/home/config/lib/ruby/site_ruby/1.8/i

586-beos/sys/uname.sochmod 0755 /boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/sys/uname.soSeems to be in the load path. I also tried adding have_library(“be”), and have_library(“root”) just for kicks because I saw it during the ruby build process. No effect one way or the other (not that I really expected any). The result in every case:>ruby test.rb/boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/sys/uname.so: Failed to load /boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/sys/uname.so (LoadError)>Did you ./configure again after you made the changes? >Does the new directory contain extconf.rb?Yes to both. I also just tried make’ing without reconfiguring as well as moving the .so file into other directories within the $LOAD_PATH.Oh, btw, I don’t see a Test.c anywhere in the ruby source. Is this something you just made up? The file I used is sys-uname, available on ruby-sysutils.sourceforge.net if you want to look at it.Any other ideas?Regards,DanOT Stuff:>Cool.

Great to see another OS supported. I’ve heard good things of BeOS. >I hope it growsIt’s more or less dead, unfortunately. If you want to give it a shot, I suggest the “Developer’s Edition”, available on bebits.com. You can also check out the openbeos project at openbeos.org. It really is a good OS - I prefer it over Linux in many ways. Too bad MS effectively killed it.

···

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

Oh, btw, I don’t see a Test.c anywhere in the ruby source. Is this
something you just made up?

OOps, sorry. Test.c is what I called the very first example in PickAxe.
It seems like a good test because it’s just about the simplest extension
you can make. Take a look at it. You might want to try it.

Ok, here’s some more info:

ruby -e ‘puts $LOAD_PATH’
/boot/home/config/lib/ruby/site_ruby/1.8
/boot/home/config/lib/ruby/site_ruby/1.8/i586-beos
/boot/home/config/lib/ruby/site_ruby
/boot/home/config/lib/ruby/1.8
/boot/home/config/lib/ruby/1.8/i586-beos

I notice that ‘.’ is not present (but that doesn’t matter for this
particular case).

[snip]

Output of manually building uname in its own directory:
[snip]
Seems to be in the load path.

Yes it does. That’s odd. Try

$ ls /boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/sys

To verify it’s there. I’m sure it is.

You could cd to that directory and try :

ruby -e ‘require “uname”’

after adding ‘.’ to the LOAD_PATH. There’s an environment variable todo
this, but I forget what it is.

Try the example from PickAxe. I’ll get back to you if I think of
anything.

Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137

···

On Sun, 12 Jan 2003, Daniel Berger wrote:

First off, my apologies for that last response. Apparently, Phoenix
for BeOS has some problems with newlines. I have no idea what
happened.

Daniel Carrera dcarrera@math.umd.edu wrote in message news:Pine.GSO.4.44.0301111626460.791-100000@bezier.math.umd.edu

Oh, btw, I don’t see a Test.c anywhere in the ruby source. Is this
something you just made up?

OOps, sorry. Test.c is what I called the very first example in PickAxe.
It seems like a good test because it’s just about the simplest extension
you can make. Take a look at it. You might want to try it.

Oh, ok. Well, I didn’t try that but I did try a simpler version of
sys-host and even that failed.

Ok, here’s some more info:

ruby -e ‘puts $LOAD_PATH’
/boot/home/config/lib/ruby/site_ruby/1.8
/boot/home/config/lib/ruby/site_ruby/1.8/i586-beos
/boot/home/config/lib/ruby/site_ruby
/boot/home/config/lib/ruby/1.8
/boot/home/config/lib/ruby/1.8/i586-beos

I notice that ‘.’ is not present (but that doesn’t matter for this
particular case).

Actually, it is. I think the format of my last post caused confusion.

$ ls /boot/home/config/lib/ruby/site_ruby/1.8/i586-beos/sys

To verify it’s there. I’m sure it is.

Yes, it’s definitely there. I don’t think it’s a problem of seeing it
(I’d get a “no such file” error in that case). It just doesn’t like
something about the shared object itself.

Any ld tips that might help?

Regards,

Dan

···

On Sun, 12 Jan 2003, Daniel Berger wrote: