Difference between revisions of "Developing On Linux"

From Audacity Wiki
Jump to: navigation, search
(a few capitalisations and expand a little on libraries missing from tarballs)
(add note about SoundTouch on Ubuntu/Debian)
Line 95: Line 95:
|valign="top"|{{external|[http://www.surina.net/soundtouch/ SoundTouch]}}   
|valign="top"|{{external|[http://www.surina.net/soundtouch/ SoundTouch]}}   
|compile with [[SoundTouch]]  [default=yes]
|compile with [[SoundTouch]]  [default=yes] '''^'''
|valign="top"|{{external|[http://www.xiph.org/ogg/vorbis/ vorbis]}}       
|valign="top"|{{external|[http://www.xiph.org/ogg/vorbis/ vorbis]}}       
Line 106: Line 106:
:'''^'''  As of April 2008, Audacity pkg-config may not correctly detect the SoundTouch library on Debian and Ubuntu systems. See {{external|[http://www.nabble.com/Problem-with-libsoundtouch-td16321024.html this thread]}}.

Revision as of 08:01, 14 April 2008

Users on Linux and Unix systems often compile Audacity from source code to experiment with the latest Beta version, or even the latest code in CVS . Linux users may also need to compile either Audacity stable or Beta if there is no suitable Audacity package for their distribution. This page is a checklist of what you need to compile Audacity on Linux/Unix and the configure commands required.
If you need help with the basic steps in compiling Audacity, please see Compiling Audacity Step by Step Guide.
Related article(s):
  • Also for building with Windows, see [install-directory]\win\compile.txt
  • Developing On Mac


Compiling Audacity, or any GNU/Linux program for that matter, is basically a five stage process.

  1. Install dependencies: other software necessary to run or compile.
  2. Download the source code into a local directory.
  3. Configure the compile with options, if any.
  4. Compile
  5. Install

The first stage is crucial: it is a lack of necessary dependencies that ruins 99% of failed compiles. This page should help with that.

The standard commands to compile a piece of software for stages 3, 4 and 5 are as follows, issued from within the local directory containing the source code.

  1. CONFIGURE: $ ./configure --[options-list]
  2. COMPILE: $ make
  3. INSTALL: $ sudo make install

Obtaining Audacity

  • CVS: The other main way to get Audacity is to use CVS - this is the best way if you want to actively develop Audacity, or keep up with the latest and greatest features. For more information, see our CVS page . For a CVS interface on Mac to access our CVS repository, try MacCVS  (this needs an external SSH client if you want to commit code to our repository) or MacCVSClient . On Linux, BSD and other open source operating systems, command-line CVS clients are typically included in the default installation, or are available directly from the operating system repository.


(Note: These are for Audacity 1.3.x or CVS TRUNK, as there is no further development of the 1.2.x branch)

Audacity requires relatively few libraries and tools to build a minimum working program. There are then a larger number of option libraries that extend Audacity to enable more features and facilities. It's therefore up to you whether you install these or not. If you don't install them, then decide later you need the extra features, you will need to rebuild Audacity after installing the extra libraries.

Note that some Linux distributions make a practice of splitting each library they package into two parts, those required for running programs using the library, and all the other files only needed when compiling applications using the library. The latter are often found in a package with a -dev suffix to the name. For the purposes of these instructions, whenever a library is listed as being needed, it means that both parts are needed in order to compile Audacity.

Development Tools

Most Linux distributions come with the core set of development tools already installed, but as a minimum the following are required in order to compile Audacity:

  • Shell. The configure script for Audacity is generated for a bourne-compatible shell. It is very unlikely that your system does not have one of these, but if in doubt, install the Bash shell.
  • Make. Either GNU or BSD make will work with Audacity's makefiles, very few systems will not have one or the other.
  • gcc and g++. The C and C++ compilers from the GNU Compiler Collection . No other compilers are supported by the Audacity development team, although we welcome patches to make Audacity compile with other compilers, for example the OpenSolaris compiler.
  • gettext. In order to build the translations for Audacity the GNU gettext  tools are required. These are normally installed in order to be able to build wxWidgets (see below).


The main requirement to build Audacity is wxWidgets . Both WX 2.6 (version 2.6.3 or higher) and WX 2.8 are supported, in both Unicode and ANSI forms. If you are installing wxWidgets only in order to build Audacity, you should install the latest 2.8.x release.

Audacity supports wxGTK for Linux (and other Unices), wxMac for Mac OS X (and wxMSW for Windows using either MSVC++ or Cygwin compilers). There is no support for wxMotif, wxX11 or other wx variants, as they are incomplete in key areas. Note that wxGTK 2.8.7 had a bug in it which disabled 2.6 compatibility and caused Audacity builds to fail. This is fixed in the source included in wxPython

Note about Source Tarballs

Not all libraries that can be linked to in Audacity are included in our source tarballs, primarily because they are often already installed as system libraries on Linux systems. For example, libsndfile is a very widely used library for reading and writing WAV, AIFF and other uncompressed audio files. If you obtain Audacity via CVS, a copy of libsndfile is included in the sources, but it is not included in the source tarballs. If necessary it can be obtained from http://www.mega-nerd.com/libsndfile/  and installed on your system. Similarly, libflac, libogg, libvorbis and SoundTouch are not included in the tarballs. If you need them, use the links in the "Optional Packages" table (below).

Optional Packages

The configure script of Audacity gives the option to link in or not to link in a number of 'optional' packages. 'Optional' as some are more optional than others.

There are possibilities surrounding the following packages:

id3tag use libid3tag  for MP3 ID3 tag support
LADSPA  compile with LADSPA plug-in support [default=yes]
libflac  [local], [system], [none] - enable FLAC support [default=none]
libmad  use libmad for mp3 decoding support
libresample use libresample: [yes], [no]
libsamplerate  alternatively, use libsamplerate (instead of libresample): [local], [system], [none]
libsndfile  choose which libsndfile to use: [local], [system]
PortAudio  which version of PortAudio to use (=[v18,v19]) [stable default=v18], [Beta default=v19]    
PortMixer compile with PortMixer [default=yes]
Nyquist  compile with Nyquist support [default=yes]
SoundTouch  compile with SoundTouch [default=yes] ^
vorbis  enable ogg vorbis support
help make the help file "audacity-1.2-help.htb" [default=yes]
^ As of April 2008, Audacity pkg-config may not correctly detect the SoundTouch library on Debian and Ubuntu systems. See this thread .

The following syntax is used as a parameter to the configure script to enable or disable a package or to pass further information about the package.

--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)

The possibilities range from whether to include them or not to whether to use local or system versions. In almost all cases these are standard libraries, and only provided in CVS for convenience, so if you have up to date versions installed as shared libraries you should select the external copies. The exceptions are libresample (which is developed as part of Audacity), Nyquist (which we have modified to integrate it with Audacity), and PortAudio (which has had to be patched to make it work).


To enable support for ogg files:


To use an external sndfile library (which you have previously built and installed):


To disable Nyquist:


Compiling on Unix

To compile Audacity on Linux (or for that matter, Mac OS X and most other Unix systems), use the standard "configure; make" sequence:


However, you may want to start by running ./configure --help first to see the options, and possibly add special options.

If you are compiling from a CVS checkout, then you can re-generate the configure script by running


in the top level directory first. If this causes trouble, with errors like:

configure: warning: CC=gcc: invalid host type
configure: warning: CXX=g++: invalid host type
configure: error: can only configure for one host and one target at a time
configure: error: /bin/sh './configure' failed for lib-src/portaudio-v19

then try prefixing the configure command with "env -i":

env -i ./configure --without-portmixer --with-portaudio=v19

This appears to be fixed for Audacity 1.2.4 and onwards.

In order to use ALSA devices with PortAudio v19 (the default for Audacity 1.3.x beta) it is necessary to have the ALSA development library installed before compiling Audacity. In Ubuntu Studio, for example, this can be installed by running:

sudo apt-get install libasound2-dev

Example dependencies: Audacity 1.3.4/Ubuntu 7.10



A suggested apt-get command to install the above dependencies:

$ sudo apt-get install gettext libasound2-dev libflac-dev libflac++-dev libgtk2.0-dev libgtk-dev libid3tag0-dev libjack0.100.0-dev libmad0-dev libogg-dev libtwolame0 libtwolame-dev libvorbis-dev libwxbase2.6-dev libwxgtk-dev libwxgtk2.6-dev twolame portaudio19-dev wx2.6-headers zlib1g-dev

A suggested ./configure command for full functionality:

$ ./configure --with-libvorbis --with-libflac --with-libid3tag --with-soundtouch