Mar 13, 2011

How to compile VLC source code on MacOS and Fedora 12


1) On Mac OS (According to http://wiki.videolan.org/OSXCompile)

[*] Set the development environment

Install the Mac OS X Developer Tools or get them online.

You need at least Mac OS X 10.5 and Xcode 3.1.4 for compilation. Mac OS X 10.6 and its 3.2.x Xcode releases are also supported. Make sure that the LLVM GCC 4.2 compiler is installed.

Compiling with earlier releases of Mac OS X and/or Xcode will not work.

Additionally, you may need to install Subversion (SVN) and more importantly Git on your Mac.

[*] Get the source

Download the VLC media player source code (using Git) as described on the "Get the source" page or get a recent source tarball.
Note that the 3rd party libraries will probably break a few months after the release's publication.

[*] Build external libs

$ cd extras/contrib

$ ./bootstrap

$ make

[*] Prepare the VLC build

Now we return to VLC itself. Go back to the top level VLC source directory.

$ cd ../..

$ ./bootstrap

This will create configure and Makefiles for VLC media player (snapshots and releases already include this).

[*] Setup the correct compiler

Current revisions of VLC need to be compiled using Apple's llvm-gcc-4.2 compiler in its latest version. In case of failures, make sure that the latest version of Xcode is installed. To use this compiler, you need to export the respective variables. In a Bourne Shell, type this (if Xcode is installed to its default location; bash is the default shell on OS X):

$ export CC=/Developer/usr/bin/llvm-gcc-4.2

$ export CXX=/Developer/usr/bin/llvm-g++-4.2

$ export OBJC=/Developer/usr/bin/llvm-gcc-4.2

[*] Configure the VLC build

The next step is to configure, in the top level VLC source directory. In current revisions, you can simply run

$ ./configure --enable-debug

[*] Build VLC

After configure is finished, we can finally build VLC media player. A simple make will do the trick. If you want to use the resulting application package on a different Mac or a different account on the same Mac, run

$ make

$ make VLC-release.app

2) On Fedora Linux

[#] Download vlc source code 1.1.5 and log on Linux as root user

[#] $ tar -xzvf vlc-1.1.5.tar.bz

[#] Compile vlc by ./configure --prefix=/usr --enable-run-as-root

(--prefix=/usr is the directory for the installation)

[#] If get an error "configure: error: Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.
configure: error: Could not find lua. Lua is needed for some interfaces (rc, telnet, http) as well as many other custom scripts. Use --disable-lua to ignore this error."

Then search and download lua-devel from internet. And install it by "yum install lua-devel"

[#] Compile libmad

Download source from http://www.underbit.com/products/mad, and compile ./configure --prefix=/usr

If it has make error, "cc1: error: unrecognized command line option "-fforce-mem"
make[2]: *** [version.lo] Error 1
make[2]: Leaving directory `/home/izhier/download/libmad-0.15.1b' ", modify the makefile to delete -fforce-mem.

[#] $ ./configure --prefix=/usr --with-mad=/usr

If it has error, "configure: error: Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.", download ffmpeg from internet.

compile ffmpeg by "./configure --prefix=/root/soft/ffmpeg --enable-swscale --enable-postproc --enable-gpl" and then

$ make

$ make install

[#] If it has error about libavcodec, use

$ export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/ffmpeg/lib/pkgconfig"

To test it,

$ pkg-config --modversion libavcodec

Then it will show "52.20.1"

[#] Compile vlc by "./configure --prefix=/usr --with-mad=/usr"

If it has error, "configure: error: Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.", use

$ ./configure --help|grep swscale

it will show "--enable-swscale enable GPLed software scaler support [no]". Then, go back to ffmpeg directory and install it again,

$ ./configure --prefix=/usr/ffmpeg --enable-swscale

$ make

$ make install

[#] If it has error, "checking for ffmpeg/swscale.h... no checking for POSTPROC... no configure: error: Could not find libpostproc. Use --disable-postproc to ignore this error.", use

$ ./configure --help|grep postproc

it will show "--enable-postproc enable GPLed postprocessing support [no]"

Then,

$ ./configure --prefix=/usr/ffmpeg --enable-swscale --enable-postproc --enable-gpl

[#] If it shows error "checking for a52dec/a52.h... no
configure: error: Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.", download a52 from "http://liba52.sf.net" and then,

$ ./configure --prefix=/usr

$ make

$ make install

[#] Compile vlc,

$ ./configure --prefix=/usr --with-mad=/usr --with-a52=/usr

If it has error, "checking for FRIBIDI... configure: error: Package requirements (fribidi) were not met:
No package 'fribidi' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables FRIBIDI_CFLAGS
and FRIBIDI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.", download fribidi from website "http://fribidi.org/" and then install it,

$ ./configure --prefix=/usr

$ make

$ make install

[#] Compile vlc,

$ ./configure --prefix=/usr --with-mad=/usr --with-a52=/usr --enable-run-as-root

$ make

$ make install

[#] Now VLC on Fedora could be installed successfully!

2 comments:

  1. pretty helpful and nice, thanks, my friend.

    ReplyDelete
  2. hi...Im student from Informatics engineering nice article,
    thanks for sharing :)

    ReplyDelete