Difference between revisions of "UnixCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
(Update and cleanup)
Line 1: Line 1:
 
== Prepare your environment  ==
 
== Prepare your environment  ==
  
VLC uses gcc, automake, autoconf and friends for compilation. Make sure they are up to date and usable for your system.  
+
VLC requires a C compiler, development headers and a toolchain. gcc will do but you could also use LLVM or proprietary C99/C++ compilers such as Intel's.
+
 
 +
If you build from the [[Git]] repositories, you will also need the GNU build system, a.k.a. the "autotools" (autoconf, automake, libtool and gettext) to setup the Makefiles. Make sure they are up-to-date and usable for your system.
  
 
== Get the source  ==
 
== Get the source  ==
 +
Start by [[GetTheSource|getting the source]], using FTP for official releases, or using [[Git]] to track VLC development.
  
Start by [[GetTheSource|getting the source]], using FTP for releases, or using [[Git]] for development.
+
If your are using an official release, download source code, extract the archive and go into the resulting VLC directory, e.g.:
+
  % wget ftp://ftp.videolan.org/pub/videolan/vlc/1.1.11/vlc-1.1.11.tar.bz2
 
+
% tar xvjf vlc-1.1.11.tar.bz2
If your are using the release, download source code and extract the archive and go into your VLC directory.  
+
  % cd vlc-1.1.11
 
 
 
  % cd /path/to/your/vlc/folder/
 
 
 
If you are using the [[Git]] version, start by bootstrapping your VLC.  
 
   
 
  
  % cd /path/to/your/vlc/folder/
+
If you are using the [[Git]] development version, start by bootstrapping the source tree:
 +
  % cd vlc
 
  % ./bootstrap
 
  % ./bootstrap
 +
Bootstrapping will fail if the autotools are missing or out-of-date.
  
== Get the 3rd party libs ==
+
== Get the third-party libraries ==
 
+
Now you can configure the VLC build. But first, you need to make sure that all the required dependencies are in place.
Now you can start to configure VLC. Remember to first take a look at <tt>./configure --help</tt>. Take a good look at that enormous list of options.  
 
 
 
 
=== General info  ===
 
  
It is very important that you install and enable all the 3rd party libraries that you will be needing and let me tell you that that are a lot. If you don't install them you will end up with an application that well..... essentially doesn't do anything. See [[Contrib Status|here]] for a complete list.  
+
Take a look at <tt>./configure --help</tt>. Take a good look at that enormous list of options.
 
  
There are some very important dependencies: gettext (nls) for international support (required), libdvbpsi for mpeg files and streams support, libmad for mp3 decoding, libmpeg2 for mpeg 1 and 2 video support, ffmpeg (libavcodec, libavformats, libswscale) for support of mpeg4 and many other types of video, liba52 for dolby (AC3) sound, alsa for proper audio output, xvideo for proper video output, QT4 for proper GUI support and libdvd* for DVD support.  
+
=== General infos  ===
 +
It is very important that you do install and enable all the 3rd party libraries that you need. Yes, there is going to be a lot of them if you want a complete or even mostly functional VLC build. If you fail to install a required library, you will end up with a VLC application that well..... essentially does not do anything useful. See [[Contrib Status|here]] for a complete list.
 
   
 
   
 +
There are some very important dependencies: gettext (NLS) for international support (required), libdvbpsi for MPEG-TS files and streams support, libmad for MP3 audio decoding, libmpeg2 for MPEG1 and MPEG2 video support, FFmpeg or libav (libavcodec, libavformat, libpostproc, libswscale and optionally libavio) for MPEG4 and most other audio and video codecs, and many file formats, liba52 for Dolby (AC3) sound, dvdread and dvdnav for DVD playback, live555 for RTSP stream playback, etc.
  
'''Be careful!''' Some of the libraries are better not to be installed (at all, beware of old installations) and should be linked to directly. These are mostly ffmpeg and liveMedia.  
+
For audio output, you will need probably alsa-lib (on Linux) and/or libpulse (for PulseAudio).
 +
For video output, you will normally need XCB/XVideo and/or OpenGL/GLX.
 +
And Qt4 is required to get the GUI support.
 
   
 
   
 +
'''Note''' that you need to install the development packages (development header files and import libraries) to compile VLC, not just the run-time. On Debian/Ubuntu, the correct package names end with -dev. On RPM distributions, they usually end in -devel.
  
There are also some libraries that are no longer being maintained and which we advise not to use. These include the gtk, gnome and kde GUIs, the glide and mga modules.  
+
'''Be careful!''' If the libraries is not provided by your distribution, you may be better off linking VLC with them statically. Otherwise, you may encounter version problems if another multimedia application updates the libraries later. This is especially true of FFmpeg or libav, and live555.
 
  
 
