Having trouble embedding ruby


#1

Hi,

What I have is:
- A little wrapper executable which basicly just links to
libruby-static.a and tries to run a specific script.
- Extension, that for now does nothing but try to init GLUT and
open
a window
- Optionally I can compile the wrapper and extension statically
together

And I’m on Mac OS X 10.4.4, with ruby 1.8.4

What I get is:

  • When using the standard ruby executable or irb, the extension works
    properly.
  • The wrapper executable seems to run other ruby code properly.
  • When using the extension through the wrapper (either statically or
    by loading dynamically) I get this:

/Users/scoopr/Code/kiya-ng/final/pkgtest.app/Contents/Resources/init.rb:12:
[BUG] Bus Error
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0]

Abort trap

Line 12 being the last (empty) line of the init script, the script
just puts hello world and tries to init the extension.

What I noticed that loading of the extension itself doesn’t break,
but
the actual call to glutInit is the offending call!

Is there something I’m missing? Some library that I forgot to link
(but for some reason no compile errors for it)? Some other compile
parameter that I forgot/have to be removed?

Motivation for the wrapper initially is to make a proper .app bundle
for macs, and I know that there is atleast the rubycocoa one also,
but
I want to get this working also.

Thanks,
Mikko


#2

Hi Mikko,

On 28/01/06, Mikko L. removed_email_address@domain.invalid wrote:

ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0]

I’m doing very similar work with an XCode project embedding Ruby 1.8.4
via libruby-static.a.

Based on previous [BUG] Bus Error my first thought would be about how
you compiled Ruby and the extension you are trying to use. Were they
both compiled with the same version of GCC?

I don’t pretend to understand it, but I believe I have seen something
similar when Ruby compiled with GCC3 attemtped to use an extension
compiled with GCC4.

Regards,

Matt


#3

Hi Matt,

I’m doing very similar work with an XCode project embedding Ruby 1.8.4
via libruby-static.a.

Based on previous [BUG] Bus Error my first thought would be about how
you compiled Ruby and the extension you are trying to use. Were they
both compiled with the same version of GCC?

Yes.

I don’t pretend to understand it, but I believe I have seen something
similar when Ruby compiled with GCC3 attemtped to use an extension
compiled with GCC4.

Could be, but I’m pretty sure both were compiled with the same
version. I also tried compiling all with gcc 3.3, with the same
results.

Regards,

Matt

Thanks,
Mikko


#4

On 2006.01.29 04:34, Mikko L. wrote:

Yes.

I don’t pretend to understand it, but I believe I have seen something
similar when Ruby compiled with GCC3 attemtped to use an extension
compiled with GCC4.

Could be, but I’m pretty sure both were compiled with the same
version. I also tried compiling all with gcc 3.3, with the same
results.

Can you get anything out of a debugger, either from the process
or the core file? The BSD-family seems to sometimes use the bus
error signal instead of SIGSEGV.

Regards,

Matt

Thanks,
Mikko

E