# Problem building ruby-audio-0.1.1 on OSX 10.4.7

**URL:** <https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516>\
**Category:** Ruby\
**Created:** [July 23, 2006, 6:55pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516 "2006-07-23T18:55:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 23, 2006, 6:55pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/1 "2006-07-23T18:55:21Z")

</div>

Hi,

I’m trying to install ruby-audio on OS X. The instructions for  
installing say to run ‘rake’ but when I do, I get the following error:  
/usr/bin/ld: Undefined symbols:  
\_cNArray  
\_na\_sizeof

narray is a prerequisite for this extension and I have narray working  
on my machine (ie I can use it in my ruby scripts and ‘narray.bundle’  
is located in /usr/lib/ruby/site-ruby/1.8/powerpc-darwin8.0).

The c source file for the ruby-audio extension #includes narray.h. I  
think this is where the problem is: the linker can’t find the external  
symbols defined in this header.

Is there something I have to change in the ruby-audio extconf.rb file  
(or anywhere else) in order to get this to work?

(I would also like to use narray.h for my own extension in order to  
access some of the macros there - so any help is greatly appreciated!)

Thanks,  
mike.

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 24, 2006, 3:04pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/2 "2006-07-24T15:04:26Z")

</div>

Mike Spears wrote:

> is located in /usr/lib/ruby/site-ruby/1.8/powerpc-darwin8.0).
> 
> The c source file for the ruby-audio extension #includes narray.h. I  
> think this is where the problem is: the linker can’t find the external  
> symbols defined in this header.
> 
> Is there something I have to change in the ruby-audio extconf.rb file  
> (or anywhere else) in order to get this to work?
> 
> (I would also like to use narray.h for my own extension in order to  
> access some of the macros there - so any help is greatly appreciated!)

You’re right, the linker isn’t finding the narray lib. It would help if  
you paste the entire output of rake.

My first guess is that you have two ruby installations and rake is  
somehow using the wrong one. In any case, you should be able to work  
around it by hand-tweaking ext/sndfile/Makefile, but I’d like to know if  
something is broken so I can fix it.

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 24, 2006, 8:05pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/3 "2006-07-24T20:05:40Z")

</div>

Hi Hans,

Thanks for responding!

I have looked around my system and I can’t find any other ruby  
installations except for the one in /usr/lib. I’ll look at the  
Makefile to see what I can do.

I am using narray-0.5.8 and SWIG 1.3.27.  
Here is the full rake output, followed by the contents of my  
.bash\_profile.

