Difference between revisions of "Building On Linux"

From Audacity Wiki
Jump to: navigation, search
m (+deprecated)
Line 1: Line 1:
{{Alert|'''WARNING:''' This page is deprecated since May 24, 2021. Please, see the up-to-date instruction: https://github.com/audacity/audacity/blob/master/BUILDING.md }}
{{ednote|1=[[ToDo-2]] Add<br>
{{ednote|1=[[ToDo-2]] Add<br>
* Instructions for building modules
* Instructions for building modules

Latest revision as of 11:54, 19 August 2021

Warning icon This page has been deprecated. Newer information can be found here: https://github.com/audacity/audacity/blob/master/BUILDING.md
The information on this page are likely out-of-date and will not be updated in the forseeable future. It may be removed at any time.
ToDo-2 Add
  • Instructions for building modules
  • Instructions for FFmpeg too:
This is the configure command Steve uses for testing/developing:
../configure  --with-lib-preference="local system" --with-ffmpeg="system" --disable-dynamic-loading --with-mod-script-pipe --with-mod-nyq-bench --enable-debug

For a "release build":
../configure  --with-lib-preference="local system" --with-ffmpeg="system" --disable-dynamic-loading
These are instructions for building on Linux

The build family of pages:

Instructions in linux/build.txt

These instructions are supplemental to the linux/build.txt in the source code.

Step-by-step instructions for building on Ubuntu are also periodically posted to the Audacity forum.


In addition to the listed dependencies and standard build environment, Audacity also requires Python 3 (Audacity 2.4.1 and earlier requires Python 2.7).

On Debian / Ubuntu, systems, if Python 3 is not already installed, it may be installed with:

sudo apt install python3-minimal


Instructions for Building on Linux


- Repository sources (sources.list) must include source code sources.
- For MP3 / FFmpeg support, "non-free" repositories may need to be enabled.
- Root access is required for installation (usually via "sudo").
- gcc >= 4.9
- cmake ( http://www.cmake.org/ ) >= 3.15
- git

On a modern Debian based distro, e.g. Ubuntu 20.04 (focal), you would do:
    ~$ sudo apt-get install build-essential cmake git

For older distributions it may be necessary to build cmake from source (see
separate notes on http://wiki.audacityteam.org/wiki/Building_On_Linux.

(The package names below are those used by Ubuntu 20.04.)

For Debian / Ubuntu based distributions, these packages may be installed from
the command line with:
    ~$ sudo apt install <package-name>

- libgtk2.0-dev
- libasound2-dev
- python3-minimal
- libavformat-dev
- libjack-jackd2-dev
- WxWidgets 3.1 built with gtk2. (see note below)


Audacity's fork of wxWidgets 3.1.3 (https://github.com/audacity/wxWidgets) should
be used as this includes bug fixes that are not yet available upstream.
WxWidgets should be built with gtk2 as gtk3 is not yet fully supported.

1) Clone wxWidgets:
    ~$ git clone --recurse-submodules https://github.com/audacity/wxWidgets/

If you forgot the --recurse-submodules, you can correct that later by:
    ~$ git submodule update --init

2) Build and install wxWidgets:

    ~$ cd <wxWidgets source code>
    ~$ mkdir buildgtk
    ~$ cd buildgtk
    ~$ ../configure --with-cxx=14 --with-gtk=2
    ~$ sudo make install

On a multi-core system, the build process can be made much quicker using the
"-j" switch, set to the number of available cores. For example, with an 8 core
    ~$ sudo make -j8 install

3) Having got this far, it is well worth trying out building some wxWidgets
examples to confirm that building has worked OK.


Getting the Audacity source code:

The latest release version of Audacity is available from:
This is the recommended version for end users.

For developers, the current development code is available from Github.
Cloning the repository (https://github.com/audacity/audacity) is recommended so
that the source tree may easily be kept up to date.

Building Audacity

As long as "/usr/local/bin" is in your PATH, then the wx-config should be found
when you "cmake" Audacity.

If the path to wxWidgets isn't in PATH, then add the option:
-DwxWidgets_CONFIG_EXECUTABLE=<path to>/wx-config

1. Make a build directory under the audacity git directory:
    ~$ cd <audacity source code>
    ~$ mkdir build
    ~$ cd build

2. Generate the makefiles:
    ~$ cmake -DCMAKE_BUILD_TYPE=Release -Daudacity_use_ffmpeg=loaded ..

3. Build Audacity:
    ~$ make

For multi-core processors, the "-j" switch may be used for faster building,
for example, with a 4 core CPU:
    ~$ make -j4

4. Testing the build:
Adding a "Portable Settings" folder allows Audacity to ignore the settings
of any existing Audacity installation.

    ~$ cd bin/Release
    ~$ mkdir "Portable Settings"
    ~$ ./audacity

Installing Audacity

    ~$ cd <build directory>
    ~$ sudo make install


The options in the above example will produce a full release build, with FFmpeg
enabled. A full list of option can be found here:
or may be listed in the terminal by running:
    ~$ cmake -LH

Installing the manual:

The Audacity manual is html, and is identical for Windows, Mac and Linux.
The manual may be downloaded as a ZIP archive from:
Current version: https://www.fosshub.com/Audacity.html
Old versions: https://www.fosshub.com/Audacity-old.html

Assuming that Audacity has been installed to /usr/local/ (default).
From the directory containing the manual ZIP archive:

   ~$ sudo unzip audacity-manual-2.4.2.zip -d /usr/local/share/audacity/help

CMake Build

Instructions for building cmake for distributions that only have CMake < 3.15

Instructions for Installing recent CMake on Ubuntu.  

You'll need CMake 3.15 or higher.  These steps were tested with CMake 3.17.1.

1. Check whether you need to upgrade.

  cmake --version

2. Download the cmake install script from kitware https://cmake.org/download/
Get the binary version for linux, the bash script cmake-3.<something>.sh

3. Move it to the directory where you want to install CMake, possibly
/usr/local (you could install it anywhere and then symlink to it)
I used /usr/local so that I would not need to blow away the older copy 
in /usr/bin if it hadn't worked out.

4. Run the script
  sudo chmod +x cmake-3.<something>.sh
  sudo bash cmake-3.<something>.sh

You will answer n (no for an extra subdirectory) and then y.

5. Check that worked

  cmake --version

About Box Details

The about box should show a git build identifier, if the source was under
git version control.  There will be no such identifier if you built from
the tarball.  Distros which ship a modified Audacity are encouraged to use
git and so to show their own git identifier.


Official Full Releases

Official full releases:

  • Executables: Have a GitIdent, visible in the about box build information, that says what branch was used in building.
  • Source-Code distros: Are minimal cut down versions from the release branch. We take out system libs that we expect to be provided by the distro, and that we haven't patched.

Updating .po files

With an official release, we ask translators to translate an updated .pot file. We create this with the following script:

cd locale
bash update_po_files.sh

Note: The script has the Audacity version number in it in three places, and all three should be updated before running it.

Making a Minimal Tarball

eventually we will retire the page below and have a much shorter version right here

If using CMake build (you should use it!)

make minsrc

Older / Obsolete stuff

ToDo-1 These instructions need updating for cmake.
Warning icon This instructions are not up to date and will not work with Audacity 2.4.2 or later.

Updating GitIdent

  • We recommend that maintainers of linux distros that ship pre built copies of Audacity build with a GitIdent that reflects the state of their version of the branch including their patches to it.
  • We don't recommend having a Git ident when distributing in source code form, and we don't either in our


 git show -s --format="#define REV_LONG \"%H\"%n#define REV_TIME \"%cd\"%n" | tee ../src/RevisionIdent.h
 or easier use ../mac/get_gitident.sh

The CMake build adds the gitident automatically and this step is only needed with the automake builds.

Making a Minimal Tarball

If using Autotools buildchain

 Clean your copy.  You check using -n and clean with -f.

 git clean -x -d -n
 git clean -x -d -f

 Now configure as if for building:

 ./configure --with-lib-preference="local system"

 Run the make tarball script:

 ./scripts/maketarball.sh verbose 

  Check the tarball is good for building:

  cd ../audacity-minsrc-x.y.z
  ./configure --with-lib-preference="local system"
  make -j4

gcc 4.9 on Ubuntu 14.04

If you're on Ubuntu 14.04, you need to upgrade the gcc compiler to at least 4.9.

 1) export CXX="g++-4.9" CC="gcc-4.9"
 2) g++-4.9 --version
You also must tell gcc to use c++11, so adapt the earlier configure command as follows:

    ../configure --with-lib-preference="local system" CXXFLAGS="-std=c++11"