Difference between revisions of "Building On Linux"

From Audacity Wiki
Jump to: navigation, search
(Restore Release path.)
m (+deprecated)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{deprecated|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
Line 20: Line 21:
 
== Instructions in linux/build.txt ==
 
== Instructions in linux/build.txt ==
  
{{note|1=These instructions for building on Linux are in [https://github.com/audacity/audacity/blob/master/linux/build.txt linux/build.txt in the Git repo].}}
+
These instructions are supplemental to the [https://github.com/audacity/audacity/blob/master/linux/build.txt linux/build.txt] in the source code.
{{alert|1=We currently have two different sets of instructions for building on Linux.  We plan to merge these instructions in time, and then have variations for where they diverge.  2.4.0 was tested with James' instructions with the CMake variation.
 
<p>Simple step-by-step instructions for building on Ubuntu are periodically posted to the [https://forum.audacityteam.org/viewforum.php?f=19 Audacity forum].</p>}}
 
  
{{note|1='''Python 2'''
+
Step-by-step instructions for building on Ubuntu are also periodically posted to the [https://forum.audacityteam.org/viewforum.php?f=19 Audacity forum].
<p>In addition to the listed dependencies and standard build environment, Audacity also requires Python 2 to be installed for building LV2 support.</p>
 
On Debian / Ubuntu, systems, if Python 2 is not already installed, it may be installed with:
 
<pre>sudo apt-get install python-minimal</pre>}}
 
  
===Instructions (Used by James on bionic)===
+
{{note|1='''Python'''
{{ednote|1=Should that be libasound2-dev?  I think I just used libasound and it was fine}}
+
<p>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).</p>
 +
On Debian / Ubuntu, systems, if Python 3 is not already installed, it may be installed with:
 +
<pre>sudo apt install python3-minimal</pre>}}
 +
 
 +
 
 +
===Instructions===
 
<pre>
 
<pre>
 
Instructions for Building on Linux
 
Instructions for Building on Linux
  
Fuller instructions that cover:
 
    * Upgrading to gcc 4.9 on older Ubuntus
 
    * Optional libraries
 
can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Linux.
 
  
Some prerequisites:
+
Prerequisites:
  
- Audacity requires gcc 4.9 or later to build.
+
- 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
  
- CMake ( http://www.cmake.org/ ) is required to build the local copy of
+
On a modern Debian based distro, e.g. Ubuntu 20.04 (focal), you would do:
  the libsoxr resampling library used by Audacity.
+
    ~$ sudo apt-get install build-essential cmake git
  
On a modern Debian distro, e.g. Ubuntu 16.04 (bionic), you would do:
+
For older distributions it may be necessary to build cmake from source (see
 +
separate notes on http://wiki.audacityteam.org/wiki/Building_On_Linux.
  
sudo apt-get install build-essential cmake
 
  
- libasound and gtk are required. Having gtk2 and gtk3 too 
+
Dependencies:
  may not be required, but compilation works if both are.
+
(The package names below are those used by Ubuntu 20.04.)
  
- Auto-tools are also needed.
+
For Debian / Ubuntu based distributions, these packages may be installed from
 +
the command line with:
 +
    ~$ sudo apt install <package-name>
  
sudo apt-get install libasound libgtk2.0-dev libgtk-3-dev
+
- libgtk2.0-dev
sudo apt-get install autoconf automake
+
- libasound2-dev
 
+
- python3-minimal
- Since you will be fetching code from git repositories you
+
- libavformat-dev
  will need git.
+
- libjack-jackd2-dev
 
+
- WxWidgets 3.1 built with gtk2. (see note below)
sudo apt-get install git git-gui gitk
 
  
  
 
wxWidgets:
 
wxWidgets:
  
1) Clone wxWidgets and checkout 3.1.1 from the Audacity fork of the
+
Audacity's fork of wxWidgets 3.1.3 (https://github.com/audacity/wxWidgets) should
    wxWidgets project:
+
be used as this includes bug fixes that are not yet available upstream.
      https://github.com/audacity/wxWidgets/....
+
WxWidgets should be built with gtk2 as gtk3 is not yet fully supported.
  
    for example
 
      mkdir ./wxWidgets
 
      cd ./wxWidgets
 
      git clone --recurse-submodules https://github.com/audacity/wxWidgets/
 
  
    Don't be tempted to use Widgets already installed on Linux because this
+
1) Clone wxWidgets:
     will typically be a different version and will cause problems.            
+
     ~$ git clone --recurse-submodules https://github.com/audacity/wxWidgets/
  
    IF you forgot the --recurse-submodules, you can correct that later by:
+
If you forgot the --recurse-submodules, you can correct that later by:
      git submodule update --init
+
    ~$ git submodule update --init
  
  2) Follow instructions for building at
 
    https://github.com/audacity/wxWidgets/blob/v3.1.1/docs/gtk/install.txt
 
  
    So...
+
2) Build and install wxWidgets:
  
     mkdir buildgtk
+
     ~$ cd <wxWidgets source code>
     cd buildgtk
+
    ~$ mkdir buildgtk
     ../configure --with-gtk
+
     ~$ cd buildgtk
     make  
+
     ~$ ../configure --with-cxx=14 --with-gtk=2
 +
     ~$ sudo make install
  
  3) Having got this far, it is well worth trying out building some wxWidgets
+
On a multi-core system, the build process can be made much quicker using the
     examples to confirm that building has worked OK
+
"-j" switch, set to the number of available cores. For example, with an 8 core
 +
processor:
 +
     ~$ sudo make -j8 install
  
Audacity:
 
  
These are old steps for using automake.  For 2.4.0 onwards we are using CMake
+
3) Having got this far, it is well worth trying out building some wxWidgets
instead.  See later instructions.
+
examples to confirm that building has worked OK.
  
  1) Create a 'build' subdirectory under Audacity and change to it.
 
 
  2) Now to build Audacity itself.
 
    Using a build directory (and .. in the command) keeps source and object files
 
    in separate directories.
 
 
    ../configure --with-lib-preference="local system"
 
 
    make
 
    make install  # as root
 
 
</pre>
 
 
{{tip|1= &nbsp;
 
* Optionally use make -j4 rather than just 'make'.  With -j4 Audacity may build faster, on machines that have hard disks rather than SSD. 
 
** The reason is that the processor can make multiple requests to the hard drive, and get on with work on other cores whilst waiting for files to arrive. 
 
* If you have a browser open and 4Gb or less of RAM, close it, as the browser can hog memory that is needed for a fast build.  You'll lose a lot of time to the OS paging memory in and out}}
 
 
===CMake Build===
 
 
From Audacity 2.4.0 we started building Audacity itself using CMake
 
 
<pre>
 
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/bin (you could install it anywhere and then symlink to it)
 
I used /usr/local/bin 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
 
 
</pre>
 
 
Then build Audacity
 
 
<pre>
 
Instructions for Building Audacity using CMake
 
 
1. Make a build directory under the audacity git directory.
 
 
  cd audacity
 
  mkdir build-cmake
 
  cd build-cmake
 
 
 
2. Generate the makefiles
 
 
  cmake -DCMAKE_BUILD_TYPE=Release ..
 
 
3. Build Audacity
 
 
  cmake --build .
 
 
4. Run
 
 
  cd /bin/Release
 
  ./audacity
 
 
</pre>
 
 
 
<pre>
 
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.
 
 
If the about box shows 'debug build' and you actually built a release build,
 
this may be because you used wxWidgets with DEBUG_LEVEL of 1 or higher. 
 
With Audacity 2.4.0 there is an issue on Linux with the Release build
 
reporting itself as Debug.  We expect to fix this for the next release.
 
 
</pre>
 
 
 
===Detailed Instructions===
 
''Steve Daulton. Updated 04Dec2019''
 
 
<pre>
 
Instructions for Building on Linux
 
 
Note that for Audacity 2.3.3, "Mod Script Pipe" should be considered to be
 
a standard part of an Audacity release, rather than as an optional extra.
 
FFmpeg support should also be enabled if available in the distribution.
 
 
Note that only the current release version of the manual is available on-line. It is
 
therefore highly recommended to fetch the correct version of the manual and install it
 
on the local machine to ensure that the correct version of the manual is available for the
 
end user. See notes below for details.
 
 
 
Prerequisites:
 
 
1) Repository sources (sources.list) must include source code sources.
 
2) For MP3 / FFmpeg support, "non-free" repositories may need to be enabled.
 
3) Root access is required for installation (usually via "sudo").
 
 
 
Required dependencies:
 
(The package names below are those used by Debian based distributions.)
 
 
For Debian / Ubuntu based distributions, these packages may be installed from the
 
command line with:
 
  $ sudo apt install <package-name>
 
 
build-essential (g++, gcc, libc6-dev, libc-dev, make)
 
cmake
 
gcc 4.9 or later (gcc-7 recommended for Debian / Ubuntu)
 
libsndfile1
 
libasound2-dev
 
libgtk2.0-dev
 
gettext
 
libid3tag0-dev
 
libmad0-dev
 
libsoundtouch-dev
 
libogg-dev
 
libvorbis-dev
 
libflac-dev
 
libmp3lame0
 
 
WxWidgets 3.0 or 3.1 (see note below)
 
 
For FFmpeg support (see note below):
 
libavformat-dev
 
 
For Jack Audio System (see note below):
 
jackd2
 
libjack-jackd2-dev
 
 
 
Recommended for developers:
 
git
 
autoconf
 
automake
 
pkg-config
 
patch
 
diff-tools
 
gdb
 
 
 
WxWidgets:
 
Audacity requires wxWidgets 3.0 or 3.1.
 
Wxwidgets 3.1.1 source code is available from: https://github.com/audacity/wxWidgets
 
 
For Debian / Ubuntu based distributions, the required wxWidgets packages may all be
 
pulled in with apt at the command line:
 
  $ sudo apt install libwxgtk3.0
 
 
 
FFmpeg:
 
The FFmpeg headers included in the Audacity source are rather old. Audacity may be built
 
with a more recent version if libavformat-dev is installed on the system (recommended),
 
but dynamic loading must be disabled (see configuration options below).
 
 
 
Jack Audio System:
 
Audacity can work with either jackd or jackd2.
 
Unless your Linux distribution runs Jack as the default sound system, it is recommended
 
to install QJackCtl to provide a convenient way to manage Jack.
 
End users are advised to read up on Jack if they wish to install it.
 
  
 +
Audacity:
  
 
Getting the Audacity source code:
 
Getting the Audacity source code:
Line 288: Line 108:
  
 
For developers, the current development code is available from Github.
 
For developers, the current development code is available from Github.
Cloning the repository is recommended so that the source tree may easily be kept up to date.
+
Cloning the repository (https://github.com/audacity/audacity) is recommended so
https://github.com/audacity/audacity
+
that the source tree may easily be kept up to date.
 
 
  
Building Audacity:
 
  
After cloning or extracting the downloaded source code, open a terminal window and navigate
+
Building Audacity
to the root of the source folder (the folder that contains the 'README.md' file).
 
  
Create a build folder and navigate into it
+
As long as "/usr/local/bin" is in your PATH, then the wx-config should be found
  $ mkdir build
+
when you "cmake" Audacity.
  $ cd build
 
  
Configure the build:
+
If the path to wxWidgets isn't in PATH, then add the option:
For a comprehensive list of configure options, run
+
-DwxWidgets_CONFIG_EXECUTABLE=<path to>/wx-config
  $ ../configure -h
 
  
To configure with all standard release features enabled:
+
1. Make a build directory under the audacity git directory:
  $ ../configure --with-lib-preference="local system" --with-ffmpeg="system" --disable-dynamic-loading --with-mod-script-pipe
+
    ~$ cd <audacity source code>
Note that additional steps are required for building and installing Mod Script Pipe (see below).
+
    ~$ mkdir build
 +
    ~$ cd build
  
 +
2. Generate the makefiles:
 +
    ~$ cmake -DCMAKE_BUILD_TYPE=Release -Daudacity_use_ffmpeg=loaded ..
  
Enabling FFmpeg (included in the "standard" options above):
+
3. Build Audacity:
Most Linux distributions provide a newer version of FFmpeg than is supported by Audacity's
+
    ~$ make
dynamic loading. For FFmpeg support it is therefore necessary to disable dynamic loading:
 
  $ ../configure --with-lib-preference="local system" --with-ffmpeg="system" --disable-dynamic-loading
 
  
 +
For multi-core processors, the "-j" switch may be used for faster building,
 +
for example, with a 4 core CPU:
 +
    ~$ make -j4
  
Assuming that configure completes without error, you can now build Audacity:
+
4. Testing the build:
  $ make
+
Adding a "Portable Settings" folder allows Audacity to ignore the settings
 +
of any existing Audacity installation.
  
If your processor has multiple cores, you may use the -j switch, set to the number of
+
    ~$ cd bin/Release
available cores. This will considerably speed up the build time.
+
    ~$ mkdir "Portable Settings"
For example, with an 8 core CPU:
+
    ~$ ./audacity
  $ make -j8
 
  
  
Building Mod Script Pipe:
+
Installing Audacity
  
Mod Script Pipe provides an API for external scripting languages such as Python, to communicate with Audacity.
+
    ~$ cd <build directory>
Mod Script Pipe may be used with any scripting language that supports named pipes. For more information,
+
    ~$ sudo make install
see: https://manual.audacityteam.org/man/scripting.html
 
  
IMPORTANT: Modules for Audacity must be built on the same day as Audacity is built.
 
Audacity must be built with the --with-mod-script-pipe option.
 
  
After building Audacity, navigate to the build/lib-src/mod-script-pipe directory:
+
Options:
  $ cd lib-src/mod-script-pipe
 
  
Then build Mod Script Pipe (the "-j" switch is available for multi-core CPUs):
+
The options in the above example will produce a full release build, with FFmpeg
  $ make
+
enabled. A full list of option can be found here:
 +
https://wiki.audacityteam.org/wiki/CMake_Options#Linux
 +
or may be listed in the terminal by running:
 +
    ~$ cmake -LH
  
  
Fetching the manual:
+
Installing the manual:
  
 
The Audacity manual is html, and is identical for Windows, Mac and Linux.
 
The Audacity manual is html, and is identical for Windows, Mac and Linux.
For release versions of Audacity, the manual may be downloaded as a ZIP archive from:
+
The manual may be downloaded as a ZIP archive from:
 
Current version: https://www.fosshub.com/Audacity.html
 
Current version: https://www.fosshub.com/Audacity.html
 
Old versions: https://www.fosshub.com/Audacity-old.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:
  
Pre-installation test:
+
   ~$ sudo unzip audacity-manual-2.4.2.zip -d /usr/local/share/audacity/help
 
 
Create a local folder for Audacity's settings. This folder will be only used for testing and will
 
not be installed.
 
  $ mkdir "Portable Settings"
 
 
 
Then launch Audacity
 
  $ ./audacity
 
 
 
 
 
Installing Audacity:
 
 
 
To install the main application, from the build directory:
 
  $ sudo make install
 
 
 
 
 
To install Mod Script Pipe:
 
Assuming that Audacity has been installed to /usr/local/ (default)
 
  $ sudo mkdir /usr/local/share/audacity/modules
 
  $ sudo cp lib-src/mod-script-pipe/.libs/mod-script-pipe.so /usr/local/share/audacity/modules/mod-script-pipe.so
 
  $ sudo cp lib-src/mod-script-pipe/.libs/mod-script-pipe.so.0.0.0 /usr/local/share/audacity/modules/mod-script-pipe.so.0.0.0
 
The module will now be available for enabling in Preferences (https://manual.audacityteam.org/man/modules_preferences.html)
 
 
 
Note that it is also possible to install Mod Script Pipe for a single user by copying these two files to:
 
   ~/.audacity-files/modules
 
 
 
 
 
To install the manual:
 
Assuming that Audacity has been installed to /usr/local/ (default).
 
From the directory constaining the manual ZIP archive:
 
  $ sudo unzip audacity-manual-2.3.3.zip -d /usr/local/share/audacity/help
 
  
 
</pre>
 
</pre>
  
== Variations ==
 
 
{{note|These instructions for variations on building aren't in linux/build.txt in the Git repo.}}
 
  
===gcc 4.9 on Ubuntu 14.04===
+
===CMake Build===
 +
Instructions for building cmake for distributions that only have CMake < 3.15
  
If you're on Ubuntu 14.04, you need to upgrade the gcc compiler to at least 4.9. 
 
 
* [[Upgrade_to_gcc_4.9]]
 
 
 
<pre>
 
<pre>
1) export CXX="g++-4.9" CC="gcc-4.9"
+
Instructions for Installing recent CMake on Ubuntu.   
 
  2) g++-4.9 --version
 
</pre>
 
  
<pre>
+
You'll need CMake 3.15 or higher.  These steps were tested with CMake 3.17.1.
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"
+
1. Check whether you need to upgrade.
  
</pre>
+
  cmake --version
  
===Changes to makefile.am===
+
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
  
If you've added or removed source files, you will need to change makefile.am to reflect that.
+
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.
  
   autoreconf --no-recursive -i
+
4. Run the script
 +
   sudo chmod +x cmake-3.<something>.sh
 +
  sudo bash cmake-3.<something>.sh
  
===Options===
+
You will answer n (no for an extra subdirectory) and then y.
  
<pre>
+
5. Check that worked
To see compile-time options you can set, you can type
 
  ./configure --help
 
  
For example you can enable and disable libraries.
+
  cmake --version
  
Audacity 2.3.0 is now built by default with local ffmpeg and local libFlac.
 
 
</pre>
 
</pre>
  
=== Cache for Configure ===
 
 
{{note|1=This below is a note/tip from a developer, but untested by us:}}
 
  
 
<pre>
 
<pre>
If you want to do any development, you might want to generate a configure cache
+
About Box Details
and header dependencies:
 
  
  ./configure -C
+
The about box should show a git build identifier, if the source was under
  make dep
+
git version control. There will be no such identifier if you built from
</pre>
+
the tarball.  Distros which ship a modified Audacity are encouraged to use
 
+
git and so to show their own git identifier.
===FFmpeg===
 
 
 
<pre>
 
Audacity should be able to link dynamically to FFmpeg 1.2 to 2.3.x (libav 0.8 to 10),
 
but many distributions have more recent versions that fail to link dynamically.
 
To work around this issue, Audacity may be configured to use the system
 
FFmpeg library and disable dynamic loading.
 
  $ ../configure --with-lib-preference="local system" --with-ffmpeg=system --disable-dynamic-loading
 
  
If this is done for both FFmpeg and LAME, then the "Libraries" option in Audacity's Preferences is not required and is automatically removed.
 
  $ ../configure --with-lib-preference="local system" --with-ffmpeg=system  --with-lame=system --disable-dynamic-loading
 
 
</pre>
 
</pre>
  
===Other 'make' targets===
+
== Variations ==
 
 
These are some other make targets.
 
 
 
<pre>
 
To uninstall:
 
  make uninstall #as root
 
  
To clean the build after modifying code:
 
  make clean
 
 
To clean and remove previous configure options:
 
  make distclean
 
 
</pre>
 
  
 
==Official Full Releases==
 
==Official Full Releases==
Line 469: Line 225:
 
* Executables: Have a GitIdent, visible in the about box build information, that says what branch was used in building.
 
* 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.
 
* 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===
 
===Updating .po files===
Line 478: Line 235:
  
 
Note: The script has the Audacity version number in it in three places, and all three should be updated before running it.
 
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===
 +
{{ednote|1=eventually we will retire the page below and have a much shorter version right here}}
 +
 +
* [[Building Release Tarballs]]
 +
 +
If using CMake build (you should use it!)
 +
 +
<pre>
 +
make minsrc
 +
</pre>
 +
 +
 +
==Older / Obsolete stuff==
 +
{{ednote| [[ToDo-1]] These instructions need updating for cmake.}}
 +
{{alert|This instructions are not up to date and will not work with Audacity 2.4.2 or later.}}
 +
  
 
===Updating GitIdent===
 
===Updating GitIdent===
Line 491: Line 265:
  
 
The CMake build adds the gitident automatically and this step is only needed with the automake builds.
 
The CMake build adds the gitident automatically and this step is only needed with the automake builds.
 +
  
 
===Making a Minimal Tarball===
 
===Making a Minimal Tarball===
{{ednote|1=eventually we will retire the page below and have a much shorter version right here}}
+
<s>If using Autotools buildchain
 
 
* [[Building Release Tarballs]]
 
 
 
If using CMake build (you should use it!)
 
 
 
<pre>
 
make minsrc
 
</pre>
 
 
 
If using Autotools buildchain
 
  
 
<pre>
 
<pre>
Line 526: Line 291:
  
 
</pre>
 
</pre>
 +
</s>
 +
<s>
 +
===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. 
  
 +
* [[Upgrade_to_gcc_4.9]]
 +
 +
<pre>
 +
1) export CXX="g++-4.9" CC="gcc-4.9"
 +
 +
2) g++-4.9 --version
 +
</pre>
 +
 +
<pre>
 +
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"
 +
 +
</pre>
 +
</s>
  
 
[[Category:Linux and Unix Platform]] [[Category:For Developers]]
 
[[Category:Linux and Unix Platform]] [[Category:For Developers]]

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.


Python

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

Instructions for Building on Linux


Prerequisites:

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


Dependencies:
(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)


wxWidgets:

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
processor:
    ~$ 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.


Audacity:

Getting the Audacity source code:

The latest release version of Audacity is available from:
https://www.fosshub.com/Audacity.html
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


Options:

The options in the above example will produce a full release build, with FFmpeg
enabled. A full list of option can be found here:
https://wiki.audacityteam.org/wiki/CMake_Options#Linux
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.

Variations

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

tarballs.

 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"