=== Get'em  ===
 
=== Get'em  ===
 
 
There are a few ways to get those libs. You should use only one method at a time:  
 
There are a few ways to get those libs. You should use only one method at a time:  
 
   
 
   
 
+
==== The preferred method ====
*'''The preferred way''': Using your distribution or portage system, in order to get all the needed libs.
+
Use your distribution packaging or portage system, in order to get all the needed libs.
 
 
 
For example on Debian or Ubuntu:  
 
For example on Debian or Ubuntu:  
   
+
  # apt-get build-dep vlc
  
  # apt-get build-dep vlc
+
==== The method for badly-behaved distributions====
 +
If your distribution does not provide the needed libraries,
 +
or you really want to link VLC statically, use the VLC contribs system.
 +
It is included in the VLC source:
 +
% cd contrib
 +
% mkdir native
 +
  % cd native
 +
% ../bootstrap
 +
% make
  
*If your distro is really bad and doesn't provide the libs, no -dev or -devel packages: Using the contribs system in VLC's sources
+
'''Note''' the commands above are for VLC 1.2 or later. Details differ slightly for older versions:
 +
% cd extras/contrib
 +
% ./bootstrap
 +
% make
  
&nbsp;% cd extras/contrib;
+
Either way, that should download and build a lot of those libraries for you. Some basic OS support libraries are not included and must really be installed through the packaging system in any case, notably ALSA, PulseAudio and OpenGL.
&nbsp;% ./bootstrap;
 
&nbsp;% make;
 
  
This should download and build a lot of those libs 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.
 
  
*Read the [[Contrib Status|list]], download them and build by hand.
+
==== The method for people with too much time to waste ====
 +
Read the [[Contrib Status|list]], download them and build them by hand.
  
 
== Configuration  ==
 
== Configuration  ==
 +
You probably need to tweak the "configure" line.
  
You need to tweak your configure line.
+
<tt>./configure</tt> 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:
 
 
 
<tt>./configure</tt> is used to check whether your system is able to compile VLC. Also you choose the functionalities of your build.  
 
 
 
 
 
  % ./configure --help
 
  % ./configure --help
 
will show you the various options
 
 
   
 
   
 
 
=== Special libs  ===
 
=== Special libs  ===
 
+
Use <tt>--with-live555-path=path/to/livemedia/source/tree</tt> in connection with --enable-live555&lt;/tt&gt;. For FFmpeg or libav, pkg-config is the only reliable way for VLC's configure to find the libraries. So you need to set PKG_CONFIG_PATH correctly if your FFmpeg/libav libraries are not installed at the default prefix (meaning /usr) or you want to use static linking.  
Use <tt>--with-live555-path=path/to/livemedia/source/tree</tt> in connection with --enable-live555&lt;/tt&gt;. For ffmpeg, the only reliable way for VLC's configure to know how your ffmpeg's libs were compiled is to use pkg-config. So you need to set PKG_CONFIG_PATH correctly if your ffmpeg is not installed at the default place or you want to use static linking.  
 
 
  
 
=== Final configuration  ===
 
=== Final configuration  ===
 
 
If you want to install VLC into another directory, run  
 
If you want to install VLC into another directory, run  
 
   
 
   
 
 
  % ./configure --prefix=/path/to/install/folder/
 
  % ./configure --prefix=/path/to/install/folder/
  
 
This is an example of a typical VLC configure line:  
 
This is an example of a typical VLC configure line:  
 
   
 
   
 
+
  % ./configure --enable-x11 --enable-xvideo --enable-sdl --enable-avcodec --enable-avformat --enable-swscale --enable-mad --enable-libdvbpsi --enable-a52 --enable-libmpeg2 --enable-dvdnav --enable-faad --enable-vorbis --enable-ogg --enable-theora --enable-faac --enable-mkv --enable-freetype --enable-fribidi --enable-speex --enable-flac --enable-live555 --with-live555-tree=/usr/lib/live --enable-caca --enable-skins --enable-skins2 --enable-alsa --enable-qt4 --enable-ncurses
  % ./configure --enable-x11 --enable-xvideo --disable-gtk --enable-sdl --enable-avcodec --enable-avformat --enable-swscale --enable-mad --enable-libdvbpsi --enable-a52 --enable-libmpeg2 --enable-dvdnav --enable-faad --enable-vorbis --enable-ogg --enable-theora --enable-faac --enable-mkv --enable-freetype --enable-fribidi --enable-speex --enable-flac --enable-live555 --with-live555-tree=/usr/lib/live --enable-caca --enable-skins --enable-skins2 --enable-alsa --disable-kde --enable-qt4 --enable-ncurses --enable-release
 
 
   
 
   
 
 
