Compiling VLC on Unix Systems
Compiling VLC on Unix Systems
org/UnixCompile/
UnixCompile
Contents
Prepare your environment
Get the source
Get the third-party libraries
The preferred method
Debian
OpenSuSE
The "Contrib" method
Regardless of the method
Configuration
Prefix
Compilation
Troubleshooting / common problems
Lua
XCB
Compile fails after git pull
gcc (version 4.9 or later) is recommended, but clang/LLVM are known to work as well.
If you build from the Git repositories, you will also need the GNU build system, also known as the "autotools" (autoconf,
automake, libtool and gettext) to setup the Makefiles. Make sure they are up-to-date and usable for your system.
On Fedora:
On Debian or Ubuntu:
$ sudo apt-get install git g++ make libtool automake autopoint pkg-config flex bison lua5.2
On Arch
1 of 5 15/05/2023, 23:00
Firefox [Link]
Start by getting the source, using FTP for official releases, or using Git to track VLC development.
If you are using the Git development version, start by bootstrapping the source tree:
If you are using an official release, download source code, extract the archive and go into the resulting VLC directory, e.g.:
$ wget [Link]
$ tar xvJf [Link]
$ cd vlc-3.0.12
You must install and enable all the necessary underlying libraries. If you fail to install a required library, either the configure
script or (more likely) you will end up with a crippled VLC program. Furthermore keep in mind that whilst build a program (in
this case, VLC), you need to install the development packages (development header files and import libraries), not just the
run-time libraries. On Debian/Ubuntu, the correct package names end with -dev. On RPM distributions, they usually end in
-devel.
Be careful! If the libraries are not provided by your distribution, you may be better off linking VLC with them statically. See
the "Contrib" method.
There are a several ways to get those libraries. You should use only one method at a time:
Debian
For example on Debian or Ubuntu:
OpenSuSE
openSUSE users might have a look at the source-install (si) command in the zypper manpage:
Note: To get the libraries, you must first add the VLC repositories to your system repositories. For example in openSUSE:
2 of 5 15/05/2023, 23:00
Firefox [Link]
You should replace <openSUSEversion> with the version of your system (12.1, 11.4, 11.3, 11.2 or 11.1)
First, you need to install the GNU autotools (if you have not already done so), CMake, subversion, Git and a recent GNU/tar
utility or equivalent.
$ cd contrib
$ mkdir native
$ cd native
$ ../bootstrap
$ make
That should download and build a lot of those libraries for you. Unfortunately, given the large number of libraries and the
variety of the platforms people build VLC for, it is not unlikely that you will hit an error while contribs are compiling. Thus,
this approach is only recommended for experienced Unix compilers.
Configuration
./configure is used to check whether your system is able to compile VLC. Also you can choose the features in your build.
As a reminder, this command will show the various options:
$ ./configure --help
For most users, ./configure does not require any command-line options.
By default, features to be compiled are chosen automatically depending on what libraries are detected as available. If the
contribs have been compiled first, the resulting VLC will be reasonably functional.
Note that libraries that are not in the default prefix, and not in vlc contribs, must be known to pkg-config in order for
./configure to find them. Use PKG_CONFIG_PATH for this.
There are some features that are disabled (not compiled) by default. If you want them, they must be forced on by using
configure flags. You can find a list of these features by searching for "disabled" in ./configure --help.
Prefix
3 of 5 15/05/2023, 23:00
Firefox [Link]
$ ./configure --prefix=/path/to/install/folder/
You can find example of configure in the Configure page of this wiki.
Compilation
Compile VLC:
$ make
You do not need to install VLC to use it. You can also simply run it from the build directory:
# ./vlc
If you really want to install VLC to the system, run this as root:
# make install
You can uninstall later with this, but you need to keep the build tree untouched until then:
# make uninstall
$ make clean
Lua
You may need to install Lua if you get "LUA byte compiler missing." message. You namely need to install "luac", the Lua byte
compiler.
On Debian/Ubuntu:
On Fedora:
XCB
VLC 1.1 and later requires XCB libraries to deal with X11 displays. Do not disable XCB or you will not get any video support!
4 of 5 15/05/2023, 23:00
Firefox [Link]
Under Fedora:
For OpenGL (Debian/Ubuntu only), you will additionally need XLib with XCB:
If your distribution provides a version of XLib without XCB, then this later package will not be available. So you will not be
able to use OpenGL. Use XVideo instead.
5 of 5 15/05/2023, 23:00
To modify the installation directory for VLC when compiling from source, you can use the `--prefix` option with the `./configure` command. By running `./configure --prefix=/path/to/install/folder/`, you set the desired path where VLC will be installed upon running the `make install` command. This is useful for installing VLC in a non-standard directory for reasons such as testing multiple versions or maintaining a clean system directory structure .
When VLC compilation fails after a `git pull`, it is likely that significant changes in the source repository have caused the build system cache to go out of date. To troubleshoot, you should first ensure that your autotools are up-to-date, as any inconsistency here might cause failures in the bootstrapping process. Furthermore, review any changes in the repository that might necessitate updates to other dependencies or the build configuration. Following the guidelines in the 'Hacker Guide' for module troubleshooting can also help identify specific module-related issues that might need addressing .
To compile VLC on Debian/Ubuntu systems, it's important to acquire third-party libraries as they provide additional functionality and capabilities required by VLC. This can be done by installing development packages that end with '-dev'. Using the command `$ sudo apt-get build-dep vlc` helps manage and install these dependencies automatically if they are available from the distribution's package repositories. This approach leverages the package manager's ability to handle software dependencies efficiently, reducing the risk of missing libraries, which could lead to a non-functional VLC build. If some libraries are not available, the alternative is to use the 'Contrib' method to download and build the necessary third-party libraries from the VLC source .
XCB libraries are necessary for handling X11 display functions needed by VLC, especially for video output. They provide improved performance and more efficient use of resources compared to older libraries. Disabling XCB libraries will likely result in VLC losing video output capabilities, as these libraries are crucial for managing video display on systems utilizing the X Window System. This would mean VLC could not fulfill one of its primary functions, which is to serve as a media player .
Lua is required for VLC scripts and extensions, providing functionality such as custom playlists and UI enhancements. A common issue arises when the Lua byte compiler ('luac') is missing, which triggers errors during compilation. To resolve Lua-related issues, ensure that Lua, specifically version 5.1 or 5.2, along with its byte compiler, is installed. For Debian/Ubuntu systems, the command `$ sudo apt-get install lua5.1` or `$ sudo apt-get install lua5.2` is used. This ensures that Lua scripts can be compiled and utilized effectively within VLC .
The 'Contrib' method involves manually downloading and building libraries from the VLC source itself, whereas using the package management system (such as APT or Zypper) automatically installs pre-compiled libraries and their dependencies. The Contrib method can be advantageous in cases where necessary libraries are not available in the package repositories or need to be linked statically, offering greater control over library versions and compile-time options. This method is beneficial for experienced users who require a tailored build environment or encounter incompatibilities with available packages .
Enabling optional features during VLC configuration presents challenges such as dependency management and ensuring compatibility with existing libraries. Some features disabled by default require specific libraries that may not be present in the system's package repositories. Furthermore, enabling optional dependencies can introduce new bugs or incompatibilities, especially if librararies with mismatched versions are used. Using configuration flags that force-enable features should be approached with caution, ensuring all necessary dependencies are correctly installed and up-to-date. Precise knowledge of each feature’s requirements is crucial to avoid compilation errors and to maintain system stability .
The requirement of a C11 compiler implies that systems intended for VLC compilation must support modern C language features introduced in the C11 standard. This excludes older compilers and necessitates updating systems to include compilers like GCC 4.9 or newer, or Clang/LLVM that comply with C11. It affects system selection by creating a need for compatibility checks and updates before proceeding with the compilation. Systems without a compliant compiler must either be upgraded or replaced with more recent setups, ensuring both the correctness and performance of VLC .
If libraries required for VLC compilation are not available in default prefixes or VLC contribs, they must be recognized by the pkg-config tool. This can be managed by setting the PKG_CONFIG_PATH variable to include the directories where these libraries reside. This ensures the `./configure` script can detect the libraries and their corresponding development headers accurately, allowing for a configured and functional VLC build. If necessary, manually building and placing the libraries in a directory recognized by PKG_CONFIG_PATH may also be required .
The core tools required to compile VLC on Unix-based systems include a C11 compiler (such as GCC version 4.9 or later, or Clang/LLVM), the GNU Build system (also known as autotools, which includes autoconf, automake, libtool, and gettext), and development headers as well as a toolchain. These tools are necessary because they ensure that the system can compile and link the source code correctly, providing a standardized environment for building software. GCC or Clang compilers are specifically needed for optimizing and supporting the latest language features, while autotools are crucial for setting up and configuring Makefiles necessary for building the software .