Compiling Audacity for Beginners

From Audacity Wiki
Jump to: navigation, search
Warning icon

The instructions on this page apply only to Linux distributions based on Debian 7 (Wheezy) or earlier, such as Ubuntu versions before 15.04.

Audacity requires wxWidgets 2.8 (preferably 2.8.12), but sudo apt-get build-dep Audacity pulls in wx3.x on the latest Ubuntu (15.x and later), Mint or Debian releases. Therefore for those releses WxWidgets must be built from the source code and Audacity configured to use the 2.8 version of wxWidgets.

Current releases of Ubuntu, Mint or Debian do not include a version of FFmpeg or libav compatible with current Audacity. For FFmpeg support, a compatible version of FFmpeg 1.2 to 2.3.x (or libav 0.8 to 0.10.x) must be built from the source code.

Steve 30Apr15: ToDo-1 I don't think there is much in this page that is still relevant to current Linux distributions. In my opinion this page should be removed. As there have been frequent links to this page from the forum (and probably elsewhere) I think it preferable to replace this page with a redirect to the main "Developing on Linux" page, but I don't know how to do that.
  • Gale 30Apr15: The advantage of this page is (or was) the "simple steps". I think the autoreconf information may still be relevant. The SVN-centric steps will not be helpful for anyone building past 2.1.0 release but those steps can be changed.

    About a year ago these steps worked for me on Ubuntu 14.04 which was released a year after "Wheezy". Given 14.04 is in long term support until April 2019 I think we need to be sure before we remove the information on this page (as opposed to perhaps integrating it into Developing On Linux).

    Are you saying that sudo apt-get build-dep audacity now pulls in the wrong 3.x version of widgets on Ubuntu 15.04 (released 23Apr2015) or no longer pulls wx2.8 on Ubuntu 14.04? We can advise about that too, if so. Also if we update our widgets support to 3.x before Ubuntu 15.04 comes out of long term support, this page becomes more relevant again.

    FFmpeg was not explicitly mentioned here (and there is almost no information about it on Developing On Linux) so that is an omission rather than a reason to remove this page. My understanding is that you can build Audacity against system libav 0.8 to 0.10.x (at least on Ubuntu) if you disable dynamic loading.

  • Gale 05May15: Ubuntu 15.04 build-dep audacity pulls in wxGTK3, but 14.04 and 14.10 still pull in wx2.8. So there is ongoing value in this page for the Ubuntu LTS version when the SVN steps are updated to Git.
Gale 05May14: ToDo-2 This page is a candidate for integration with Developing On Linux.
ToDo-2
  • Steve 09April14: This page is a mess. It should be a simple walk-through for beginners. Building Audacity 1.2.x is not a task for beginners as it requires installing numerous obsolete libraries which is hard to do without wrecking the operating system. The steps are further complicated by the addition of 'conditional tasks' such as: "If "make" fails with the error libtool: link:...". It may be better to replace this page with a series of step-by-step instructions for common distros, and confined to building from a release tarball.
    • Gale 09Apr14: The 1.2 stuff will be excised after the Wiki split. It's not easy to solve all the "if's" given we accept for Linux that it "may" be legitimate to use packaged obsolete versions of Audacity 2.x if their distro of choice has long release cycles or doesn't keep Audacity updated. I certainly would not want to confine this page to building with a release tarball, though perhaps that should have primacy.

      Have we got the manpower (or experience) to maintain separate instructions for common distros? Aren't Linux Mint/*buntu/Debian the same apart from a few if's?

This page gives easy-to-follow steps for compiling Audacity on Debian-based Linux (such as Ubuntu). It also has example steps for command-line compilation of Audacity on any Unix-type system. These steps show the principles involved.
Please read this page in conjunction with the overview page Developing On Linux. The Building On Mac page is the best "getting started" guide for Mac OS X but the older instructions at Developing On Mac may still be useful in showing the principles involved.
 
Related article(s):

Contents

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.

Warning icon

The instructions on this page apply only to Linux distributions based on Debian 7 (Wheezy) or earlier, such as Ubuntu versions before 15.04.

