Difference between revisions of "Developing On Mac"

From Audacity Wiki
Jump to: navigation, search
(fix link syntax - should be url before link text)
(Restoring overwritten changes from penultimate revision and add gcc 4.0 info)
Line 8: Line 8:
  
 
===Prerequisites===
 
===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 [http://www.finkproject.org/download/index.php?phpLang=en fink].  Then you can get it using fink with the command: {{Codelist|sudo apt-get pkgconfig}}
+
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 [http://www.finkproject.org/download/index.php?phpLang=en fink].  Then you can get it using fink with the command {{Codelist|sudo apt-get pkgconfig}}
 
Alternatively you can use [http://www.macports.org/ macports] to install it.
 
Alternatively you can use [http://www.macports.org/ macports] to install it.
  
Generally it seems easier to build a native PPC or Intel version than a Universal Binary. This scenario is reported to build from [http://code.google.com/p/audacity/source/browse/ SVN HEAD] as a Universal Binary on both Power PC and Intel Mac on OS X 10.5.1, using Xcode 3 and wxMac 2.8.10, or the OS X 10.5.1 wxWidgets shared library.  The general principles are:  
+
Generally it seems easier to build a native PPC or Intel version than a Universal Binary. This scenario is reported to build from [http://code.google.com/p/audacity/source/browse/ SVN HEAD] as a Universal Binary on both Power PC and Intel Mac on OS X 10.5.1, using Xcode 3 and either wxWidgets 2.6.4 or 2.8.10, or the OS X 10.5.1 wxWidgets shared library.  The general principles are:  
<ol>
+
:1 Setup wxWidgets
<li>Create a wx directory in your audacity directory.  For example:  $HOME/audacity/wx
+
:1.1 -Create a wx directory in your audacity directory.  For example:  $HOME/audacity/wx
<li>Patch the wxMac2.8.10 bz doing the following:{{Codelist|cd /path/to/wxMac-2.8.10<br>patch -p1 < /path/to/audacityrepos/mac/wxMac-2.8.10.patch<br>}}
+
:1.2 -Patch the wxMac2.8.10 bz doing the following
<li>Build wxWidgets from the command line. Make a build directory inside the wxWidgets directory and from there run (without the line breaks):
+
{{Codelist|cd /path/to/wxMac-2.8.10<br>
 +
patch -p1 < /path/to/audacityrepos/mac/wxMac-2.8.10.patch<br>
 +
}}
 +
:1.3 -Build wxWidgets from the command line. Make a build directory inside the wxWidgets directory and from there run (without the line breaks):
 
{{Codelist|<nowiki> ../configure --disable-shared --enable-universal_binary</nowiki><br><nowiki>
 
{{Codelist|<nowiki> ../configure --disable-shared --enable-universal_binary</nowiki><br><nowiki>
 
--prefix=/path/to/audacity-beta/wx/ --enable-static --enable-unicode</nowiki>&nbsp;<br><nowiki>
 
--prefix=/path/to/audacity-beta/wx/ --enable-static --enable-unicode</nowiki>&nbsp;<br><nowiki>
 
--disable-dependency-tracking --disable-monolithic --enable-debug</nowiki>}}<br>
 
--disable-dependency-tracking --disable-monolithic --enable-debug</nowiki>}}<br>
</ol>
+
{{Hint|1='''For wxWidgets 2.6.x:'''
 +
# add <i>'''--with-expat=builtin'''</i>&nbsp; to the above
 +
# in utils/wxrc/Makefile add <i>'''-mmacosx-version-min=10.4'''</i>&nbsp; to the CXX = g++ line (25)
 +
# change the <nowiki>#</nowiki>define of ICONV_CHAR_CAST in src/common/strconv.cpp to: <br><i><b><nowiki>#define ICONV_CHAR_CAST(x) ((const char **)(x))</nowiki></b></i>}}<br>
 +
:2. Do make followed by make install (by typing 'make', then 'make install'.  If you have the wx-prefix outside of your home directory you may need 'sudo make install' instead, which will prompt you for a password.)
 +
:3. Open the audacity.xcodeproj file.  You should create a text file called Debug_Static.xcconfig in the same directory as the project file, and add the line to this text file to include the path you specified as --prefix when building wxMac.  For example 'WXPREFIX = /path/to/audacity/wx'.
 +
:3.5. If you get an error saying that pkg-config is required, you need to add the path of pkg-config on your system to the XCode settings by adding the line 'PATH = /sw/bin:$PATH' (if you use fink) to the .xcconfig file (in the project's XCode settings folder.  It may also be in /opt/bin if you use macports vs fink.
 +
 
 +
:4. Compile Audacity 1.3.4 using Xcode. Open the latest Xcode project file and update it if required. In the list of targets do a "Get Info" on Audacity and Configure. You may need to change a few "User-Defined" settings. Most of the Wx ones need changing to which version of wxWidgets you've chosen and the path that you set above in --prefix when building it. You may have to change the CONFIG_STATIC and CONFIG_UNICODE in Configure. Most of the settings required for these variables can be gained from running wx-config --libs, --ld or --cflags.  Also note that if using 10.6 you may have to set xcode to use gcc 4.0 instead of 4.2 in your project settings.
  
 
=== Help ===  
 
=== Help ===  

Revision as of 15:31, 24 May 2010

Related articles:


Latest position building from SVN HEAD

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

Alternatively you can use macports to install it.

Generally it seems easier to build a native PPC or Intel version than a Universal Binary. This scenario is reported to build from SVN HEAD as a Universal Binary on both Power PC and Intel Mac on OS X 10.5.1, using Xcode 3 and either wxWidgets 2.6.4 or 2.8.10, or the OS X 10.5.1 wxWidgets shared library. The general principles are:

1 Setup wxWidgets
1.1 -Create a wx directory in your audacity directory. For example: $HOME/audacity/wx
1.2 -Patch the wxMac2.8.10 bz doing the following
cd /path/to/wxMac-2.8.10

patch -p1 < /path/to/audacityrepos/mac/wxMac-2.8.10.patch

1.3 -Build wxWidgets from the command line. Make a build directory inside the wxWidgets directory and from there run (without the line breaks):
../configure --disable-shared --enable-universal_binary
--prefix=/path/to/audacity-beta/wx/ --enable-static --enable-unicode 
--disable-dependency-tracking --disable-monolithic --enable-debug

For wxWidgets 2.6.x:
  1. add --with-expat=builtin  to the above
  2. in utils/wxrc/Makefile add -mmacosx-version-min=10.4  to the CXX = g++ line (25)
  3. change the #define of ICONV_CHAR_CAST in src/common/strconv.cpp to:
    #define ICONV_CHAR_CAST(x) ((const char **)(x))

2. Do make followed by make install (by typing 'make', then 'make install'. If you have the wx-prefix outside of your home directory you may need 'sudo make install' instead, which will prompt you for a password.)
3. Open the audacity.xcodeproj file. You should create a text file called Debug_Static.xcconfig in the same directory as the project file, and add the line to this text file to include the path you specified as --prefix when building wxMac. For example 'WXPREFIX = /path/to/audacity/wx'.
3.5. If you get an error saying that pkg-config is required, you need to add the path of pkg-config on your system to the XCode settings by adding the line 'PATH = /sw/bin:$PATH' (if you use fink) to the .xcconfig file (in the project's XCode settings folder. It may also be in /opt/bin if you use macports vs fink.
4. Compile Audacity 1.3.4 using Xcode. Open the latest Xcode project file and update it if required. In the list of targets do a "Get Info" on Audacity and Configure. You may need to change a few "User-Defined" settings. Most of the Wx ones need changing to which version of wxWidgets you've chosen and the path that you set above in --prefix when building it. You may have to change the CONFIG_STATIC and CONFIG_UNICODE in Configure. Most of the settings required for these variables can be gained from running wx-config --libs, --ld or --cflags. Also note that if using 10.6 you may have to set xcode to use gcc 4.0 instead of 4.2 in your project settings.

Help

Ask on the Compiling Audacity section of our Forum or subscribe to our audacity-devel mailing list and ask there.

Old information

For wxWidgets 2.6.x

  1. add --with-expat=builtin  to the above in utils/wxrc/Makefile
  2. add -mmacosx-version-min=10.4  to the CXX = g++ line (25)
  3. change the #define of ICONV_CHAR_CAST in src/common/strconv.cpp to:
    #define ICONV_CHAR_CAST(x) ((const char **)(x))
  4. Do make followed by make install.
  5. Open the audacity.xcodeproj file. You should create a text file called Debug_Static.xcconfig in the same directory as the project file, and add the line to this text file to include the path you specified as --prefix when building wxMac. For example 'WXPREFIX = /path/to/audacity/wx'.
  6. If you get an error saying that pkg-config is required, you need to add the path of pkg-config on your system to the XCode settings by adding the line 'PATH = /sw/bin:$PATH' (if you use fink) to the .xcconfig file (in the project's XCode settings folder. It may also be in /opt/bin if you use macports vs fink.
  7. Compile Audacity 1.3.4 using Xcode. Open the latest Xcode project file and update it if required. In the list of targets do a "Get Info" on Audacity and Configure. You may need to change a few "User-Defined" settings. Most of the Wx ones need changing to which version of wxWidgets you've chosen and the path that you set above in --prefix when building it. You may have to change the CONFIG_STATIC and CONFIG_UNICODE in Configure. Most of the settings required for these variables can be gained from running wx-config --libs, --ld or --cflags.

If further problems are encountered: please view this thread  on the Audacity Forum .

Broken script to build Universal Binary

A script  was available that built a Universal Binary version of Audacity on OS X 10.4. The script started with a wxMac-2.6.4 tarball, downloaded a fresh copy of Audacity from CVS, compiled both targets separately, merged them into the universal binary, and finally made the disk image.

As of 1 Nov 08 the script was broken, Audacity head being built using wx 2.8.10.