Compiling Audacity for Beginners

From Audacity Wiki
Revision as of 17:11, 21 November 2013 by Stevethefiddle (talk | contribs) (Example compiling the latest Audacity source code on Ubuntu and derivatives (like Linux Mint): Update for autoreconf in 2.0.6)
Jump to: navigation, search
This page gives easy-to-follow steps for compiling legacy 1.3 and current Audacity on Debian-based Linux (such as Ubuntu). It also has example steps for command-line compilation of legacy Audacity 1.2 on any Unix-type system. These steps show the principles involved.
Please read this page in conjunction with the overview pages Developing On Linux and Developing On Mac.
 
Related article(s):


Compiling on Unix for total beginners

These instructions assume that you are compiling Audacity for a Unix system that uses X-Windows (X11), including Linux, FreeBSD, Solaris or similar.

Another Unix system is Mac OS X, however in order to compile Audacity to have a native Mac look-and-feel, you need to use the Mac port of wxWidgets, called wxMac. See the Developing On Mac page for the Mac-specific instructions, however some of the information on this page is still relevant if you substitute wxMac for wxGTK.

It sounds complicated, but luckily the same process works for compiling almost all Unix programs these days. You don't have to be a programmer, because most programmers have gone to a lot of trouble to make their programs compile automatically on almost any type of system. You just need to learn a few basic commands to get the process going and have a little bit of patience to fix problems if they occur.


Example compiling the latest Audacity source code on Ubuntu and derivatives (like Linux Mint)

These simple steps have been tested building Audacity 2.x on Ubuntu 11.04 (natty) and onwards including 13.04 (raring). The steps should also work with appropriate modification on most other Debian-based systems and for most legacy 1.3 versions of Audacity.

Open a terminal and type the following commands:

  1. sudo apt-get install subversion
  2. svn checkout http://audacity.googlecode.com/svn/audacity-src/trunk/ audacity-read-only
  3. sudo apt-get build-dep audacity
  4. sudo apt-get install cmake (required for Audacity 2.0.3 or later if cmake is not already installed)
  5. cd audacity-read-only
  6. ./configure
  7. sudo make install