Audacity requires wxWidgets 2.8 (preferably 2.8.12), but sudo apt-get build-dep audacity pulls in wx3.x on the latest Ubuntu (15.x and later), Mint or Debian releases. Therefore for those releses WxWidgets must be built from the source code and Audacity configured to use the 2.8 version of wxWidgets.

Current releases of Ubuntu, Mint or Debian do not include a version of FFmpeg or libav compatible with current Audacity. For FFmpeg support, a compatible version of FFmpeg 1.2 to 2.3.x (or libav 0.8 to 0.10.x) must be built from the source code.

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. The steps should also work with appropriate modification on most other Debian-based systems and for most legacy 1.3 versions of Audacity.

Gale 23Sep14: Do new Linux users on Mint know how to open a root terminal? Does that only apply to Mint?

  1. If your account is not a member of the sudo group, you will need to add your username to the sudo group. To do this, open a Root Terminal (requires password authorization). Enter the following command:
    adduser <user-name> sudo

    (where "<user-name>" is the log-in name that you wish to add). You will need to log out and back in again for this to take effect.

  2. Open a Standard Terminal (not "Root").
  3. For each of the remaining steps below, type the command indicated then press Enter:
  4. Install the Git revision control system:
    sudo apt-get install git
  5. Create a new directory in which to store the Audacity repository then change directory into that new directory, for example:
    cd audacity_git
  6. Checkout the source code, which is downloaded into a new "audacity" directory inside the directory you chose for the repository:
    git clone https://github.com/audacity/audacity
  7. Build the dependencies:
    sudo apt-get build-dep audacity

    After typing the above command, type yes (y) if you are asked to install new packages.

    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.
  8. If neither cmake or libsoxr-dev are installed:
    sudo apt-get install cmake
  9. Due to a bug in vamp-plugin-sdk package (known to occur in Debian Wheezy and other distributions based on this, if the file /usr/lib/libvamp-hostsdk.la exists, it must be deleted or renamed.
    To delete:
    sudo rm /usr/lib/libvamp-hostsdk.la
    To rename:
    sudo mv /usr/lib/libvamp-hostsdk.la /usr/lib/libvamp-hostsdk.la.bak
  10. Change to the "audacity" directory that git created:
    cd audacity
  11. For Debian Wheezy, configure with:
    ./configure --disable-dynamic-loading
    Otherwise, configure with:
    ./configure
  12. Build the application:
    make
  13. To test that it has built correctly, launch Audacity with:
    ./audacity
    (a lot of messages may appear in the terminal while Audacity is launching - that is normal).
  14. Install the application:
    sudo make install
    (The Audacity icon may not show up in the Applications menu until you log out and log back in again).
  15. The above final installation step should give you the Audacity application at usr/local/bin and the plug-ins at usr/local/share/audacity.


Warning icon On my Raspberry Pi, with version 2.0.6-alpha, I needed to do "sudo apt-get install python" to get 'python2' which is needed by lv2. YMMV. I believe that step 3 above (sudo apt-get build-dep audacity) does work if there have been no changes in dependencies since the last version, but may not get all the stuff you need if that has changed.
  • Gale: 26Mar14: Hmm, I thought "sudo apt-get build-dep audacity" should always fetch latest dependencies, unless perhaps you needed to do "sudo make clean" first, or unless the "build-dep" was not looking at a wide enough list of sources. What distro was this? I'm not sure why this should be specific to a Raspberry, though.
On occasions, changes to latest Audacity HEAD may require you to regenerate the configure file before running it. To do this, use:
  1. sudo apt-get install autoreconf
  2. autoreconf -i 

As of end December 2013, autoreconf --no-recursive or autoreconf --no-recursive -i  may be required at step 2 instead of autoreconf -i . Note that --no-recursive requires autoreconf 2.60 or later.

Alternatively you can try appending --enable-maintainer-mode to your ./configure command.

Prior to Audacity version 2.0.6 you would need:

  1. sudo apt-get install autoconf automake
  2. ./autogen.sh
  • Steve: 23Sep14: The steps below only apply to obsolete versions of Ubuntu (up to Natty, which came to the end of its life-cycle in 2012). It may be worth replacing with steps here for other distributions that don't have the convenience of sudo apt-get build-dep audacity.

=== Extra steps for wxWidgets === Step 3 above (<code>sudo apt-get build-dep audacity</code>) should install the necessary wxWidgets libraries. If it doesn't, follow the below instructions. {{hint| On Debian or other versions of Ubuntu, replace the libwxgtk and python-wxgtk versions and the name of your distribution according to [http://wiki.wxpython.org/InstallingOnUbuntuOrDebian#Supported_Distributions_and_Architectures this list].}} # <code>sudo apt-get install libwxgtk2.8-dev python-wxgtk2.8</code><br><p>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:</p> # <code>sudo apt-get install curl</code> # <code>curl http://apt.wxwidgets.org/key.asc | sudo apt-key add -</code> # <code>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</code> # <code>sudo apt-get update</code>

Example long steps

Warning icon

The instructions on this page apply only to Linux distributions based on Debian 7 (Wheezy) or earlier, such as Ubuntu versions before 15.04.

Audacity requires wxWidgets 2.8 (preferably 2.8.12), but sudo apt-get build-dep Audacity pulls in wx3.x on the latest Ubuntu (15.x and later), Mint or Debian releases. Therefore for those releses WxWidgets must be built from the source code and Audacity configured to use the 2.8 version of wxWidgets.

Current releases of Ubuntu, Mint or Debian do not include a version of FFmpeg or libav compatible with current Audacity. For FFmpeg support, a compatible version of FFmpeg 1.2 to 2.3.x (or libav 0.8 to 0.10.x) must be built from the source code.

Short wxWidgets installation

Step 1: Download wxWidgets using command line

Open a Standard Terminal and execute the following line:

 sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg

Step 2: Jump to Step 5 to download, uncompress and build Audacity

If you get an error when configuring the Audacity build that gtk-config is not found, follow the "Long wxWidgets installation" steps immediately below to install the GTK-Dev-Package.

Long wxWidgets installation

Step 1: Install the GTK-Dev-Package

For Debian you have to install libgtk1.2-dev or libgtk2.0-dev. Similarly, some distributions store all the files needed to compile applications in separate -dev packages from the files needed to run them. In that case, you must install the -dev packages for all the libraries that Audacity depends on.

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.8.x, you can skip to step 4! If it says "command not found" or something along those lines, keep reading...

Download wxGTK-2.8.12.tar.bz2 from http://wxwidgets.org/ (Yes, any other 2.8.x release is fine, just not 2.9.x or 3.0.x or 2.7.x).

If you are using GCC4, go to https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=154958 if you need to patch 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.8.12.tar.bz2

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

By the way, the options we just gave to tar do the following:

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.8.12.tar.bz2
tar -xvf wxGTK-2.8.12.tar

Step 3: Configure and compile (make) wxGTK

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

cd wxGTK-2.8.12

Compiling wxGTK is totally automatic and takes just two steps: "configure" and "make" - but there are some options you can give it.

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. You can create 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 --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 wxWidgets 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.8.12 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.8.12 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 Audacity development code:

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

or download it from http://web.audacityteam.org/download/source.

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 (for example)

 tar -xvzf audacity-minsrc-2.0.5.tar.xz

Errors? See the note about using bunzip2 and then tar, above. If you need to do it in two stages, try

 gunzip audacity-minsrc-2.0.5.tar.xz

as the first stage.

Step 6: Configure and compile Audacity

Go into the directory that unpacking the tarball created:

 cd audacity-2.0.5

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 in the on-screen help, 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 try running 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). Prior to r13510 this may give "no such file or directory" or similar. If so, change the command to:

./src/audacity & 

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

If it complains about "Missing libsndfile" run the following command in your terminal:

 sudo apt-get install libsndfile1-dev

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.

Personal tools

Donate securely by PayPal, using your credit card or PayPal account!