Difference between revisions of "Developing On Linux"

From Audacity Wiki
Jump to: navigation, search
m (Obtaining Audacity: for development CVS is the only sensible place to start from. Add CVS command to avoid going off-wiki for it)
(re-order first half of page (up to the optional libraries page).)
Line 24: Line 24:
 
#INSTALL:  $ sudo make install
 
#INSTALL:  $ sudo make install
  
== Obtaining Audacity ==
+
== Build Tools ==
For development you will always want to obtain the CVS version of Audacity so you can stay abreast of the latest changes. For more information, see our {{external|[http://audacity.sourceforge.net/community/developers#cvs CVS page]}}. For a CVS interface on Mac to access our CVS repository, try {{external|1=[http://sourceforge.net/project/showfiles.php?group_id=10072&package_id=13913&release_id=534524 MacCVS]}} (this needs an external SSH client if you want to commit code to our repository) or {{external|1=[http://www.heilancoo.net/MacCVSClient/ MacCVSClient]}}.
+
Most Linux distributions come with the core set of development tools already installed, but if not you will need to install the following packages, probably from your distribution's package manager:
 
+
* '''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.
A typical command to check out the current development version of Audacity from CVS would be
+
* '''GNU Make''' Other Makes may work, but may well not. Make on any Linux system will be GNU make.
cvs -d:pserver:[email protected]:/cvsroot/audacity checkout audacity
+
* '''GCC''' (at least the C and C++ compilers) The {{external|[http://gcc.gnu.org/ GNU Compiler Collection]}} The only other compiler supported by the Audacity development team is Microsoft's Visual C++, although we welcome patches to make Audacity compile with other compilers, for example the OpenSolaris compiler.
If you have an old version of CVS and are prompted for a password then just press Enter as there is no password for read-only (anonymous) CVS access.
+
* '''pkg-config'''
 
+
* '''Autoconf''' Program which writes configure scripts. Needed to modify [[Audacity Configure Script|the build system]]
== Prerequisites ==
+
* '''Automake''' Program which writes Makefiles. Needed to modify [[Audacity Configure Script|the build system]]
(Note: These are for Audacity 1.3.x or CVS TRUNK, as there is no further development of the 1.2.x branch)
+
* '''CVS''' Source code version control program
 +
* '''Patch''' Program for applying patches to files
 +
* '''GDB''' The GNU Debugger (for debugging crashes)
 +
* '''gettext'''. In order to build the translations for Audacity the {{external|[http://www.gnu.org/software/gettext/ GNU gettext]}} tools are required. These are normally installed in order to be able to build wxWidgets (see below).
  
 +
== Dependencies ==
 
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.
 
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.
 
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 ===
+
=== Prerequisites ===
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:
+
These libraries are required to build 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.
+
==== WxWidgets ====
* '''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 {{external|[http://gcc.gnu.org/ 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 {{external|[http://www.gnu.org/software/gettext/ GNU gettext]}} tools are required. These are normally installed in order to be able to build wxWidgets (see below).
 
 
 
=== WxWidgets ===
 
 
The main requirement to build Audacity is {{external|[http://wxwidgets.org/ wxWidgets]}}. WX 2.8 is required, preferably 2.8.9 or later. Both Unicode and ANSI forms should work, although all development is against Unicode builds (the default for WX).
 
The main requirement to build Audacity is {{external|[http://wxwidgets.org/ wxWidgets]}}. WX 2.8 is required, preferably 2.8.9 or later. Both Unicode and ANSI forms should work, although all development is against Unicode builds (the default for WX).
  
 
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. If using wxGTK then the GTK+ headers will also be needed as Audacity includes extensions to wxGTK which require the underlying toolkit headers to compile.
 
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. If using wxGTK then the GTK+ headers will also be needed as Audacity includes extensions to wxGTK which require the underlying toolkit headers to compile.
 +
 +
Whilst building Audacity with a standard distribution-supplied wxGTK package will work fine, it will be difficult to debug, because there will be no debugging information for wxGTK. To obtain this debugging information you should build wxGTK from source in a separate directory, then tell the Audacity configure script to use that copy of wxGTK rather than the system one. ** Add a link to a page explaining how to do this **
  
 
We also have some notes on the libraries already supplied with different [[Linux Distributions]].  For example, Ubuntu tend to update to newer libraries sooner than Debian do.
 
We also have some notes on the libraries already supplied with different [[Linux Distributions]].  For example, Ubuntu tend to update to newer libraries sooner than Debian do.
 +
==== libsndfile ====
 +
{{external|[[http://www.mega-nerd.com/libsndfile/ libsndfile]}} is required to build Audacity. It is almost certainly already installed on your system, although you may have to install the development package (see above). It is rarely necessary to compile libsndfile from source, although a slightly patched version is also included in Audacity CVS.
  
=== Note about Source Tarballs ===
+
=== Optional Packages ===
 
 
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 {{external|[http://www.mega-nerd.com/libsndfile/ 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).
 
 
 
=== The configure script ===
 
Audacity uses GNU Autoconf to generate the configure script. For more information on how the script is constructed see the [[Audacity Configure Script]] page. This includes details of the tools needed in order to re-generate the configure script from it's source files (necessary if you need to modify the script from some reason).
 
 
 
== 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:
 
  
 +
The configure script of Audacity gives the option to link in or not to link in a number of optional packages. In a few cases there is a choice of two packages but one or the other must be used (not neither and not both).
  
 
{| style="background:#F9F9F9; border:1px solid #CCCCCC" cellpadding="5 px"
 
{| style="background:#F9F9F9; border:1px solid #CCCCCC" cellpadding="5 px"
 +
|-
 +
|valign="top"|--with-libsamplerate
 +
|use {{external|1=[http://www.mega-nerd.com/SRC/index.html libsamplerate]}} instead of libresample for sample rate conversion. Should not be used if binary plug-in support is also enabled for licensing reasons.
 
|-
 
|-
 
|valign="top"|id3tag
 
|valign="top"|id3tag
Line 110: Line 106:
 
|}
 
|}
  
:<div style="width:70%;font-size:90%">'''^'''  As of May 2008, Audacity pkg-config will not correctly detect the SoundTouch library on Debian and Debian-derived systems like Ubuntu, due to a {{external|1=[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476699 Debian bug]}}. '''Workround:''' Using CVS from 5th May 2008 or later, either install the latest version of libSoundTouch (1.3.1), or symlink the installed file (/usr/lib/pkgconfig/libSoundTouch.pc) to the correct file name (/usr/lib/pkgconfig/soundtouch-1.0.pc). For example:</div>
+
== Obtaining Audacity ==
{{code|sudo ln -s /usr/lib/pkgconfig/libSoundTouch.pc  &nbsp; /usr/lib/pkgconfig/soundtouch-1.0.pc  &nbsp;}}  
+
For development you will always want to obtain the CVS version of Audacity so you can stay abreast of the latest changes.  For more information, see our {{external|[http://audacity.sourceforge.net/community/developers#cvs CVS page]}}. For a CVS interface on Mac to access our CVS repository, try {{external|1=[http://sourceforge.net/project/showfiles.php?group_id=10072&package_id=13913&release_id=534524 MacCVS]}} (this needs an external SSH client if you want to commit code to our repository) or {{external|1=[http://www.heilancoo.net/MacCVSClient/ MacCVSClient]}}.
 
 
 
 
 
 
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.
 
 
 
{{code|<nowiki>--with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]</nowiki><br><nowiki>
 
--without-PACKAGE      do not use PACKAGE (same as --with-PACKAGE=no)</nowiki>}}
 
  
 +
A typical command to check out the current development version of Audacity from CVS would be
 +
cvs -d:pserver:[email protected]:/cvsroot/audacity checkout audacity
 +
If you have an old version of CVS and are prompted for a password then just press Enter as there is no password for read-only (anonymous) CVS access.
  
 
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).
 
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).

Revision as of 23:56, 17 January 2009

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 . This page describes the requirements for the latter case, i.e. compiling and making changes to development code that has not been released.
If you need to compile Audacity because there is no suitable Audacity package for your distribution, 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


Overview

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

  1. Install build tools: the programs needed to create other programs.
  2. Install dependencies: other software used by the program you are trying to compile
  3. Download the source code into a local directory.
  4. Configure the compile with options, if any.
  5. Compile
  6. Install

The first and second stages are crucial: lack of build tools and required dependencies are the cause of 99% of failed compiles. This page should help with that.

The standard commands to compile a piece of software for stages 4, 5 and 6 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

Build Tools

Most Linux distributions come with the core set of development tools already installed, but if not you will need to install the following packages, probably from your distribution's package manager:

  • 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.
  • GNU Make Other Makes may work, but may well not. Make on any Linux system will be GNU make.
  • GCC (at least the C and C++ compilers) The GNU Compiler Collection  The only other compiler supported by the Audacity development team is Microsoft's Visual C++, although we welcome patches to make Audacity compile with other compilers, for example the OpenSolaris compiler.
  • pkg-config
  • Autoconf Program which writes configure scripts. Needed to modify the build system
  • Automake Program which writes Makefiles. Needed to modify the build system
  • CVS Source code version control program
  • Patch Program for applying patches to files
  • GDB The GNU Debugger (for debugging crashes)
  • 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).

Dependencies

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.

Prerequisites

These libraries are required to build Audacity.

WxWidgets

The main requirement to build Audacity is wxWidgets . WX 2.8 is required, preferably 2.8.9 or later. Both Unicode and ANSI forms should work, although all development is against Unicode builds (the default for WX).

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. If using wxGTK then the GTK+ headers will also be needed as Audacity includes extensions to wxGTK which require the underlying toolkit headers to compile.

Whilst building Audacity with a standard distribution-supplied wxGTK package will work fine, it will be difficult to debug, because there will be no debugging information for wxGTK. To obtain this debugging information you should build wxGTK from source in a separate directory, then tell the Audacity configure script to use that copy of wxGTK rather than the system one. ** Add a link to a page explaining how to do this **

We also have some notes on the libraries already supplied with different Linux Distributions. For example, Ubuntu tend to update to newer libraries sooner than Debian do.

libsndfile

{{external|[libsndfile}} is required to build Audacity. It is almost certainly already installed on your system, although you may have to install the development package (see above). It is rarely necessary to compile libsndfile from source, although a slightly patched version is also included in Audacity CVS.

Optional Packages

The configure script of Audacity gives the option to link in or not to link in a number of optional packages. In a few cases there is a choice of two packages but one or the other must be used (not neither and not both).

--with-libsamplerate use libsamplerate  instead of libresample for sample rate conversion. Should not be used if binary plug-in support is also enabled for licensing reasons.
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]

Obtaining Audacity

For development you will always want to obtain the CVS version of Audacity so you can stay abreast of the latest changes. 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 .

A typical command to check out the current development version of Audacity from CVS would be

cvs -d:pserver:[email protected]:/cvsroot/audacity checkout audacity

If you have an old version of CVS and are prompted for a password then just press Enter as there is no password for read-only (anonymous) CVS access.

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).

Examples:

To enable support for ogg files:

--with-vorbis=[local|system]


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

--with-libsndfile=system


To disable Nyquist:

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

./configure
make


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

autoreconf


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

Dependencies:

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