Warning icon If "make" fails with the error libtool: link: `/usr/lib/libvamp-hostsdk.la' is not a valid libtool archive, this is due to a bug in the vamp-plugin-sdk package (known to occur in Debian Wheezy and other distributions based on this).

The solution is to delete or rename the files /usr/lib/libvamp-hostsdk.la and /usr/lib/libvamp-sdk.la. This can be done by running:

sudo rm /usr/lib/libvamp-hostsdk.la /usr/lib/libvamp-sdk.la
Warning icon On Linux Mint, a first run of "sudo apt-get build-dep audacity" may return "You must put some 'source' URIs in your sources.list". To solve this, use Menu > Preferences > Software Sources > Source Code and enable source code repositories.

The final installation step should give you the Audacity program at usr/local/bin and the plug-ins at usr/local/share/audacity.

On occasions, changes to latest Audacity HEAD may require you to regenerate the configure file before running it. To do this
  1. sudo apt-get install autoreconf
  2. ./autoreconf.sh

Prior to Audacity version 2.0.6 you would need:

  1. sudo apt-get install autogen
  2. ./autogen.sh

Extra steps for wxWidgets

Step 3 above (sudo apt-get build-dep audacity) should install the necessary wxWidgets libraries. If it doesn't, follow the below instructions.

On Debian or other versions of Ubuntu, replace the libwxgtk and python-wxgtk versions and the name of your distribution according to this list.
  1. sudo apt-get install libwxgtk2.8-dev python-wxgtk2.8

    If the relevant wxWidgets packages are accessible in the system's repository, that's all you need. If not, the packages can be manually added using the following lines:

  2. sudo apt-get install curl
  3. curl http://apt.wxwidgets.org/key.asc | sudo apt-key add -
  4. echo -e "\ndeb http://apt.wxwidgets.org/ natty-wx main\ndeb-src http://apt.wxwidgets.org/ natty-wx main" | sudo tee -a /etc/apt/sources.list
  5. sudo apt-get update

Example compiling legacy Audacity 1.2

wxWidgets

Step 1: Install the GTK-Dev-Package

For Debian you have to install libgtk1.2-dev or libgtk2.0-dev.

Try Step 2 and if you get an error message that gtk-config is not found you have to install the GTK-Dev-Package.

This will be necessary for most binary distributions where the files need to compile programs are separated (in a -dev package) from those needed to run them. To build audacity from source you will need the -dev packages for all the libraries audacity uses installed.

Step 2: Download and uncompress wxGTK

First, there's a small chance you already have wxGTK installed! Type wx-config --version at your command terminal/shell, and if it prints out version 2.4.x, you can skip to step 4! If it says "command not found" or something along those lines, keep reading...

Download wxGTK-2.4.2.tar.bz2 from http://wxwidgets.org/ (Yes, any other 2.4.x release is fine, just not 2.3.x or 2.5.x or 2.6.x) (wxGTK-2.4.2 returns 2.4 as the version number. wxGTK-2.4.0 and wxGTK-2.4.1 return version 2.4.0 and version 2.4.1. The ./configure script will fail with these two versions.) (If you are using GCC4, go to [1] to get two patches to fix your linking errors.)

Find the file you downloaded in a command terminal/shell.

Uncompress it using the "tar" program. Type "man tar" to learn more about how to use it. In this case, though, you need to type:

 tar -xvjf wxGTK-2.4.2.tar.bz2

This will create a directory called wxGTK-2.4.2 and uncompress all of the wxGTK files into it.

By the way, here were the options we just gave to tar:

x: eXtract
v: Verbose (print what it's doing, rather than just do it)
j: un-bz2 (bzip2 is a form of compression)
f: read from a file

Errors? If you have an old version of tar, you may need to do this in two steps:

bunzip2 wxGTK-2.4.2.tar.bz2
tar -xvf wxGTK-2.4.2.tar

Step 3: Configure and compile (make) wxGTK

Enter the wxGTK-2.4.2 directory using the "cd" (change directory) command:

cd wxGTK-2.4.2

Compiling wxGTK is totally automatic and takes just two steps: "configure" and "make" - but there are some options you can give it. To be safe, here are the options that we recommend for best results with Audacity;

 ./configure --disable-gtk2 --disable-unicode

This assumes that you want to install wxGTK into the /usr/local directory on your system, which is a great place to put it if you are the system administrator and want wxGTK to be available for everyone using your computer. If you're on a multi-user system and you're not the system administrator, you should tell wxGTK that you want to install it somewhere else, and now is the time to do it. I suggest creating a directory in your own home directory called "install" or something like that where you put all of the programs that you've installed locally. Supposing you called the directory "install", then, you would configure wxGTK like this:

 ./configure --disable-gtk2 --disable-unicode --prefix=/home/username/install

There are many other options to configure - to see them all, type:

 ./configure --help

Anyway, once you're done configuring (which can take a couple of minutes, depending on how fast your computer is) it's time to compile - this is done with a single command:

 make

Solaris, SGI, and other proprietary Unix users: try gmake instead

Errors? If you have errors at this stage, please ask on the wxWindows mailing lists.

wxGTK is rather large, and it could take anywhere from 2 minutes to an hour to finish compiling, depending on the speed of your computer.

Instant gratification (optional)

wxGTK comes with some sample programs. It will only take a few seconds to try one of these out if you're impatient to see some fruits of all of your labor so far. Here's how to compile and run the "minimal" sample program, assuming you're already in the wxGTK-2.4.2 directory:

 cd samples/minimal
 make
 ./minimal

There are dozens of other samples in the "samples" directory - you can run most of them just by going into their directory and typing "make". Don't forget to go back to the wxGTK-2.4.2 directory before going on to step 4:

 cd ../..

Step 4: Install wxGTK

If compiling wxGTK succeeded, you're almost done - all you need to do is copy wxGTK to some location where other programs (like Audacity) will be able to find it. If you're going to install it somewhere that anyone on the system could find and you're not currently logged in as the root user, run "sudo":

 sudo make install

But if you're a single user in a multi-user system and you're installing wxGTK to your own "install" directory, or if you're already logged in as root, then you can just type:

 make install

You're almost done with wxGTK! Type:

 sudo ldconfig

(If you were logged in as root, you can log out now and do the rest as a normal user.)

You just need to make sure that it's installed properly. To do this, type "rehash" in case you're using csh or tcsh (it won't hurt if you're not), and then try to run wx-config:

 rehash
 wx-config --version

If the wx-config line does not succeed, then you have one additional step to perform: you need to put the location of wx-config into your PATH, so that other programs can find it. Here's where you need to know whether you're running csh/tcsh or bash/ksh.

If you don't know what shell you use, type "ps" and look in the "CMD" column. You should see something like csh, tcsh, bash, or ksh there.

To add a directory to your path just requires one simple line - if you installed wxGTK in /usr/local (the default), the line is:

 csh/tcsh: setenv PATH "${PATH}:/usr/local/bin"
 bash/ksh: export PATH="${PATH}:/usr/local/bin"

(Substitute /home/username/install/bin if you installed wxGTK in /home/username/install)

However, adding the path by typing in the command will only add it temporarily. To do it permanently, you need to edit your shell's startup file. We're getting a little beyond the scope of this tutorial, but if you use csh or tcsh, you can edit .cshrc or .tcshrc in your home directory, and similarly with bash and .bashrc, ksh and .kshrc, etc. - ask on a Linux or Unix newsgroup if you're confused.

Audacity

Step 5: Download and uncompress Audacity

Checkout the legacy Audacity 1.2 source oode:

svn checkout http://audacity.googlecode.com/svn/audacity-src/branches/AUDACITY_1_2/  audacity-read-only

or download it from http://sourceforge.net/projects/audacity/files/audacity/1.2.6/audacity-src-1.2.6.tar.gz/download.

Uncompress the download using the "tar" program. Type "man tar" to learn more about how to use it. In this case, though, you need to type:

 tar -xvzf audacity-src-1.2.6.tar.gz

Errors? See the note about using bunzip2 and then tar, above. This is a gzip (.gz) archive, so the option is z rather than j as above. If you need to do it in two stages, try

 gunzip audacity-src-1.2.6.tar.gz

as the first stage.

Step 6: Configure and compile Audacity

Go into the directory that unpacking the tarball created:

 cd audacity-src-1.2.6

See the options to configure:

 ./configure --help

If you plan to install Audacity to a particular directory, you will want to use the --prefix option, described above. Pay special attention to the Optional Packages section, because if Audacity fails to compile, you may want to disable some of these packages. However, as a first attempt, run configure:

 ./configure

If that succeeds, continue with "make":

 make

If either configure or make fails, take a careful look at the lines above the error and see if any of them match any of the optional packages. For example, if you see the word "Nyquist" in the error messages at all, that's one of the optional packages you can disable. To do this, just run configure again, appending --without-packagename to remove an optional package:

 ./configure --without-nyquist

When Audacity finally builds, you can run it right away like this:

 ./audacity &

(The ampersand tells your shell to return control immediately after launching Audacity, so you can keep typing while you run it.)

Errors? If it complains about not finding wxGTK, you need one additional step. See the instructions above about how to add the path to wx-config to your PATH. You need to do the same, except you need to add the lib directory to your LD_LIBRARY_PATH. In other words, if you installed wxGTK to /usr/local, then you need to add /usr/local/lib to your LD_LIBRARY_PATH.

If you have multiple versions of wxGTK and so multiple 'wx-config' programs you can tell the audacity configure script which one to use by setting the WX_CONFIG environment variable to point to the one you want to use.

 WX_CONFIG=/usr/local/bin/wx-config ./configure

Step 7: Install Audacity

As before:

 sudo make install

...or, just:

 make install

Then, assuming that the proper directory is in your PATH, you can launch Audacity by typing "audacity" from any command prompt!


That's it

Found errors in this article? Please correct it by clicking on the "Edit" tab at the top of this page.

Need help? Ask on the Compiling Audacity forum. If all else fails, subscribe to the audacity-devel mailing list and ask there.