~/desktop/toscan/ruby-audio-0.1.1\>rake --trace  
(in /Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1)  
\*\* Invoke default (first\_time)  
\*\* Invoke test (first\_time)  
\*\* Invoke setup (first\_time)  
\*\* Invoke .config (first\_time)  
\*\* Execute .config  
ruby setup.rb config  
—\> lib  
—\> lib/audio  
\<— lib/audio  
\<— lib  
—\> ext  
—\> ext/sndfile  
/usr/bin/ruby  
/Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/ext/sndfile/extconf.rb  
/usr/include/sndfile.h:278: Warning(451): Setting const char \* member  
may leak memory.  
/usr/include/sndfile.h:279: Warning(451): Setting const char \* member  
may leak memory.  
/usr/include/sndfile.h:300: Warning(451): Setting const char \* member  
may leak memory.  
checking for sf\_open() in -lsndfile… yes  
checking for narray.h… yes  
creating Makefile  
\<— ext/sndfile  
\<— ext  
\*\* Execute setup  
ruby setup.rb setup  
—\> lib  
—\> lib/audio  
\<— lib/audio  
\<— lib  
—\> ext  
—\> ext/sndfile  
make  
gcc -fno-common -g -Os -pipe -fno-common -pipe -fno-common -pipe  
-fno-common -I. -I/usr/lib/ruby/1.8/powerpc-darwin8.0  
-I/usr/lib/ruby/1.8/powerpc-darwin8.0  
-I/Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/ext/sndfile  
-DHAVE\_NARRAY\_H -I/usr/lib/ruby/site\_ruby/1.8/powerpc-darwin8.0 -c  
sndfile\_wrap.c  
cc -bundle -L"/usr/lib/ruby/site\_ruby/1.8/powerpc-darwin8.0"  
-L"/usr/lib" -o sndfile.bundle sndfile\_wrap.o -lruby -lsndfile  
-lpthread -ldl -lobjc  
/usr/bin/ld: Undefined symbols:  
\_cNArray  
\_na\_sizeof  
collect2: ld returned 1 exit status  
make: \*\*\* [sndfile.bundle] Error 1  
setup.rb:656:in `command': system("make") failed (RuntimeError) from setup.rb:665:in`make’  
from setup.rb:1286:in `setup_dir_ext' from setup.rb:1498:in` **send** ’  
from setup.rb:1498:in `traverse' from setup.rb:1496:in`dive\_into’  
from setup.rb:1496:in `traverse' from setup.rb:1500:in`traverse’  
from setup.rb:1499:in `each' ... 8 levels... from setup.rb:827:in` **send** ’  
from setup.rb:827:in `invoke' from setup.rb:774:in`invoke’  
from setup.rb:1544  
rake aborted!  
Command failed with status (1): [ruby setup.rb setup]  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:567:in `sh' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:566:in`call’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:574:in `sh' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:657:in`sh’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:652:in `sh' /Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/rakefile:18 /Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/rakefile:17:in`call’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:202:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:209:in  
`invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:208:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:844:in `send' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:844:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:208:in  
`invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:201:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:209:in  
`invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:208:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:844:in `send' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:844:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:208:in  
`invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:201:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in`invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in`each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.0/bin/rake:7 /usr/bin/rake:18:in`load’  
/usr/bin/rake:18

\*\*\*FYI, here is my .bash\_profile

~/desktop/toscan/ruby-audio-0.1.1\>cat ~/.bash\_profile  
PS1="\w\>"  
export DEVKITPRO=/opt/local/devkitpro  
export DEVKITARM=$DEVKITPRO/devkitARM  
export LIBNDS=$DEVKITPRO/libnds  
export PAPATH=$DEVKITPRO/PAlib  
export HAMDIR=/ham  
export SVN\_EDITOR=mate  
PATH=$PATH:/usr/local/mysql/bin:/opt/local/bin:$HAMDIR/tools/macos/:/opt/local/devkitpro/devkitARM/bin/  
alias cp=‘cp -i’  
alias rm=‘rm -i’  
alias mv=‘mv -i’  
alias ls=‘ls -a -F’

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 24, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/4 "2006-07-24T22:37:47Z")

</div>

Mike Spears wrote:

> Hi Hans,
> 
> Thanks for responding!
> 
> I have looked around my system and I can’t find any other ruby  
> installations except for the one in /usr/lib. I’ll look at the  
> Makefile to see what I can do.
> 
> I am using narray-0.5.8 and SWIG 1.3.27.  
> Here is the full rake output, followed by the contents of my .bash\_profile.

Odd. As I’m running tiger (10.4.7) as well and it works fine, I think  
perhaps you haven’t fixed your ruby to compile C extensions yet. I get a  
different compilation command than you do. Google for “ruby fix osx” or  
just do “gem install fixrbconfig”

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 25, 2006, 4:15pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/5 "2006-07-25T16:15:45Z")

</div>

> Odd. As I’m running tiger (10.4.7) as well and it works fine, I think  
> perhaps you haven’t fixed your ruby to compile C extensions yet. I get a  
> different compilation command than you do. Google for “ruby fix osx” or  
> just do “gem install fixrbconfig”

Interesting - what does your compilation command look like?

I think I have tried the ‘fixrbconfig’ trick in the past in order to  
install Rails, but I tried it again anyway and it didn’t help. So  
instead, I tried clearing out the OSX install of Ruby and installing  
1.8.4 from [ruby-lang.org](http://ruby-lang.org) (and then reinstalling narray in the new  
location). I can get the extension to compile now, but when I try to  
use it, I get the  
following error:

~/Desktop/toscan/ruby-audio-0.1.1\>irb  
irb(main):001:0\> require ‘sndfile’  
dyld: NSLinkModule() error  
dyld: Symbol not found: \_cNArray  
Referenced from:  
/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.7.0/sndfile.bundle  
Expected in: flat namespace

Trace/BPT trap

Here is the rake output:

~/Desktop/toscan/ruby-audio-0.1.1\>rake  
(in /Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1)  
ruby setup.rb config  
—\> lib  
—\> lib/audio  
\<— lib/audio  
\<— lib  
—\> ext  
—\> ext/sndfile  
/usr/local/bin/ruby  
/Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/ext/sndfile/extconf.rb  
/usr/include/sndfile.h:278: Warning(451): Setting const char \* member  
may leak memory.  
/usr/include/sndfile.h:279: Warning(451): Setting const char \* member  
may leak memory.  
/usr/include/sndfile.h:300: Warning(451): Setting const char \* member  
may leak memory.  
checking for sf\_open() in -lsndfile… yes  
checking for narray.h… yes  
creating Makefile  
\<— ext/sndfile  
\<— ext  
ruby setup.rb setup  
—\> lib  
—\> lib/audio  
\<— lib/audio  
\<— lib  
—\> ext  
—\> ext/sndfile  
make  
gcc -fno-common -g -O2 -pipe -fno-common -I.  
-I/usr/local/lib/ruby/1.8/powerpc-darwin8.7.0  
-I/usr/local/lib/ruby/1.8/powerpc-darwin8.7.0  
-I/Users/samesimilar/Desktop/toscan/ruby-audio-0.1.1/ext/sndfile  
-DHAVE\_NARRAY\_H  
-I/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.7.0 -c  
sndfile\_wrap.c  
cc -dynamic -bundle -undefined suppress -flat\_namespace  
-L"/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.7.0"  
-L"/usr/local/lib" -o sndfile.bundle sndfile\_wrap.o -lsndfile -ldl  
-lobjc  
\<— ext/sndfile  
\<— ext  
Loaded suite  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake/rake\_test\_loader  
Started  
…E…  
Finished in 0.117749 seconds.

1. Error:  
test\_enums(SndfileTest):  
NameError: uninitialized constant SndfileTest::SF\_FORMAT\_FLAC  
./test/test\_sndfile.rb:41:in `test\_enums’

