Tuesday, July 14, 2009


A lot of us haven't been giving Audacity its due. We have seen it grow a lot since its earliest releases. Its cross-platform support is almost shockingly good. Maybe it's time to take it to the next level.

The first question is: How easy is it to develop for?

Let's find out:

1) Thumbs up: Google search of 'audacity' comes up with the project first.

2) Thumbs up: Developer page is two links from homepage: http://audacity.sourceforge.net/community/

3) Thumbs down: cvs as the source code tool? I don't mind myself, personally. CVS is almost entirely adequate for the purpose... If you have it installed already, you won't have to go to this suspicious link and download it via FTP. (Don't worry, little Scotty. Your browser includes the File Transfer Protocol )

4) Thumbs up again:

Type this at the command line to check out the latest beta/development source code from CVS: (1.3)

cvs -d:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity checkout audacity

I love watching the code scroll by. It's nice to see translations and FFT files. Also, the vorbis code seems to be included. No corny libs to install. Thumbs up because 'cvs checkout' command was successful and delightfully sick to watch. Some interesting looking libraries in there called "SoundTouch" and "SoundStretch", "BPMDetect."

5) Thumbs Middle for including a Read Me file, but burying build instructions down low inside it.

Reading the README.txt file. Extra libraries you can install. Special copyright for something called NyQuist? (Note: later on, I learned that Audacity is built on top of Nyquist, which is a text-file-based signal processing environment). Part 5 of the readme has build instructions.

6) Thumbs down:
First you must download wxWidgets. Audacity 1.3.8 and later requires
wxWidgets 2.8.10 from: http://wxwidgets.org

I love cross-platform GUI APIs. I just wish there had been one persistently useful one for the last 10 years? One the bright side, I guess this is one of the strong points of Audacity - its cross platform-ness. And I'm actually thankful I didn't have to go into XCode and make a project. (note, later on, I would learn that xcodebuild is required).

Thumbs down for giving me something extra to compile.

7) Thumbs up.

At least, they tell you what version you need. Download It: http://wxwidgets.org/downloads/#latest_stable or better yet: wget http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.10.zip

And on the bright side, at least they give you gz, zip, and bz2 formats. :)

7.5) It appears wxWidgets includes 8,000+ source code files...

~/Music/audacity/wxwidgets>unzip -v wxWidgets-2.8.10.zip | wc
8351 66795 851358

8) Thumbs up.

Standard build instructions for WxWidgets:

make install # as root

9) Thumbs up. WxWidgets configure script summarizes the install options for you when it's done. Classy!

OK, I hate to leave you in suspense. But. Building WxWidgets is taking forever. Reading break: Audio Power Amplifier Design Handbook.

10) Thumbs up. Hours later, and I have returned to find WxWidgets built with no errors.

Now to try to build audacity:

sudo make install

11) Thumbs down. make fails! ugh. have to look into this. Here's the error:

a/fixed_asm.o .libs/libFLAC.lax/libFLAC-asm.a/lpc_asm.o .libs/libFLAC.lax/libFLAC-asm.a/stream_encoder_asm.o -lm -install_name /usr/local/lib/libFLAC.8.dylib -compatibility_version 11 -current_version 11.0 -Wl,-single_module
ld: warning codegen in FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap.c1_loop (offset 0x0000003A) prevents image from loading in dyld shared cache
ld: warning codegen in FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap.c1_next2 (offset 0x00000012) prevents image from loading in dyld shared cache
ld: warning codegen in FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap.c2_next4 (offset 0x00000015) prevents image from loading in dyld shared cache
ld: absolute addressing (perhaps -mdynamic-no-pic) used in FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap.c1_loop from .libs/libFLAC.lax/libFLAC-asm.a/bitreader_asm.o not allowed in slidable image
collect2: ld returned 1 exit status
make[6]: *** [libFLAC.la] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [libflac-recursive] Error 2
make: *** [audacity] Error 2

real 2m27.017s
user 1m28.543s
sys 0m28.648s

12) Thumbs up.

Other people on a forum had the same issue and fixed it.

The fix is to move to the lib-flac directory and do:

sh ./configure --disable-asm-optimizations --enable-static=yes --enable-unicode=no --enable-debug=yes --with-lib-preference=local,system --with-wx-version=2.8

I do get some warnings, btw:

configure: WARNING: unrecognized options: --enable-unicode, --with-lib-preference, --with-wx-version



make clean


result in more problems, but I must sleep. Here they are for tomorrow's perusal:

