Ubuntu / Linux news and application reviews.

I wanted to post a full how-to for compiling VLC Media Player and VLMC (VideoLAN Movie Creator) from GIT in Ubuntu Karmic for some time, but since I've already compiled both VLC and VLMC, the how-to couldn't have been complete (that's why I initially only posted some very basic steps) since there would be some dependencies missing (there might still be, but the how-to is now more accurate). But since the holidays are over and I had to go to work today, I tough I'd compile it on this computer and tell you exactly what dependencies you need to install and the complete compilation steps needed to run both of these applications developed by VideoLAN.

Current VLC version: 1.1.0-git
Current VLMC version: 0.0.1-git

The reason for also compiling VLC is that VLMC needs the latest VLC GIT version installed to run. That's also the reason you have to remove any VLC packages you may have installed on your computer (so that the GIT libraries are used).

Important: For all the "checkinstall" commands below: if it doesn't work for you, you can simply use "sudo make install" instead of "sudo checkinstall ...". The reason I like using "checkinstall" is that it creates a .deb file (for local use only - don't use it for distribution as it's not a normal .deb file with dependencies) so you can later remove or update the application, like any other application installed through a .deb file (sudo apt-get remove vlc x264 vlmc).


The first thing you need to do is install some dependencies and the tools needed to compile x264, VLC and VLMC:

sudo apt-get install checkinstall build-essential cmake libtool automake autoconf git-core ffmpeg libxcb-shm0-dev libxcb-xv0-dev libx11-xcb-dev libcdparanoia-dev libcdio-paranoia-dev libcdio-cdda-dev libqt4-dev qt4-dev-tools qt4-qmake nasm yasm libasm-dev lua5.1


QT libraries should be solved with "build-dep" but I had some issues with it.


And extremely important: remove all the VLC packages you may have installed through the Ubuntu repositories or PPAs:
sudo apt-get remove vlc vlc-data vlc-nox libvlc2 libvlccore2 mozilla-plugin-vlc vlc-plugin-jack vlc-plugin-pulse x264

You might as well search for VLC in Synaptic and remove everything.

Before getting started, please note that to be able to build VLC with the mozilla plugin, at the time I'm writing this post, you need to have xulrunner version 1.9.1, and not 1.9.2 and 1.9.3, so if you have any of the last 2 installed (of course, with -dev), remove them and install xullrunner-1.9.1. You can of course install xullrunner 1.9.2 or 1.9.3 after successfully compiling VLC

Compiling x264-git


x264 is optional but you might want it for enabling x264 in VLC.


cd && git clone git://git.videolan.org/x264.git
cd x264/
./configure
make
sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0ubuntu2" --default


Compiling VLC-git


vlc 1.1.0 git ubuntu


sudo apt-get build-dep vlc
cd && git clone git://git.videolan.org/vlc.git
cd vlc/
./bootstrap


We will now use configure with some basic options. Too see the available options, see ../configure --help. You can also simply use ../configure if you wish. ".." is needed because we will run the command in an empty folder and the configure file is one directory back.

mkdir build && cd build
../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 --enable-caca --enable-skins --enable-skins2 --enable-alsa --disable-kde --enable-qt4 --enable-ncurses --enable-release --enable-realrtsp --enable-twolame --enable-real --enable-cddax --enable-mozilla --with-mozilla-pkg=xulrunner-plugin --enable-x264


Look through the options and remove (disable) what you don't need and only keep what you need. You could use the latest SVN versions of ffmpeg and live555, but I compiled VLC with their repository versions. See instructions for building ffmpeg and live555, here.

Why disable GTK and KDE? Because on the VLC wiki it says:

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.


Now we can finally "make" and install it:
make
sudo checkinstall --fstrans=no --install=yes --pkgname=vlc --pkgversion "1:1.1.0-git`date +%Y%m%d`-0.0ubuntu2" --default



Possible issues:

While running "make", I got an error which is because the Vesa and Nvidia drivers installation order:
/usr/lib/libGL.so: No such file or directory ubuntu


To fix it, run the following commands:
sudo dpkg-divert --remove /usr/lib/libGL.so.1.2
sudo aptitude remove libgl1-mesa-glx
sudo aptitude install libgl1-mesa-glx
sudo rm /usr/lib/nvidia/libGL.so.1.2.xlibmesa
sudo aptitude install nvidia-glx-185


The above 'fix' (partially found here) presumes you are using nvidia 185 drivers. Change the last line if you are using a different version. Also, use "aptitude" instead of "apt-get", as this way you won't remove a lot of files because they depend on libgl11-mesa-glx. And finally, remember what packages are removed with the "sudo aptitude remove libgl1-mesa-glx" command, so you can install them back (just "ubuntu-desktop" and "nvidia-glx-185-dev" in my case).

Another possible issue is that even though you install VLC in /usr/lib/, it copies files to /usr/local/lib, and VLC fails to start with the following error (as seen here, but I've noticed some other files need symbolic links too):
vlc: error while loading shared libraries: libvlc.so.5: cannot open shared object file: No such file or directory

To fix this, you need to create symbolic links from some files in /usr/local/lib/ in /usr/lib/. To do this, run the following command:
sudo ln -s /usr/local/lib/libvlc* /usr/lib/
sudo ln -s /usr/local/lib/libx264.a /usr/lib/
sudo ln -s /usr/local/lib/vlc /usr/lib/vlc


Compile VLMC-git:


vlmc 0.0.1 git

cd && git clone git://github.com/VLMC/vlmc.git
cd vlmc/
cmake .
make


Now you can run VLMC:
./vlmc



Final note: There might still be some dependencies missing, but you will have to take care of those yourself (simply search for them in Synaptic or using apt-cache search). Wow! It only took me ~3 hours to write this post =).


References / further info:

VLC Wiki - Unix compile
VLC Wiki - Git