10 tests, 102 assertions, 0 failures, 1 errors  
rake aborted!  
Command failed with status (1): [/usr/local/bin/ruby -Ilib:ext/sndfile  
"/us…]

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 25, 2006, 4:35pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/6 "2006-07-25T16:35:33Z")

</div>

Actually, never mind. It’s working now, I just realized that I have to  
use require ‘audio/sndfile’ rather than require ‘sndfile’. I was able  
to get a simple example to work; I’ll play around some more later.

Hans - I remember reading that you were insterested in wrapping  
portaudio. Are you still working on this? I have created a simple  
experimental extension to use portaudio, and I am wondering if I  
should eventually release it. I have a little oscillator object  
working as well and eventually I am going to try to get a little ‘zoo’  
of signal generators, etc. going. (Following along the same modular  
ideas as csound).

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![Mike\_Spears](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@Mike\_Spears](https://www.ruby-forum.com/u/Mike_Spears)\
**Post date:** [July 25, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/problem-building-ruby-audio-0-1-1-on-osx-10-4-7/99516/7 "2006-07-25T18:26:40Z")

</div>

Mike Spears wrote:

> ideas as csound).  
> I’m interested in seeing portaudio wrapped, yes. I have a few other  
> things on my plate first: releasing a new ruby osc lib, packaging the  
> latest csound and nyquist for debian, and various “real-life”  
> responsibilities. I might have some time this fall. In any case, if  
> you’ve already done something I’m happy to help you and maybe we can  
> integrate the result in ruby/audio (or maybe it’ll be better to keep it  
> separate).

Your signal generator zoo sounds interesting. I’ve kicked some ideas for  
a text-based modular synthesizer a la csound but easy (although not  
graphical) for some time. It’d be fun to discuss, but perhaps off-list.

For the record, my compile looks like this:

[http://pastie.caboo.se/5965](http://pastie.caboo.se/5965)
