There have been a few requests of late on the mailing list about how to build on Snow Leopard. This is a first attempt at a working method.
NOTE: currently the universal release builds are not building but the Intel only Debug ones are.
Building wxMac
The following is a shell script that will build wxMac. Save it to a file, say buildwx.sh, make it executable
chmod u+x buildwx.sh
and run it.
It is assumed that you want to install to /usr/local. If you don’t then change PREFIX
Run it with no arguments to just build Debug static or with an argument of 1 to build all four versions.
It will ask for your password to do the installs. If you forget the script is running and leave it waiting at the password prompt for a long time the install may fail or only partially complete.
#!/bin/sh
PREFIX=/usr/local
CONF_LINE="../configure CC=gcc-4.0 CXX=g++-4.0 LD=g++-4.0 --prefix=${PREFIX}
--with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk
--with-macosx-version-min=10.4 --disable-compat26
--with-expat=builtin --with-zlib=builtin --with-regex=builtin
--enable-universal_binary=yes --enable-unicode=yes"
if [ -n "$1" ]
then
#Shared Release
rm -rf bld-ShRel
mkdir bld-ShRel
cd bld-ShRel
${CONF_LINE} --enable-static=no --enable-shared=yes --enable-debug=no
make clean
make
sudo make install
cd ..
#Static Release
rm -rf bld-StRel
mkdir bld-StRel
cd bld-StRel
${CONF_LINE} --enable-static=yes --enable-shared=no --enable-debug=no
make clean
make
sudo make install
cd ..
#Shared Debug
rm -rf bld-ShDeb
mkdir bld-ShDeb
cd bld-ShDeb
${CONF_LINE} --enable-static=no --enable-shared=yes --enable-debug=yes
make clean
make
sudo make install
cd ..
fi
#Static Debug
rm -rf bld-StDeb
mkdir bld-StDeb
cd bld-StDeb
${CONF_LINE} --enable-static=yes --enable-shared=no --enable-debug=yes
make clean
make
sudo make install
cd ..
Thanks, Paul. I posted a link to this topic on the Wiki Developing on Mac page. I’m not sure if we permanently need the wxMac script or if it’s specific to OS X 10.6, but hopefully you can advise on any permanent changes needed on the WIki page when known?
Prerequisites
You will need pkgconfig installed. By default this is not on your mac, but if you use fink or macports you may already have it in /sw/bin or /opt/bin. If you don’t have it, you’ll need to install fink. Then you can get it using fink with the command sudo apt-get pkgconfig
I believe that command should be either sudo apt-get install pkgconfig or sudo fink install pkgconfig since pkgconfig is not an apt command, but a package name.
There a few wxMac packages available from fink… As anyone have any luck building audacity svn using one of those? Or do we really need a specially patched version of wxMac?
Packages available from fink:
wxmac 2.6.4-4 Cross-platform GUI API - mac/carbon version
wxmac-shlibs 2.6.4-4 Cross-platform GUI API - mac/carbon version
wxmac28 2.8.9-5 Cross-platform GUI API - mac/carbon version
wxmac28-shlibs 2.8.9-5 Cross-platform GUI API - mac/carbon version
wxmac28-unicode 2.8.12-2 Cross-platform GUI API - mac/carbon version
wxmac28-unicode-shlibs 2.8.12-2 Cross-platform GUI API - mac/carbon version
As far as I know we must patch later Widgets with the appropriate wxMac patch in the Audacity source code. We don’t have a committed patch for 2.8.12. So I would suggest compiling 2.8.11 then applying wxMac-2.8.11.patch in our source. If this won’t work, 2.6 seems to have some evidence of building according to the Wiki.
When I try to build following this method, with slight modifications (e.g. using min mac os version 10.5 and trying to build only intel 32 bit version of audacity) I run into several problems.
wxMac (2.8.12, Debug Static) builds. I’m building that version because audacity’s build instructions tell that this is the version audacity needs.
When building audacity first errors are when building libFlac, it can’t find ogg/ogg.h
In file included from ../lib-src/libflac/src/libFLAC/include/protected/stream_decoder.h:37,
from /Users/artm/src/WTS/audacity-wts/mac/../lib-src/libflac/src/libFLAC/stream_decoder.c:57:
../lib-src/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h:35:21: error: ogg/ogg.h: No such file or directory
then when building audacity:
In file included from /Users/artm/src/WTS/wxMac/include/wx-2.8/wx/mac/private.h:4,
from /Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:50:
/Users/artm/src/WTS/wxMac/include/wx-2.8/wx/mac/carbon/private.h: In function ‘Rect* wxMacGetPictureBounds(Picture**, Rect*)’:
/Users/artm/src/WTS/wxMac/include/wx-2.8/wx/mac/carbon/private.h:1375: warning: ‘QDGetPictureBounds’ is deprecated (declared at /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawAPI.h:1958)
/Users/artm/src/WTS/wxMac/include/wx-2.8/wx/mac/carbon/private.h:1375: warning: ‘QDGetPictureBounds’ is deprecated (declared at /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawAPI.h:1958)
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp: In member function ‘virtual int QTImportFileHandle::Import(TrackFactory*, Track***, int*, Tags*)’:
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:397: error: jump to label ‘done’
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:291: error: from here
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:367: error: crosses initialization of ‘bool res’
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:318: error: crosses initialization of ‘WaveTrack** channels’
/Users/artm/src/WTS/audacity-wts/mac/../src/import/ImportQT.cpp:314: error: crosses initialization of ‘AudioBufferList* abl’
My goal is to build a custom version of audacity for a very particular setup. I could live without both FLAC and QT (that’s quicktime, right?), but I have no idea where to disable them. Is it possible from within Xcode? Or could audacity be built on Snow Leopard using the conventional “./configure --disable-… --without-…; make” method?
Update: after some fine-tuning I managed to build audacity from within Xcode with more or less default set of features. I haven’t investigated everything yet, but here are some findings:
The second of the above problems seems to have been caused by my attempt to compile with gcc 4.2. With 4.0 it doesn’t happen.
I have 64-bit versions of some of the dependencies in the /usr/local (installed with homebrew). Static build of audacity is supposed to use locally built dependencies, but the ones in /usr/local get in the way. I worked around that by adding -Z (“don’t look for libraries in system path”) to the “other linker flags” and /System/Library/Frameworks to “framework search paths” (so that system frameworks could be found).
I guess a more correct solution would involve constructing an alternative sysroot (instead of the OS SDK), with /usr hierarchy containing only 32-bit or universal 64/32 binaries. But I’m satisfied with my workaround for now.
to fix the libFLAC build problem (see my previous post) I added “…/lib-src/libogg/include” to the “header search paths” of libFLAC target. I then discovered that ogg related source files weren’t included in the target, resulting in unresolved symbols at audacity link time. I guess the intention was to disable ogg part of the library, but I didn’t know how to accomplish that. I just added the missing sources to the target and audacity got built.
I’m not sure if my solution to (3) causes other problems than the binary bloat. As I told: I’m attempting a custom build for a project which doesn’t involve FLAC at all and I will aim to remove the FLAC support from my build eventually. But at least I have a working build now.
There are not many people building audacity on Mac (as far as we know) and the building instructions on the wiki definitely need some improving. Any feedback we can get on this matter is important.
Can you tell us which exact OS-X version you have and which Xcode version? What computer?
This is not the last time I’m building it, since our intention is to make a custom version for a series of workshops. I’ll document problems / solutions as they arise.
I’m building on MacBook Pro, Snow Leopard, Xcode 3.2.6.
I’ve built wxMac 2.8.12 from the sources downloaded from wxwidgets website. I didn’t realize I needed to patch it first. I used the script from this forum with a couple of slight modifications: building outside of the source tree and installing in an alternative prefix, so it doesn’t interfere with homebrew installation in /usr/local.
I initially started to read the wiki page, but stopped at
If you are using OS X 10.6 Snow Leopard, there are some possible problems as at January 2011. See this Forum topic for the latest position including a special shell script to build wxMac
and went to this forum thread for further instructions. That’s probably why I missed the information about patching the first time around. I noticed it mentioned later, after Audacity was built already and is working as far as I can see. How important is the patch?
I think the patches are available only for wxMac versions up to 2.8.11.
I guess that 2.8.12 probably doesn’t need the patch anymore. The fact that you were able to build Audacity without any patching seems to indicate that.
I’m trying to build Audacity on a very similar environment. I was using wxMac 2.8.11. I’ll try again with 2.8.12.
is still needed for Audacity releases against 2.8.12 because it prevents a hang when Audacity scans for VST plug-ins for the first time on OS X 10.5.8 (Leopard) PPC machines. If none of your users have 10.5 PPC, you don’t need the patch.
I’ll see about committing the patch somewhere if it doesn’t get done.
Hi, thanks for the instructions, especially to plivesey. It worked for me after I made a few changes. They were necessary because I do not have 10.4 SDK installed on my computer – and it is not included by default when installing Xcode from Snow Leopard Install DVD.
In the buildwx.sh script I had to change the CONF_LINE like this:
Before building Audacity using Xcode (I was not able to build it using make), open the Audacity.xcodeproj, use Get Info on the whole project and in the Project “Audacity” Info dialog, set Base SDK to Mac OS X 10.5 on the Build page.