Compiling For Mac

Building and customizing Audacity from the source code.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Compiling For Mac

Permanent link to this post Posted by NickMtl » Sat Jan 03, 2009 5:42 am

I finally decided to contribute to Audacity. Unfortunately, the build process for Mac is totally broken.

* I have a white Macbook running 10.5.6 and I've been successfully developping all kind of Mac software, so I know that my Xcode installation works great.
* I have successfully installed and compiled wxMac-2.8.9
* I have downloaded the latest version via CVS

* Whenever I ty to compile from the command line or from Xcode, I get an error saying that pkg-config could not be found.

----
checking for pkg-config... no
configure: error: pkg-config is required to compile audacity!
----

* On the Mac, pkg-config 0.21 is automatically installed in all systems (at least it was on mine).
* Do you actually have people testing the Mac compiling process from Xcode?
* Is it looking for pkg-config in a non-standard location on the Mac?
* How could this be fixed?

-----

Audacity is such a great project, but if compiling was more straightforward, it wud get more contributors.

- Nick -


Thanks
NickMtl
 
Posts: 2
Joined: Sat Jan 03, 2009 5:28 am
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by plivesey » Sun Jan 04, 2009 12:03 am

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 :-

/PATH PKG-CONFIG INSTALLED TO/share/aclocal

Any other problems then just send me an email.

Regards,

Paul.
plivesey
 
Posts: 29
Joined: Thu Jan 03, 2008 1:19 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by NickMtl » Sun Jan 04, 2009 4:38 pm

As it turned out, a recent install of Fink was the cause of my problem. Removing Fink and installing MacPort resolved the issue. I'm not sure what's wrong with Kink, but I prefer to use what other Audacity users are using.

Paul, I think you should also just add this to the Wiki OS-X compiling page, where most people will go for help. You should also mention the recent patch to apply to wxMac so that people can just compile wxMac once.

Thanks for your great work,

- Nick -
NickMtl
 
Posts: 2
Joined: Sat Jan 03, 2009 5:28 am
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by bcox » Tue Mar 31, 2009 8:22 am

I was running into a similar problem using Fink tonight.

If you use fink, you've probably installed pkg-config into /sw/bin/. I long ago I added that directory to my PATH in my .profile file and could successfully configure audacity from the command line. While I could configure audacity from the command line, XCode would error out, complaining that it couldn't find pkg-config.

XCode doesn't load your PATH customizations from ~/.profile, nor does it look in /etc/paths. In order to fix this problem, you'll need to update your PATH so that XCode can see the changes.

Here's an article describing how to make the change:
http://developer.apple.com/qa/qa2001/qa1067.html
bcox
 
Posts: 3
Joined: Tue Mar 31, 2009 5:44 am
Location: San Francisco, CA
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by dusty » Mon May 25, 2009 4:11 pm

plivesey wrote: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.


I'm really new to the Mac development environment. I've been programming since the early 1980s. I used to use a several flavors of UNIX before 1994, but have been working on Windows ever since - so I really do need some detailed help to get started. I have had a Mac at home since the early 1990s, and just bought an IMac a month ago. So, now I have Mac OS 10.5.7, and XCode 3.0, wxWidgets/wxMac 1.8.10, Audacity 3.4.x (just downloaded), and pkg-config 0.23.

My question: how do I properly install pkg-config on my Mac? Then, how do I make sure that XCode can find it in the "$PATH" environment variable that XCode is using? When I try to build audacity, all I get is the error
checking for pkg-config... no
configure: error: pkg-config is required to compile audacity!

Hope someone can help me!
Thanks,
Dusty
dusty
 
Posts: 2
Joined: Mon May 25, 2009 3:04 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by plivesey » Mon May 25, 2009 4:18 pm

OK,

I'll need a little extra information. How did you install pkg-config?

Regards,

Paul.
plivesey
 
Posts: 29
Joined: Thu Jan 03, 2008 1:19 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by dusty » Mon May 25, 2009 4:34 pm

After downloading the file and placing it in /Users/John/Development/pkg-config, I opened up the Terminal window, and ran the following steps
cd /Users/John/Development/pkg-config
tar xvf pkg-config-0.23.tar
cd pkg-config-0.23
./configure
make
sudo make install

Any suggestions?

Dusty
dusty
 
Posts: 2
Joined: Mon May 25, 2009 3:04 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by plivesey » Mon May 25, 2009 4:44 pm

OK,

From memory pkg-config install to /usr/local by default.

So, you need to add /usr/local/bin to your path.

Assuming that your shell is bash, you can either add it on the commend line

export PATH=$PATH:/usr/local/bin
and then run xcode from the shell or a more permanent fix is to add it to one of your start up scripts.