[[User:J-b#VLC_configure_line|Here]] is another.  
 
[[User:J-b#VLC_configure_line|Here]] is another.  
 
 
== Ubuntu  ==
 
  
If you get continuous errors while ./configure then consider reinstalling the corresponding libraries. This will set the paths and other information correctly. Check the $PKG_CONFIG_PATH(environment variable) whether it is set to a path where the libraries like libavcodec.pc are available. Otherwise create the environment variable, export it and then update the ldconfig
+
=== Ubuntu ===
&nbsp;
 
  
== Compilation  ==
+
If you get continuous errors while ./configure then consider reinstalling the corresponding libraries. This will set the paths and other information correctly. Check the $PKG_CONFIG_PATH(environment variable) whether it is set to a path where the libraries like libavcodec.pc are available. Otherwise create the environment variable, export it and then update the ldconfig.
  
 +
== Compilation ==
 
Compile VLC:  
 
Compile VLC:  
 
 
 
  % make
 
  % make
  
As root (type "su" to change to root account):  
+
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
 
  # make install
  
To remove files created during the compile (optional) type:  
+
You can uninstall later with this, but you need to keep the build tree untouched until then:
   
+
  # make uninstall
  
 +
To remove files created during the compile (optional) type:
 
  % make clean
 
  % make clean
  
Line 123: Line 111:
  
 
Compiling on [[Win32CompileCygwin|Cygwin]] may be broken from time to time.  
 
Compiling on [[Win32CompileCygwin|Cygwin]] may be broken from time to time.  
 
  
 
=== Debian  ===
 
=== Debian  ===
 
+
Debian users who want to compile VLC should install the packages below:
Debian users who want to compile VLC should install the packages below. Note: If you just want to ''use'' VLC media player then simply install the package vlc (<tt>sudo apt-get install vlc</tt>) - the unstable version is normally very up-to-date (and stable is, er, stable&nbsp;;-)
 
 
 
 
 
*[http://packages.debian.org/unstable/libdevel/libavcodec-dev libavcodec-dev]  
 
*[http://packages.debian.org/unstable/libdevel/libavcodec-dev libavcodec-dev]  
 
 
*[http://packages.debian.org/unstable/libdevel/libpostproc-dev libpostproc-dev]  
 
*[http://packages.debian.org/unstable/libdevel/libpostproc-dev libpostproc-dev]  
 
 
*[http://packages.debian.org/unstable/libdevel/libmpeg2-4-dev libmpeg2-4-dev]
 
*[http://packages.debian.org/unstable/libdevel/libmpeg2-4-dev libmpeg2-4-dev]
 +
 +
If you just want to ''use'' VLC media player then simply install the package vlc (<tt>sudo apt-get install vlc</tt>) - the unstable version is fairly up-to-date most of the time, while the stable is, err, stable and very old&nbsp;;-)
  
 
== Version  ==
 
== Version  ==

Revision as of 17:30, 29 September 2011

Prepare your environment

VLC requires a C compiler, development headers and a toolchain. gcc will do but you could also use LLVM or proprietary C99/C++ compilers such as Intel's.

If you build from the Git repositories, you will also need the GNU build system, a.k.a. the "autotools" (autoconf, automake, libtool and gettext) to setup the Makefiles. Make sure they are up-to-date and usable for your system.

Get the source

Start by getting the source, using FTP for official releases, or using Git to track VLC development.

If your are using an official release, download source code, extract the archive and go into the resulting VLC directory, e.g.:

% wget ftp://ftp.videolan.org/pub/videolan/vlc/1.1.11/vlc-1.1.11.tar.bz2
% tar xvjf vlc-1.1.11.tar.bz2
% cd vlc-1.1.11

If you are using the Git development version, start by bootstrapping the source tree:

% cd vlc
% ./bootstrap

Bootstrapping will fail if the autotools are missing or out-of-date.

Get the third-party libraries

Now you can configure the VLC build. But first, you need to make sure that all the required dependencies are in place.

Take a look at ./configure --help. Take a good look at that enormous list of options.

General infos

It is very important that you do install and enable all the 3rd party libraries that you need. Yes, there is going to be a lot of them if you want a complete or even mostly functional VLC build. If you fail to install a required library, you will end up with a VLC application that well..... essentially does not do anything useful. See here for a complete list.

There are some very important dependencies: gettext (NLS) for international support (required), libdvbpsi for MPEG-TS files and streams support, libmad for MP3 audio decoding, libmpeg2 for MPEG1 and MPEG2 video support, FFmpeg or libav (libavcodec, libavformat, libpostproc, libswscale and optionally libavio) for MPEG4 and most other audio and video codecs, and many file formats, liba52 for Dolby (AC3) sound, dvdread and dvdnav for DVD playback, live555 for RTSP stream playback, etc.

For audio output, you will need probably alsa-lib (on Linux) and/or libpulse (for PulseAudio). For video output, you will normally need XCB/XVideo and/or OpenGL/GLX. And Qt4 is required to get the GUI support.

Note that you need to install the development packages (development header files and import libraries) to compile VLC, not just the run-time. On Debian/Ubuntu, the correct package names end with -dev. On RPM distributions, they usually end in -devel.

Be careful! If the libraries is not provided by your distribution, you may be better off linking VLC with them statically. Otherwise, you may encounter version problems if another multimedia application updates the libraries later. This is especially true of FFmpeg or libav, and live555.

Get'em

There are a few ways to get those libs. You should use only one method at a time:

The preferred method

Use your distribution packaging or portage system, in order to get all the needed libs. For example on Debian or Ubuntu:

# apt-get build-dep vlc

The method for badly-behaved distributions

If your distribution does not provide the needed libraries, or you really want to link VLC statically, use the VLC contribs system. It is included in the VLC source:

% cd contrib
% mkdir native
% cd native
% ../bootstrap
% make

Note the commands above are for VLC 1.2 or later. Details differ slightly for older versions:

% cd extras/contrib
% ./bootstrap
% make

Either way, that should download and build a lot of those libraries for you. Some basic OS support libraries are not included and must really be installed through the packaging system in any case, notably ALSA, PulseAudio and OpenGL.

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.

The method for people with too much time to waste

Read the list, download them and build them by hand.

Configuration

You probably need to tweak the "configure" line.

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

Special libs

Use --with-live555-path=path/to/livemedia/source/tree in connection with --enable-live555</tt>. For FFmpeg or libav, pkg-config is the only reliable way for VLC's configure to find the libraries. So you need to set PKG_CONFIG_PATH correctly if your FFmpeg/libav libraries are not installed at the default prefix (meaning /usr) or you want to use static linking.

Final configuration

If you want to install VLC into another directory, run

% ./configure --prefix=/path/to/install/folder/

This is an example of a typical VLC configure line:

% ./configure --enable-x11 --enable-xvideo --enable-sdl --enable-avcodec --enable-avformat --enable-swscale --enable-mad --enable-libdvbpsi --enable-a52 --enable-libmpeg2 --enable-dvdnav --enable-faad --enable-vorbis --enable-ogg --enable-theora --enable-faac --enable-mkv --enable-freetype --enable-fribidi --enable-speex --enable-flac --enable-live555 --with-live555-tree=/usr/lib/live --enable-caca --enable-skins --enable-skins2 --enable-alsa --enable-qt4 --enable-ncurses

Here is another.

Ubuntu

If you get continuous errors while ./configure then consider reinstalling the corresponding libraries. This will set the paths and other information correctly. Check the $PKG_CONFIG_PATH(environment variable) whether it is set to a path where the libraries like libavcodec.pc are available. Otherwise create the environment variable, export it and then update the ldconfig.

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

To remove files created during the compile (optional) type:

% make clean

Notes

Cygwin

Compiling on Cygwin may be broken from time to time.

Debian

Debian users who want to compile VLC should install the packages below:

If you just want to use VLC media player then simply install the package vlc (sudo apt-get install vlc) - the unstable version is fairly up-to-date most of the time, while the stable is, err, stable and very old ;-) 

Version

This HOWTO has been originally written by Derk-Jan Hartman.


It has been modified and updated by Jean-Baptiste Kempf.


It was spelled-checked and sudoed by materthron.


Further spell-checking, grammar corrections, and replaced a word with "bad" by Neo_The_User.


Fixed wrong command for getting lua51 on Ubuntu (dot was missing) in Possible problems section Titanic.

Possible problems

LUA

You may need to install lua if you get "LUA byte compiler missing." message.

For Ubuntu:

% sudo aptitude install lua5.1


XCB

VLC 1.1 requires xcb libraries. Configuring without xcb may result in the following error

checking for XLIB_XCB... configure: error: Package requirements (x11-xcb) were not met:
No package 'x11-xcb' found

To install these libraries run the following

sudo apt-get install libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev libx11-xcb-dev

Alternatively, you can disable xcb by running ./configure --disable-xcb Note that your VLC will only be able to do Video Output to a separate SDL window

--Gnosygnu 22:30, 23 September 2010 (UTC)


Subversion

VLC 1.1 requires Subversion to be installed in order to build ffmpeg in the contribs packages.

To install Subversion on Ubuntu run:

sudo apt-get install subversion

--Fluffysquirrels 03:42, 12 December 2010 (UTC)