User Tools

Site Tools


compiling_on_linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
compiling_on_linux [2020/02/25 18:00]
ehendrikd
compiling_on_linux [2020/03/30 21:35] (current)
be.ing
Line 131: Line 131:
  
 ===== Compile and install ===== ===== Compile and install =====
 +
 +==== CMake ====
 +Mixxx uses the CMake build system as of Mixxx 2.3 (currently the master branch). Building and installing Mixxx follows the standard CMake procedures.
 +
 +We highly recommend installing [[https://​ccache.dev/​|CCache]] if you will be contributing code to Mixxx. If you won't be writing or testing code and are just building Mixxx to use it for yourself, you can skip installing CCache. CCache drastically speeds up the time to recompile Mixxx, especially when switching Git branches. CMake works with CCache automatically.
 +
 +To build with CMake, first create a new directory and enter it. Typically it is in the top level of the Git repository, but it can be anywhere you want.
 +
 +<​code>​
 +$ mkdir build
 +$ cd build
 +</​code>​
 +
 +Now configure CMake. This only needs to be done once; you don't need to repeat it when you compile Mixxx again. This step checks if you have all the dependencies installed, similar to the configure script of GNU autotools. ''/​usr''​ is used as the installation path in this example, but you can set this to anywhere as long as your ''​$PATH''​ environment variable includes a ''​bin''​ directory under the installation path (''/​usr/​bin''​ if the installation path is ''/​usr''​).
 +
 +<​code>​
 +$ cmake -DCMAKE_INSTALL_PREFIX=/​usr /​path/​to/​mixxx/​git/​repository
 +</​code>​
 +
 +Compile Mixxx. Set the ''​%%--%%parallel''​ option to the number of CPU cores you have. This will take a while, depending on the speed of your computer.
 +<​code>​
 +$ cmake --build . --parallel 2
 +</​code>​
 +
 +Install Mixxx. If you want to compile and install in one step, you can skip the compilation step above and just run this command.
 +<​code>​
 +$ cmake --build . --target install --parallel 2
 +</​code>​
 +
 +=== Debug build ===
 +If you want to make a debug build, add ''​-DCMAKE_BUILD_TYPE=Debug -DDEBUG_ASSERTIONS_FATAL=ON''​ to the end of the cmake configure command. Debug builds should be started with the command line option ''​%%--%%debugAssertBreak''​ to trigger a breakpoint in the debugger if debug assertions are violated or to abort Mixxx immediately. This ensures that messages about violated debug assertions are not missed between various other debug log messages. We recommend this if you are working on Mixxx code, but not if you are performing with Mixxx.
 +
 +==== SCons ====
 +Mixxx 2.2 and earlier use the SCons build system. Mixxx 2.3 also supports SCons, but SCons support will be removed in Mixxx 2.4.
  
 Once you have the source code, change to the newly created "​mixxx"​ directory (run ''​cd mixxx''​). Mixxx uses the [[http://​scons.org/​|SCons]] build system rather than the more common GNU autotools and GNU make. Running ''​scons -h''​ in the "​mixxx"​ directory shows a complete list of build flags if you'd like to customize. To compile without any special options, as a regular user, run: Once you have the source code, change to the newly created "​mixxx"​ directory (run ''​cd mixxx''​). Mixxx uses the [[http://​scons.org/​|SCons]] build system rather than the more common GNU autotools and GNU make. Running ''​scons -h''​ in the "​mixxx"​ directory shows a complete list of build flags if you'd like to customize. To compile without any special options, as a regular user, run:
Line 153: Line 187:
 with scons. with scons.
  
-==== Developer ​build options ==== +=== Debug build ===
 To catch bugs early during development build and run Mixxx with the following options. To catch bugs early during development build and run Mixxx with the following options.
- 
-=== Debug build with SCons === 
 <​code>​ <​code>​
 build=debug debug_assertions_fatal=1 build=debug debug_assertions_fatal=1
 </​code>​ </​code>​
  
 +Debug builds should be started with the command line option ''​%%--%%debugAssertBreak''​ to trigger a breakpoint in the debugger if debug assertions are violated or to abort Mixxx immediately. This ensures that messages about violated debug assertions are not missed between various other debug log messages. We recommend this if you are working on Mixxx code, but not if you are performing with Mixxx.
  
-=== Debug build with CMake (...coming soon) === +=== Optional: Build with m4a/AAC file support ===
-<​code>​ +
--DCMAKE_BUILD_TYPE=Debug -DDEBUG_ASSERTIONS_FATAL=ON +
-</​code>​ +
- +
- +
-=== Testing debug builds === +
- +
-Debug builds should started with the option ''​--debugAssertBreak''​ to trigger a breakpoint in the debugger if  debug assertions are violated or to abort Mixxx immediately. This ensures that messages about violated debug assertions are not missed between various other debug log messages. +
-==== Optional: Build with m4a/AAC file support ​====+
 If you want to play m4a files, add ''​faad=1''​ to your scons commands above. This requires the libraries faad2 and libmp4v2 (or libmp4) to be installed. If you want to play m4a files, add ''​faad=1''​ to your scons commands above. This requires the libraries faad2 and libmp4v2 (or libmp4) to be installed.
  
-==== Optional: Compile with Clang ===+=== Optional: Compile with Clang ===
 [[http://​clang.llvm.org|Clang]] is a C/C++ compiler based on [[http://​llvm.org|LLVM]]. Using Clang has various benefits: [[http://​clang.llvm.org|Clang]] is a C/C++ compiler based on [[http://​llvm.org|LLVM]]. Using Clang has various benefits:
  
Line 200: Line 222:
   * To enable Address Sanitizer, use the ''​asan=1''​ scons flag.   * To enable Address Sanitizer, use the ''​asan=1''​ scons flag.
  
-==== Troubleshooting scons ====+=== Troubleshooting scons ===
 If scons can't find installed dependencies,​ try  If scons can't find installed dependencies,​ try 
 <​code>​scons --config=force</​code>​ <​code>​scons --config=force</​code>​
  
- +=== Uninstall === 
-===== Uninstall ​===== +To uninstall a copy of Mixxx that you compiled ​with SCons, ''​cd''​ into the directory where you ran ''​scons''​ before, then run:
-To uninstall a copy of Mixxx that you compiled, ''​cd''​ into the directory where you ran ''​scons''​ before, then run:+
 <​code>​ <​code>​
 scons -c prefix=INSTALLATION_DIRECTORY install scons -c prefix=INSTALLATION_DIRECTORY install
Line 213: Line 234:
 INSTALLATION_DIRECTORY must be the same as that used when compiling and installing. If you needed to use ''​sudo''​ to install, also use ''​sudo''​ to uninstall. INSTALLATION_DIRECTORY must be the same as that used when compiling and installing. If you needed to use ''​sudo''​ to install, also use ''​sudo''​ to uninstall.
  
-===== Clean up =====+=== Clean up ===
 If ''​scons''​ fails with mysterious errors about not finding dependencies that you know are installed, it may be using outdated cached information to look for the dependencies. This can happen after upgrading your GNU/Linux distribution. To resolve this, try running ''​scons -c''​ and recompiling Mixxx. If ''​scons''​ fails with mysterious errors about not finding dependencies that you know are installed, it may be using outdated cached information to look for the dependencies. This can happen after upgrading your GNU/Linux distribution. To resolve this, try running ''​scons -c''​ and recompiling Mixxx.
  
compiling_on_linux.1582671646.txt.gz · Last modified: 2020/02/25 18:00 by ehendrikd