Changes between Version 9 and Version 10 of CompilationGuide/Generic


Ignore:
Timestamp:
Dec 31, 2013, 12:23:06 AM (6 years ago)
Author:
llogan
Comment:

nits and copyedit

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/Generic

    v9 v10  
    1515
    1616Most source packages installation assumes the following steps:
    17 * configuration (through a configure script)
    18 * compilation (through make)
    19 * installation (through make install)
     17* configuration (with a configure script)
     18* compilation (with {{{make}}})
     19* installation (with {{{make install}}})
    2020
    21 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.
     21Configuration will allow creation of the necessary files required by the following compilation step, and is done through a configure script usually provided by the source package.
    2222During configuration it is possible to define the install prefix and the enabled components.
    2323
    24 Compilation usually consists into running make after the configuration step was done. In this phase the required libraries and binaries are generated.
     24Compilation usually consists of running make after the configuration step completes. In this phase the required libraries and binaries are generated.
    2525
    26 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.
     26Installation 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.
    2727
    28 For a vanilla compilation and install, you will usually run the following commands:
     28For a vanilla compilation and install you will usually run the following commands:
    2929{{{
    3030configure
     
    3939A 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.
    4040
    41 The following directories are usually involved by the installation:
     41The following directories are usually involved in the installation:
    4242* PREFIX/bin: contains the generated binaries (e.g. {{{ffmpeg}}}, {{{ffplay}}}, {{{ffprobe}}} etc. in the case of FFmpeg)
    43 * PREFIX/include: contains the library headers (e.g. {{{libavutil/avstring.h}}}, {{{libavcodec/avcodec.h}}}, {{{libavformat/avformat.h}}} etc. in case of FFmpeg), required to compile applications linked against the package libraries
    44 * PREFIX/lib: contains the generated libraris (e.g. {{{libavutil}}}, {{{libavcodec}}}, {{{libavformat}}} etc. in the case of FFmpeg)
    45 * PREFIX/share: contains various system-independent components, especially documentation files and examples
     43* PREFIX/include: contains the library headers (e.g. {{{libavutil/avstring.h}}}, {{{libavcodec/avcodec.h}}}, {{{libavformat/avformat.h}}} etc. in case of FFmpeg) required to compile applications linked against the package libraries
     44* PREFIX/lib: contains the generated libraries (e.g. {{{libavutil}}}, {{{libavcodec}}}, {{{libavformat}}} etc. in the case of FFmpeg)
     45* PREFIX/share: contains various system-independent components; especially documentation files and examples
    4646
    47 By specifying the prefix, it is possible to define the installation layout.
     47By specifying the prefix it is possible to define the installation layout.
    4848
    49 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.
     49By 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.
    5050
    5151Using 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.
     
    6060A list of the affected variables follows:
    6161
    62 * PATH: defines the list of :-separated paths where the system looks for binaries. For example if you install your package in {{{/usr/local/}}}, you should update the PATH so that it will contain {{{/usr/local/bin}}}. This can be done for example through the command {{{export PATH=/usr/local/bin:$PATH}}}.
    63 * LD_LIBRARY_PATH: contains the :-separated paths where the system looks for libraries. For example if you install your package in {{{/usr/local/}}}, you should update the LD_LIBRARY_PATH so that it will contain {{{/usr/local/lib}}}. This can be done for example through the command {{{export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH}}}. This variable is sometimes deprecated in favor of the use of ldconfig.
    64 * CFLAGS: contains flags used by the C compiler, usually include preprocessing directives like {{{-IPREFIX/include}}} or compilation flags. Custom CFLAGS are usually prefixed to the source package compiler flags by the source package build system. Alternatively many build systems allow to specify the configure option {{{-extra-cflags}}}.
    65 * LDFLAGS: these are directives used by the linker, usually include linking directives like {{{-LPREFIX/lib}}} needed to find libraries installed in custom paths. Custom LDFLAGS are usually prefixed to the source package linker flags by the source package build system. Alternatively many build systems allow to specify the configure option {{{-extra-ldflags}}}.
    66 * PKG_CONFIG_PATH: contains the :-separated paths used by {{{pkg-config}}} to detect the pkg-config files used by many build systems to detect the custom CFLAGS/LDFLAGS used by a specific library.
     62* PATH: defines the list of {{{:}}}-separated paths where the system looks for binaries. For example if you install your package in {{{/usr/local/}}}, you should update the PATH so that it will contain {{{/usr/local/bin}}}. This can be done for example through the command {{{export PATH=/usr/local/bin:$PATH}}}.
     63* LD_LIBRARY_PATH: contains the {{{:}}}-separated paths where the system looks for libraries. For example if you install your package in {{{/usr/local/}}}, you should update the LD_LIBRARY_PATH so that it will contain {{{/usr/local/lib}}}. This can be done for example through the command {{{export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH}}}. This variable is sometimes deprecated in favor of the use of {{{ldconfig}}}.
     64* CFLAGS: contains flags used by the C compiler, and usually includes preprocessing directives like {{{-IPREFIX/include}}} or compilation flags. Custom CFLAGS are usually prefixed to the source package compiler flags by the source package build system. Alternatively many build systems allow to specify the configure option {{{-extra-cflags}}}.
     65* LDFLAGS: these are directives used by the linker, and usually include linking directives like {{{-LPREFIX/lib}}} needed to find libraries installed in custom paths. Custom LDFLAGS are usually prefixed to the source package linker flags by the source package build system. Alternatively, many build systems allow to specify the configure option {{{-extra-ldflags}}}.
     66* PKG_CONFIG_PATH: contains the {{{:}}}-separated paths used by {{{pkg-config}}} to detect the pkg-config files used by many build systems to detect the custom CFLAGS/LDFLAGS used by a specific library.
    6767
    6868In case you installed a package in a non standard path, you need to update these environment libraries so that system tools will be able to detect the package components. This is especially required when running a configure script for a package relying on other installed libraries/headers/tools.
    6969
    70 Environment variables are usually defined in the profile file, for example {{{.profile}}} defined in the user directory for sh/bash users, and in {{{/etc/profile}}}. You should probably update this file in order to set permanently your custom environment. Alternatively you can set the variables in a script or in a particular shell session.
     70Environment variables are usually defined in the profile file, for example {{{.profile}}} defined in the user directory for sh/bash users, and in {{{/etc/profile}}}. This file can be edited to permanently set the custom environment. Alternatively, the variables can be set in a script or in a particular shell session.
    7171
    7272Remember to export the variables to the child process, e.g. using the {{{export}}} command. Read the fine documentation of your shell for more detailed information. 
     
    7474== LD_LIBRARY_PATH and ldconfig ==
    7575
    76 When you link a library depending on other libraries, the tools will look for the libraries to link in a list of standard paths (typically, {{{/usr/lib}}}, and in other paths which are set in the system. Some systems rely on the {{{LD_LIBRARY_PATH}}} library. Alternatively you may set the global path through the {{{ldconfig}}} utility, which is done editing the {{{/etc/ld.so.conf}}} system configuration file.
     76When you link a library depending on other libraries the tools will look for the libraries to link in a list of standard paths (typically {{{/usr/lib}}}) and in other paths which are set in the system. Some systems rely on the {{{LD_LIBRARY_PATH}}} library. Alternatively, you may set the global path through the {{{ldconfig}}} utility, which is done editing the {{{/etc/ld.so.conf}}} system configuration file.
    7777
    7878Note that on some systems the {{{LD_LIBRARY_PATH}}} variable defined in the shell profile is reset for security reasons (e.g. see https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728), so you may need to reset it per-session or per-script.
     
    8181== Configuration prerequisites and distribution packages ==
    8282
    83 When configuring a package, you may be required to check for the presence of some required libraries and headers. Many distribution will provide binary package for the required libraries, so you may rely on that rather than compile and install from scratch.
     83When configuring a package, you may be required to check for the presence of some required libraries and headers. Many distribution will provide binary packages for the required libraries, so you may rely on these packages rather than compile and install from scratch.
    8484
    85 In general, for a library you will need the library package and the development package associated to that library. The library package contains only the library, the development package will contain also the headers and the other files which are required for compiling a package depending on those libraries. On Debian-based distribution systems, the development packages have the -dev suffix, on RedHat-based distribution systems, they have the -devel suffix.
     85In general, for a library you will need the library package and the development package associated to that library. The library package contains only the library, the development package will contain also the headers and the other files which are required for compiling a package depending on those libraries. On Debian-based distribution systems, the development packages have the -dev suffix, on RedHat-based distribution systems, they have the -devel suffix. Some distributions, such as Arch Linux, do not separate their packages and the standard package will also contain the necessary development files.
    8686
    87 For example on Debian, if you want to configure FFmpeg with {{{--enable-libmp3lame}}}, you will need to install the libmp3lame development package which will be called {{{libmp3lame-dev}}}.
     87For example on Debian, if you want to configure FFmpeg with {{{--enable-libmp3lame}}}, you will need to install the libmp3lame development package named {{{libmp3lame-dev}}}.
    8888
    8989You should also make sure that the library version provided by the distribution is compatible with the one required by the configured source package. If the required package is more recent than the library version provided by your distribution, you may need to install from source.
    9090
    9191
    92 == Post-installation troubleshoot ==
     92== Post-installation troubleshooting ==
    9393
    9494First of all verify that the binaries, headers and libraries have been installed in the supposed location (along the PREFIX path). To verify the binaries install you can simply run a command with the tool name, and verify the complete path with {{{which -a}}}, which will show all the tools with the given name available in the system.
    9595
    96 Extra care must be paid in case you have several installations of the same package, in order to avoid conflicts.
     96Extra care must be paid in case you have several installations of the same package in order to avoid conflicts.