opertyListener", referenced from:
_OpenAndSetupOneAudioUnit in pa_mac_core.o
_AudioDeviceSetPropertyNowAndWaitForChange in pa_mac_core_utilities.o
"_AudioHardwareGetPropertyInfo", referenced from:
_PaMacCore_Initialize in pa_mac_core.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [lib/libportaudio.la] Error 1
make[1]: *** [portaudio-v19-recursive] Error 2
make: *** [audacity] Error 2

14) Thumbs up! I found this message on the forums:

It's too bad it requires xcodebuild, but at least it still looks like a command line process. I'm going to have to try this and continue this mission.

  • I've sent a message via the audacity mailing list to answer this but it's here as well for others.

    I run a server that builds Audacity from scratch every night on OSX to check that the build process works. I probably know before anyone else whether or not the OSX build is broken.

    Currently two things need to be done to get Audacity to build.

    First, install pkg-config and make sure it's in your path. If it's not in your path Xcode won't find it and nothing will build.

    Second, ensure that you have wxMac installed and that you know where it is. You can use the libraries that Apple provide but they're old and not great.

    Do not try and build Audacity from the configure script, you wont get a fully working universal binary, use the Xcode project instead.

    Open the Xcode project, either from the command line or via the Finder.

    If wxMac is not installed to /usr/local you will have to set it up yourself

    Either open Xcode like this :-

    xcodebuild -target Audacity -configuration "Release Static" WX_PREFIX=/path/wxMac/installed/to

    or set it in xcode via the appropriate .xcconfig file or the WX_PREFIX variable in the project

    If Audacity fails to build due to missing configure macros you will need to add a file called "dirlist" to /usr/share/aclocal

    dirlist should contain a list of extra places to check for m4 macros, one per line

    Add the directory containing you pkg-config m4 macros

    Should be something like :-


    Any other problems then just send me an email.



15) Continuing the process, I found two important things.

1) you must build WxWidgets in a special way. Even though the simple ./configure;make works, you must enable certain options. By default, it won't enable unicode. By default, it will use shared libraries. It's config will look like this:

configured wxWidgets 2.8.10 for `i686-apple-darwin9.6.0'

Which GUI toolkit should wxWidgets use? mac
Should wxWidgets be compiled into single library? no
Should wxWidgets be compiled in debug mode? no
Should wxWidgets be linked as a shared library? yes
Should wxWidgets be compiled in Unicode mode? no
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.4 no
wxWidgets 2.6 yes
Which libraries should wxWidgets use?
jpeg builtin
png builtin
regex sys
tiff builtin
zlib sys
odbc no
expat sys
libmspack no
sdl no

So, instead you want to make a dir called osx-build, cd into it, then type

../configure --disable-shared --enable-static --enable-unicode

(time passes)

Ok, configure completed, but the build failed again. It was an error with libflac. So, at Mako Hill's suggestion, I re-ran configure on Audacity like this:

./configure --without-labflac

then tried to rebuild, but it hung on something else!

16) In this helpful post I found on the forums, the developer uses this variation of WxWdiget configure. Let's try it this way now:

./configure --disable-shared --enable-static --enable-unicode --disable-dependency-tracking --disable-monolithic --prefix=/Users/bcox/Development/audacity/wx/

I changed this slightly to not include the wx path, since I'm letting the defaults work.

./configure --disable-shared --enable-static --enable-unicode --disable-dependency-tracking --disable-monolithic

Great success! The configure script executed. I'm rebuilding from a clean slate (make clean;make) now.

17) Rebuilding audacity I got this error:

"_CFStringGetCString", referenced from:
_PaMacCore_GetChannelName in pa_mac_core.o
"_AudioDeviceAddPropertyListener", referenced from:
_OpenAndSetupOneAudioUnit in pa_mac_core.o
_AudioDeviceSetPropertyNowAndWaitForChange in pa_mac_core_utilities.o
"_AudioHardwareGetPropertyInfo", referenced from:
_PaMacCore_Initialize in pa_mac_core.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [lib/libportaudio.la] Error 1
make[1]: *** [portaudio-v19-recursive] Error 2
make: *** [audacity] Error 2

18) So, now I'm going to reconfigure Audacity, just in case.

damn. same error:

"_AudioHardwareGetPropertyInfo", referenced from:
_PaMacCore_Initialize in pa_mac_core.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [lib/libportaudio.la] Error 1
make[1]: *** [portaudio-v19-recursive] Error 2
make: *** [audacity] Error 2

real 3m35.501s
user 2m11.495s
sys 0m49.564s

19) Okay, it's been about three weeks and I'm trying this again. Since the errors had to do with portaudio, I decided to redownload portaudio and install it. I got it from http://www.portaudio.com/download.html and built with



sudo make install

That went 100% smoothly. Then, I went back to my audacity directory and tried make clean;make now I'm waiting patiently!

Damn! same undefined symbols in port audio:

Undefined symbols:
"_AudioDeviceRemovePropertyListener", referenced from:
_CloseStream in pa_mac_core.o
_CloseStream in pa_mac_core.o
_AudioDeviceSetPropertyNowAndWaitForChange in pa_mac_core_utilities.o
_AudioDeviceSetPropertyNowAndWaitForChange in pa_mac_core_utilities.o
_AudioDeviceSetPropertyNowAndWaitForChange in pa_mac_core_utilities.o

so, let's take a look at the command that caused it and see where it's trying to look for symbols:

gcc -dynamiclib -o lib/.libs/libportaudio.2.0.0.dylib src/common/.libs/pa_allocation.o src/common/.libs/pa_converters.o src/common/.libs/pa_cpuload.o src/common/.libs/pa_dither.o src/common/.libs/pa_debugprint.o src/common/.libs/pa_front.o src/common/.libs/pa_process.o src/common/.libs/pa_skeleton.o src/common/.libs/pa_stream.o src/common/.libs/pa_trace.o src/os/unix/.libs/pa_unix_hostapis.o src/os/unix/.libs/pa_unix_util.o src/hostapi/coreaudio/.libs/pa_mac_core.o src/hostapi/coreaudio/.libs/pa_mac_core_utilities.o src/hostapi/coreaudio/.libs/pa_mac_core_blocking.o src/common/.libs/pa_ringbuffer.o -install_name /usr/local/lib/libportaudio.2.dylib -compatibility_version 3 -current_version 3.0 -Wl,-single_module -Wl,-exported_symbols_list,lib/.libs/libportaudio-symbols.expsym

it looks like everything is expected in src/common. Let's see what's there...

...Interesting. There is no src/common! We do have this however:

~/Music/audacity/audacity>find . -name common

Before we try to point audacity at this location, let's see if the required libraries are there:

~/Music/audacity/audacity>ls lib-src/portaudio-v19/src/common/*.o
lib-src/portaudio-v19/src/common/pa_allocation.o lib-src/portaudio-v19/src/common/pa_dither.o lib-src/portaudio-v19/src/common/pa_skeleton.o
lib-src/portaudio-v19/src/common/pa_converters.o lib-src/portaudio-v19/src/common/pa_front.o lib-src/portaudio-v19/src/common/pa_stream.o
lib-src/portaudio-v19/src/common/pa_cpuload.o lib-src/portaudio-v19/src/common/pa_process.o lib-src/portaudio-v19/src/common/pa_trace.o
lib-src/portaudio-v19/src/common/pa_debugprint.o lib-src/portaudio-v19/src/common/pa_ringbuffer.o

ok, looks kind of good. I still don't understand why/how Audacity is building portaudio... And if it is, how come Audacity can make all of the objects, but can't link them properly due to source path?

hmmm. I just realized I had been using make, instead of xcodebuild, so I reissued my xcodebuild command.

Here's the newest error:

CompileC "build/Audacity.build/Release Static/libsndfile.build/Objects-normal/ppc/sndfile.o" /Users/enzo/Music/audacity/audacity/mac/../lib-src/libsndfile/src/sndfile.c normal ppc c com.apple.compilers.gcc.4_0
cd /Users/enzo/Music/audacity/audacity/mac
/Developer/usr/bin/gcc-4.0 -x c -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -DHAVE_CONFIG_H -fmessage-length=0 -mtune=G4 -mmacosx-version-min=10.4 -gdwarf-2 "-I/Users/enzo/Music/audacity/audacity/mac/build/Audacity.build/Release Static/libsndfile.build/sndfile.hmap" "-F/Users/enzo/Music/audacity/audacity/mac/build/Release Static" "-I/Users/enzo/Music/audacity/audacity/mac/build/Release Static/include" -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon "-I/Users/enzo/Music/audacity/audacity/mac/build/Audacity.build/Release Static/libsndfile.build/DerivedSources" -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c /Users/enzo/Music/audacity/audacity/mac/../lib-src/libsndfile/src/sndfile.c -o "/Users/enzo/Music/audacity/audacity/mac/build/Audacity.build/Release Static/libsndfile.build/Objects-normal/ppc/sndfile.o"
/Users/enzo/Music/audacity/audacity/mac/../lib-src/libsndfile/src/sndfile.c:38:5: error: #error "Universal binary compile detected. See http://www.mega-nerd.com/libsndfile/FAQ.html#Q018"

what the hell? I guess all we can do is go to http://www.mega-nerd.com/libsndfile/FAQ.html#Q018

Um, ok! Reading that answer, it looks like there are no easy answers. After a month or so of this, I'm finally going to stop lurking on the audacity developer's list and ask for help!

No comments: