wiki:

CompilationGuide

/

Generic


Version 1 (modified by saste, 5 years ago) (diff)

add first incomplete version of the guide

This page provides some generic instructions for compiling a project starting from the source code package under UNIX and derivatives. Note that the basic principles are shared by most Linux/Unix? distributions and MinGW.

Note that in this guide there is nothing strictly specific to FFmpeg.

Overview

Most source packages installation assumes the following steps:

  • configuration (through a configure script)
  • compilation (through make)
  • installation (through make install)

Configuration will allow to create the necessary files required by the following compilation step, and is done through a configure script usually provided by the source package. During configuration it is possible to define the install prefix and the enabled components.

Compilation usually consists into running make after the configuration step was done. In this phase the required libraries and binaries are generated.

Installation will install binaries and libraries in the path specified during the configuration step. Note that this step is not really required, since you can use the binaries compiled in the compilation path.

For a vanilla compilation and install, you will usually run the following commands:

configure
make
make install

This will compile the project files in the source directory, and will install the libraries in /usr/local. The third step may require super-user rights (so it may need to be replaced by sudo make install), since /usr/local cannot be modified by regular users.

Install path

A package consists of several related files which are installed in several directories. The configure step usually allows the user to specify the so-called install prefix, and is usually specified through the configure option configure --prefix=PREFIX, where PREFIX usually is by default /usr/local. The prefix specifies the common directory where all the components are installed.

The following directory are usually involved by the installation:

  • PREFIX/bin: contains the generated binaries (e.g. ffmpeg, ffplay, ffprobe etc. in the case of FFmpeg)
  • PREFIX/lib: contains the generated libraris (e.g. libavutil, libavcodec, libavformat etc. in the case of FFmpeg)
  • PREFIX/share: contains various system-independent components, especially documentation files and examples

By specifying the prefix, it is possible to define the installation layout.

Using a shared prefix like /usr/local/, different packages will be installed in the same directory, so in general it will be more difficult to revert the installation.

Using a prefix like /opt/PROJECT/, the project will be installed in a dedicated directory, and to remove from the system you can simply remove the /opt/PREFIX path. On the other hand, such installation will require to edit all the environment variables to point to the custom path.