# Ruby c++ extension on intel mac

**URL:** <https://www.ruby-forum.com/t/ruby-c-extension-on-intel-mac/78672>\
**Category:** Ruby\
**Created:** [March 8, 2006, 9:04pm UTC](https://www.ruby-forum.com/t/ruby-c-extension-on-intel-mac/78672 "2006-03-08T21:04:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![reevesg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a6a055/32.png) [@reevesg](https://www.ruby-forum.com/u/reevesg)\
**Post date:** [March 8, 2006, 9:04pm UTC](https://www.ruby-forum.com/t/ruby-c-extension-on-intel-mac/78672/1 "2006-03-08T21:04:13Z")

</div>

Hey,

I am having trouble building an extension on a new intel mac. The  
extension I have at the moment is simple, basically the example out of  
the big ruby book.

The error I get when building is

macbook:~/projects/extension\_shared\_ptr\_test reevesg$ make  
cc -bundle -L"/usr/lib" -o Extension.bundle extension.o -lruby  
-lpthread -ldl -lobjc  
/usr/bin/ld: Undefined symbols:  
\_\_\_gxx\_personality\_v0  
collect2: ld returned 1 exit status  
make: \*\*\* [Extension.bundle] Error 1  
macbook:~/projects/extension\_shared\_ptr\_test reevesg$

I think i may need to build my ruby from scratch because this sounds  
like a gcc incompatibility to me.

Here is my gcc output

macbook:~/projects/extension\_shared\_ptr\_test reevesg$ gcc -v  
Using built-in specs.  
Target: i686-apple-darwin8  
Configured with: /private/var/tmp/gcc/gcc-5250.obj~20/src/configure  
–disable-checking -enable-werror --prefix=/usr --mandir=/share/man  
–enable-languages=c,objc,c++,obj-c++  
–program-transform-name=/^[cg][^.-]\*$/s/$/-4.0/  
–with-gxx-include-dir=/include/c++/4.0.0 --build=powerpc-apple-darwin8  
–with-arch=pentium-m --with-tune=prescott --program-prefix=  
–host=i686-apple-darwin8 --target=i686-apple-darwin8  
Thread model: posix  
gcc version 4.0.1 (Apple Computer, Inc. build 5250)  
macbook:~/projects/extension\_shared\_ptr\_test reevesg$

Anyone got any ideas on how to proceed? Is there a ruby extensions list  
or IIRC channel somewhere. I could definitely use the help.

Thanks

Gareth

---

<div class="post-metadata">

**Author:** ![reevesg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a6a055/32.png) [@reevesg](https://www.ruby-forum.com/u/reevesg)\
**Post date:** [March 8, 2006, 9:26pm UTC](https://www.ruby-forum.com/t/ruby-c-extension-on-intel-mac/78672/2 "2006-03-08T21:26:50Z")

</div>

On Thu, Mar 09, 2006 at 05:04:33AM +0900, Gareth R. wrote:

> -lpthread -ldl -lobjc
> 
> Thread model: posix  
> gcc version 4.0.1 (Apple Computer, Inc. build 5250)  
> macbook:~/projects/extension\_shared\_ptr\_test reevesg$
> 
> Anyone got any ideas on how to proceed? Is there a ruby extensions list  
> or IIRC channel somewhere. I could definitely use the help.

On my iBook, \_\_\_gxx\_personality\_v0 is in libstdc++.dylib. Maybe you  
need to add an explicit -lstdc++ to compile it.

Steve P.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![reevesg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a6a055/32.png) [@reevesg](https://www.ruby-forum.com/u/reevesg)\
**Post date:** [March 8, 2006, 9:36pm UTC](https://www.ruby-forum.com/t/ruby-c-extension-on-intel-mac/78672/3 "2006-03-08T21:36:01Z")

</div>

On Thu, 9 Mar 2006, Steve P. wrote:

> > cc -bundle -L"/usr/lib" -o Extension.bundle extension.o -lruby  
> > -lpthread -ldl -lobjc  
> > /usr/bin/ld: Undefined symbols:  
> > \_\_\_gxx\_personality\_v0  
> > collect2: ld returned 1 exit status  
> > make: \*\*\* [Extension.bundle] Error 1  
> > macbook:~/projects/extension\_shared\_ptr\_test reevesg$
> > 
> > I think i may need to build my ruby from scratch because this sounds  
> > like a gcc incompatibility to me.

try

CC=g++ make

-a
