So I upgraded my VLC player. And it just crashes on opening. I was like WTF because I just got Firefox working again (unrelated issue). And I did not feel like hacking my way through the VLC package.
I started reading the documentation for Linux From Scratch because I’m not 100% satisfied with openSuSE at the moment. And I got as far as the part about building from source. Long story short, I’ve built from source before, but the refresher was nice.
So I was thinking about building VLC from source to sidestep the packaging problems I have been having. And it would be good practice for LFS.
I was able to get a source build of VLC working. And I want to share the steps with you.
[ol]
[li]Download the VLC source from here: VLC media player source code
[/li]
[li]Extract the source to a safe place like /home/michael/Downloads/vlc-0.9.5
[/li]
[li]Install the following development packages and their dependencies through YaST2:
[/li][LIST=2]
[li]hal-devel
[/li][li]dbus-1-devel
[/li][li]dbus-1-glib-devel
[/li][li]dbus-1-python-devel
[/li][li]dbus-1-qt3-devel
[/li][li]libmad-devel
[/li][li]libffmpeg-devel
[/li][li]compiz-devel (I think you need this if you use 3D acceleration.)
[/li][li]libqt4-devel
[/li][li]free-ttf-fonts
[/li]
[/ol]
[li]Open a terminal.
[/li]
[li]Type “export CXXFLAGS=”-march=nocona -O2 -pipe". Note that I specify the “nocona” architecture because I have an Intel P4 or later processor (Q6600). Read more here Submodel Options - Using the GNU Compiler Collection (GCC) The “-O2” (capital ‘o’ not zero) is a generic option that tells the compiler to optimize the code for speed. “-pipe” tells the compiler to use pipes instead of temporary files. This speeds up compilation a little bit.
[/li]
[li]At this point, it should be safe to issue “./configure --enable-static --enable-debug --disable-a52 --disable-fribidi --enable-faad” at the terminal. “–enable-static” tells the configure process to embed, or statically link, the libraries used in the compilation process into the binaries. The disadvantage is the binaries are much larger than normal. The advantage is that this version of VLC will be immune to library conflicts, which might be why I can’t use the packaged version of VLC. “–enable-debug” is in there so I could use gdb if necessary. You can probably drop this option. “–disable-a52” is in there because I did not have the A/52 source installed. And since I don’t use Dolby Digital, I decided to exclude support for it. “–disable-fribidi” is in there because I did not have the FriBidi source installed. And since I speak English, I do not need it. Take a look here to see if you need it: GNU FriBidi - Wikipedia, the free encyclopedia “–enable-faad” is in there because I have H.264 videos. And without this option, the sound does not work in those videos. It will take a while for the ./configure to complete.
[/li]
[li]The next step is to edit “vlc-config.in” (notice the “.in” extension) after the ./configure completes. This file affects compilation. And I wanted to tweak it a little before running make. I changed the cflags_tuning line to read, ‘cflags_tuning="-march=nocona -O2 -pipe"’ Notice that I just mirrored my earlier CXXFLAGS options. Remember: Change the “march=” option to suit your needs!
[/li]
[li]Now issue “make” at the terminal. Some caveats: make sure the CXXFLAGS environment variable is still defined. If you closed your terminal and opened a new one then this variable will be gone. Check by issuing “env | grep CXXFLAGS” at the terminal. If nothing shows up then you need to set the flag again as shown above. This flag must be set before the “make” command is issued. Also, if a make fails then issue “make clean” to reset the build environment. If you do that then you will also have to customize vlc-config.in again.
[/li]
[li]If you have gotten this far with no errors then all you should need to do is issue “./vlc” from the build directory, ex. /home/michael/Downloads/vlc-0.9.5, and VLC should launch. (More simply, issue “./vlc” at the terminal to launch VLC.) However, there is still one more thing you need to do.
[/li]
[li]Open VLC as described above. Click on Tools > Preferences > Subtitles & OSD. Change the “Font” option from “/usr/share/fonts/truetype/FreeType/FreeSerifBold.ttf” to “/usr/share/fonts/truetype/FreeSerifBold.ttf” Notice the /FreeType/ directory is missing from the second string. Make sure to click the Save button. OpenSuSE stores its fonts in a different place than where VLC looks by default. All we are doing here is pointing VLC to the right place.
[/li]
[/LIST]
That should be it! Hopefully you have a working and relatively robust VLC binary. All you need to do now is create an application launcher that points to the “vlc” script in the build directory so you can launch VLC from the desktop. You can find the chrome for the icon at [build_dir]/share/vlc48x48.png
Also, notice that I did not issue “make install” because I did not want to interfere with the VLC package from openSuSE. I’m just leaving my build in my Downloads directory for now. That is good enough for me.
If you are having a problem or want to say something then please leave your question or comments below.