Page 1 of 2

Building on OSX 10.6 Snow Leopard

Posted: Tue Jan 25, 2011 10:52 pm
by plivesey
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

Code: Select all

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.

Code: Select all

#!/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 ..
Once wxMac has built and installed grab Audacity

Code: Select all

svn checkout http://audacity.googlecode.com/svn/audacity-src/trunk/ audacity
And build it

Code: Select all

xcodebuild -target Audacity -configuration "Debug Static" WX_PREFIX=/usr/local
Release is currently not working but I'm looking into it.

Paul.

Re: Building on OSX 10.6 Snow Leopard

Posted: Wed Jan 26, 2011 12:22 am
by plivesey
It would appear that something is not quite right with the project file resulting in random build failures.

This appears to help. After grabbing Audacity, build the Configure target before Audacity. This should happen automatically but is randomly failing.

Code: Select all

xcodebuild -target Configure -configuration "Debug Static" WX_PREFIX=/usr/local
xcodebuild -target Audacity -configuration "Debug Static" WX_PREFIX=/usr/local
If you get failures in libsndfile, go into that directory and

Code: Select all

touch configure.ac
You should now be able to build both release and debug simply by changing the -configuration flag.

The GUI may be a bit more forgiving than the command line so if you're having trouble with one, try the other.

Paul.

Re: Building on OSX 10.6 Snow Leopard

Posted: Thu Jan 27, 2011 8:04 pm
by Gale Andrews
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?




Gale

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Feb 22, 2011 8:39 pm
by bgravato
On the wiki page we can read:
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.

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Aug 23, 2011 2:34 am
by bgravato
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:

Code: Select all

     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

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Aug 23, 2011 11:25 pm
by Gale Andrews
bgravato wrote: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:

Code: Select all

     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
Thanks, Bruno.

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.

If you are on Snow Leopard, there is some extra information at:
http://wiki.wxwidgets.org/Development:_ ... ow_Leopard

If you are stuck and can't get an answer here I would suggest writing to audacity-devel:
https://lists.sourceforge.net/lists/lis ... city-devel



Gale

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Jan 31, 2012 12:05 pm
by artm
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

Code: Select all

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:

Code: Select all


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?

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Jan 31, 2012 5:02 pm
by artm
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:

1. 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.

2. 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.

3. 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.

Re: Building on OSX 10.6 Snow Leopard

Posted: Tue Jan 31, 2012 8:38 pm
by bgravato
Thank you artm for your feedback.

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?

Did you apply any patch to wxmac before building?

Did you follow the instructions on the wiki here: http://wiki.audacityteam.org/wiki/Developing_On_Mac

Did you use the script on top of this thread to build wxmac?

Any other detail you can remember could be helpful.

Thanks.

Re: Building on OSX 10.6 Snow Leopard

Posted: Fri Feb 03, 2012 10:26 am
by artm
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?