VLC Crashes > Build your own VLC!

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.

Two things:

One, the code in step five is ‘export CXXFLAGS="-march=nocona -O2 -pipe"’. I forgot to close the quote around the command in the text. Remember that the double quotes around march, O2 and pipe are required.

Two, below are the repositories that I used. Note that I use the openSuSE 10.3 installation DVD as one of my repositories. I think you can substitute the main repository for the DVD.

Required Repositories:

  1. openSUSE-10.3-DVD 10.3
  2. 10.3 - Main Repository (OSS)
  3. openSUSE-10.3-Updates
  4. 10.3 - VideoLan

Mike

Hey Mike

This is truely very useful. It worked a treat for me as I have been unable to get the latest one-click install version of vlc working on my SuSE 10.3. Compiled and run successfull from the local compiled directory.

However, when I do the final step - make install - and try to start vlc from /usr/local/bin/vlc I get this error:

/usr/local/bin/vlc: error while loading shared libraries: libvlc.so.2: cannot open shared object file: No such file or directory

Would you happen to know what is causing this and perhaps how to fix it?

Kind regards

Nigel

Did you use the --enable-static option during the ./configure? I would not expect a statically linked binary to be asking for a shared object library.

If you did not use that option then a quick and dirty fix would be to find libvlc.so.2 under the build directory and to copy it to the same directory as the binary. But then again VLC might just ask you for a different library the next time you run it. In that case, you’ll keep having to launch it and copy files until it finally runs.

If you did use that option then maybe you are picking up another copy of VLC that is not statically linked. Perhaps you have some leftovers from your failed one-click install.

Also note that I did not run a “make install” because I did not want to interfere with the VLC package from the repository. I was saying not to run a make install in case you were following the documentation in the source tarball.

Please remember that I statically linked my VLC build and ran it from the build directory because I wanted to keep directories like /usr/local/bin pristine. When you start making manual changes to /usr or building binaries linked against shared libraries managed by YaST, you are asking for a clean reinstall.

Please don’t hesitate to ask more questions.

HTH,
Mike

hmm…i don’t thing is necessary to build own vlc, because version installed from packman repository is working without problems in my 11.1 with GNOME

Hey Mike

This is truely very useful. It worked a treat for me as I have been
unable to get the latest one-click install version of vlc working on my
SuSE 10.3. Compiled and run successfull from the local compiled
directory.

However, when I do the final step - make install - and try to start vlc
from /usr/local/bin/vlc I get this error:

/usr/local/bin/vlc: error while loading shared libraries:
libvlc.so.2: cannot open shared object file: No such file or directory

Would you happen to know what is causing this and perhaps how to fix
it?

Kind regards

Nigel


nigelha

nigelha’s Profile: http://forums.opensuse.org/member.php?userid=19339
View this thread: http://forums.opensuse.org/showthread.php?t=398340

Did you use the --enable-static option during the ./configure? I would
not expect a statically linked binary to be asking for a shared object
library.

If you did not use that option then a quick and dirty fix would be to
find libvlc.so.2 under the build directory and to copy it to the same
directory as the binary. But then again VLC might just ask you for a
different library the next time you run it. In that case, you’ll keep
having to launch it and copy files until it finally runs.

If you did use that option then maybe you are picking up another copy
of VLC that is not statically linked. Perhaps you have some leftovers
from your failed one-click install.

Also note that I did not run a “make install” because I did not want
to interfere with the VLC package from the repository. I was saying not
to run a make install in case you were following the documentation in
the source tarball.

Please remember that I statically linked my VLC build and ran it from
the build directory because I wanted to keep directories like
/usr/local/bin pristine. When you start making manual changes to /usr or
building binaries linked against shared libraries managed by YaST, you
are asking for a clean reinstall.

Please don’t hesitate to ask more questions.

HTH,
Mike


mmientus

mmientus’s Profile: http://forums.opensuse.org/member.php?userid=13825
View this thread: http://forums.opensuse.org/showthread.php?t=398340

hmm…i don’t thing is necessary to build own vlc, because version
installed from packman repository is working without problems in my 11.1
with GNOME


6205

6205’s Profile: http://forums.opensuse.org/member.php?userid=2283
View this thread: http://forums.opensuse.org/showthread.php?t=398340