# Having trouble embedding ruby

**URL:** <https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199>\
**Category:** Ruby\
**Created:** [January 28, 2006, 11:49am UTC](https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199 "2006-01-28T11:49:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikko\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Mikko\_L](https://www.ruby-forum.com/u/Mikko_L)\
**Post date:** [January 28, 2006, 11:49am UTC](https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199/1 "2006-01-28T11:49:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mikko\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Mikko\_L](https://www.ruby-forum.com/u/Mikko_L)\
**Post date:** [January 28, 2006, 1:19pm UTC](https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199/2 "2006-01-28T13:19:31Z")

</div>

Hi Mikko,

On 28/01/06, Mikko L. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![Mikko\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Mikko\_L](https://www.ruby-forum.com/u/Mikko_L)\
**Post date:** [January 28, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199/3 "2006-01-28T20:36:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mikko\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Mikko\_L](https://www.ruby-forum.com/u/Mikko_L)\
**Post date:** [January 28, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/having-trouble-embedding-ruby/53199/4 "2006-01-28T22:21:38Z")

</div>

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
