Chinaunix首页 | 论坛 | 博客
  • 博客访问: 856779
  • 博文数量: 1384
  • 博客积分: 27795
  • 博客等级: 上将
  • 技术积分: 16887
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-12 09:28
个人简介

只是心态,抓住机会。

文章分类

全部博文(1384)

文章存档

2014年(3)

2013年(403)

2012年(978)

分类: LINUX

2012-09-01 19:43:16

UnixCompile
From VideoLAN Wiki
Jump to: ,
Contents [] 
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 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.

On Fedora:

% sudo yum install git libtool pkg-config

On Debian or Ubuntu:

% sudo apt-get install git libtool build-essential pkg-config autoconf

On Arch

% sudo pacman -S base-devel git pkg-config autoconf automake Get the source

Start by , using FTP for official releases, or using to track VLC development.

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

% wget % tar xvJf vlc-2.0.3.tar.xz % cd vlc-2.0.3

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

% git clone % cd vlc % ./bootstrap

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

Get the third-party libraries

Now you could 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.

It is very important that you do install and enable all the 3rd party libraries that you need. Yes, there are 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 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 ) and/or libpulse (for ). 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 are 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.

There are a several ways to get those libraries. 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:

$ sudo apt-get build-dep vlc

openSUSE users might have a look at the source-install (si) command in the zypper manpage:

$ sudo zypper si -d vlc

Note: To get the libraries, you must first add the VLC repositories to your system repositories. For example in openSUSE:

$ sudo zypper ar VLC

You should replace with the version of your system (12.1, 11.4, 11.3, 11.2 or 11.1)

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.

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.

# apt-get install subversion yasm cvs cmake

Then you can run:

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

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

% cd extras/contrib % ./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.

The method for people with too much time to waste

Read the , download them and build them by hand.

Regardless of the method

In any case, some basic OS support libraries are not included and must really be installed through the packaging system in any case, notably , and .

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

VLC 2.0 and later: 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.

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.

(Beginner's guide: enter the command

% ./configure --help | less

and hit enter. Type a slash '/', type "disabled" (without quotes), hit enter. Pressing n goes to the next match, N goes to previous match, q returns to the command line. Use the up/down arrow keys to scroll. All matches except the --cache-file option (which belongs to configure itself) are VLC features that must be forced on if desired.)

VLC 1.1 and earlier: You probably need to tweak the "configure" line.

Special libs

VLC 2.0 and later: there are no special libraries. If live555 exists in the contrib/ subdirectory, it is detected automatically. Any 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.

VLC 1.1 and earlier: Use --with-live555-path=path/to/livemedia/source/tree in connection with --enable-live555. 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

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 may be broken from time to time as Cygwin packages change. We recommend instead. Consider yourself warned.

Debian/Ubuntu

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 ;-)

Troubleshooting / common problems 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:

% sudo apt-get install lua5.1

On Fedora:

% sudo yum install lua 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!

To install these libraries run the following commands (Debian/Ubuntu):

% sudo apt-get install libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-composite0-dev

Under Fedora:

% sudo yum install libxcb-devel xcb-util-devel

For OpenGL (Debian/Ubuntu only), you will additionally need XLib with XCB:

% sudo apt-get install libx11-xcb-dev

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.

Compile fails after git pull

It is likely that the sources in the repository have changed significantly since they were last pulled, and a build system cache has gone out of date. Try the troubleshooting methods described in the .

Retrieved from ""
Views
Personal tools
if (window.isMSIE55) fixalpha();
Site Navigation
VideoLAN websites
Important Pages
Wiki
Toolbox
if(window.mw){ mw.loader.load(["mediawiki.user", "mediawiki.util", "mediawiki.page.ready", "mediawiki.legacy.wikibits", "mediawiki.legacy.ajax"]); } if(window.mw){ mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":1,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"highlightbroken":1,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":1,"showtoolbar":1,"skin":"monobook","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,"watchlistdays":3,"watchlisthideanons":0, "watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"usebetatoolbar":1,"usebetatoolbar-cgd":1,"wikieditor-preview":1,"variant":"en","language":"en","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"searchNs100":true,"searchNs101":false});;mw.user.tokens.set({"editToken":"+\\","watchToken":false});;mw.loader.state({"user.options":"ready","user.tokens":"ready"}); /* cache key: VideoLANwikidb:resourceloader:filter:minify-js:4:245e8a771c4d34f8423087b866eff67f */ }
阅读(3682) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~