$HOME/.bashrc is as good a place as any to add the above line.

You may need to log out and back in again for this to take effect in Xcode.

Regards,

Paul.
plivesey
 
Posts: 29
Joined: Thu Jan 03, 2008 1:19 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by guitarguy91403 » Fri Nov 20, 2009 5:36 pm

Hello,

I am trying to compile Audacity for Mac OS X 10.5.8

I've downloaded and installed:
pkg-config-0.23
wxMac-2.8.10

When I try to compile Audacity from the command line with the following line in the mac/compile.txt file:
Code: Select all
./configure --enable-static

I receive the output:
Code: Select all
...
checking for a BSD-compatible install... /usr/bin/install -c
checking for pkg-config... yes
checking for a sed that does not truncate output... /usr/bin/sed
...

And notice that the shell DOES find pkg-config.
However, it returns the following:

Code: Select all
checking for wx-config... /usr/bin/wx-config

  Warning: No config found to match: /usr/bin/wx-config --static=yes --unicode=yes --version
           in /usr/lib/wx/config
  If you require this configuration, please install the desired
  library build.  If this is part of an automated configuration
  test and no other errors occur, you may safely ignore it.
  You may use wx-config --list to see all configs available in
  the default prefix.

configure: Checking that the chosen version of wxWidgets is 2.8.x
configure: error: Unable to locate a suitable configuration of wxWidgets v2.8.x or higher.
The currently available configurations are listed below.  If necessary, either
install the package for your distribution or download the latest version of
wxWidgets
from http://wxwidgets.org.

    Default config is mac-unicode-debug-2.8

  Default config will be used for output

continuing with the terminal, I then try the command:
Code: Select all
make

which returns the error:
Code: Select all
make: *** No targets specified and no makefile found.  Stop.


So, I then try using the mac/Audacity.xcodeproj
and when I click "Build" it returns the error:

Code: Select all
configure: error: pkg-config is required to compile audacity!

I confess I am a newbie, so I created a file called .bashrc in my home directory and added the one line:
Code: Select all
export PATH=$PATH:/usr/local/bin

That did not seem to work either.

What am I doing wrong? Or, how can I compile Audacity?

Thank you for your help!
Maximum respect,
GuitarGuy91403
guitarguy91403
 
Posts: 10
Joined: Fri Nov 20, 2009 5:21 pm
Operating System: Please select

Re: Compiling For Mac

Permanent link to this post Posted by plivesey » Fri Nov 20, 2009 5:52 pm

OK, the error you got is cryptic but correct.

When you say you've installed wxMac 2.8.10, exactly which version? wxMac can be built as release or debug, ansi or unicode and dynamically or statically; giving a total of 8 different combinations. What you've asked audacity to build with is a static, unicode and release version of wxMac which can't be found.

For ease, I find it easiest to build all four unicode versions of wxMac.

This should do that for you, put it in a script and run it, remembering to set PREFIX up first

#!/bin/sh
#export MACOSX_DEPLOYMENT_TARGET=10.4
#export NEXT_ROOT="/Developer/SDKs/MacOSX10.4u.sdk"
#export C_INCLUDE_PATH="/Developer/SDKs/MacOSX10.4u.sdk/usr/include"
#export LIBRARY_PATH="/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/darwin/3.3"
#export CPPFLAGS="-DMAC_OS_X_VERSION_MAX_ALLOWED=1040 -mmacosx-version-min=10.4"
#export CFLAGS="-DMAC_OS_X_VERSION_MAX_ALLOWED=1040 -isysroot $NEXT_ROOT
#-mmacosx-version-min=10.4"
#export CXXFLAGS="-DMAC_OS_X_VERSION_MAX_ALLOWED=1040 -isysroot $NEXT_ROOT
#-mmacosx-version-min=10.4"
#export LDFLAGS="-DMAC_OS_X_VERSION_MAX_ALLOWED=1040
#-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -flat_namespace"
#export MAKEFLAGS="-j 7"

#SET UP THE FOLLOWING LINE
PREFIX=/Wherever/you/want/it/to/be/installed/to
CONF_LINE="../configure --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 ..

#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 ..
fi

#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 ..
#rm -rf bld

Other things to note, Audacity requires a slightly patched version of wxMac. the patch file is held in the Audacity source tree and is called wxMac-2.8.10.patch
This patch needs to be applied to the wxMac source tree before you can get a version that will work properly.

I hope that this helps,

Paul.
plivesey
 
Posts: 29
Joined: Thu Jan 03, 2008 1:19 pm
Operating System: Please select

Next

Return to Compiling Audacity



Who is online

Users browsing this forum: No registered users and 1 guest