Problem building ruby-audio-0.1.1 on OSX 10.4.7

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.

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.

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:inmake’
from setup.rb:1286:in setup_dir_ext' from setup.rb:1498:insend
from setup.rb:1498:in traverse' from setup.rb:1496:indive_into’
from setup.rb:1496:in traverse' from setup.rb:1500:intraverse’
from setup.rb:1499:in each' ... 8 levels... from setup.rb:827:insend
from setup.rb:827:in invoke' from setup.rb:774:ininvoke’
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:incall’
/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:insh’
/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:incall’
/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:ineach’
/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:ininvoke’
/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:ininvoke’
/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:ineach’
/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:ineach’
/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:ininvoke’
/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:ininvoke’
/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:ineach’
/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:ineach’
/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:ininvoke’
/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:ininvoke’
/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:ineach’
/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:inload’
/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’

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”

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 (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…]

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs