ubuntu下编译VLC源码

时间:2020-12-30 05:56:07

1、从git上获得VLC源代码,当然你要确定你已经安装好了git:

git  clone git://git.videolan.org/vlc.git


vlc源码还是挺大的,我下载下来一共是214M多

2、cd vlc

ls

AUTHORS    compat        doc      m4           po      THANKS
autotools  configure.ac  extras   make-alias   README
bin        contrib       include  Makefile.am  share
bindings   COPYING       INSTALL  modules      src
bootstrap  COPYING.LIB   lib      NEWS         test

3、./bootstrap

我在这里遇到一个问题:

./bootstrap
NOTE: GNU gettext appears to be missing or out-of-date.
Please install or update GNU gettext.
Also check if you have cvs, a dependency of autopoint.
Otherwise, you will not be able to build a source tarball.
==============================================================


generating modules/**/Makefile.am
.................................
+ autoreconf --install --force --verbose -I m4
./bootstrap: 78: ./bootstrap: autoreconf: not found


最开始的提示说需要更新或者安装GNU gettext,那就安装了gettext

sudo apt-get install gettext;

看下面的提示说autoreconf没有找到,那就安装一下吧:

sudo apt-get install autoconf  automake  libtool

安装好之后,再试一次:

./bootstrap

root@hlchen-Lenovo-Product:/home/share/mahang/vlc# ./bootstrap
NOTE: GNU gettext appears to be missing or out-of-date.
Please install or update GNU gettext.
Also check if you have cvs, a dependency of autopoint.
Otherwise, you will not be able to build a source tarball.
==============================================================


generating modules/**/Makefile.am
.................................
+ autoreconf --install --force --verbose -I m4
autoreconf: Entering directory `.'
autoreconf: running: true --force
autoreconf: running: aclocal -I m4 --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --install --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `autotools'.
libtoolize: copying file `autotools/config.guess'
libtoolize: copying file `autotools/config.sub'
libtoolize: copying file `autotools/install-sh'
libtoolize: copying file `autotools/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --include=m4 --force
autoreconf: running: /usr/bin/autoheader --include=m4 --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:64: installing `autotools/compile'
configure.ac:27: installing `autotools/missing'
bin/Makefile.am: installing `autotools/depcomp'
autoreconf: Leaving directory `.'
+ rm -f po/Makevars.template
+ rm -f stamp-h*
+ set +x
Successfully bootstrapped


看最开始还是提示说需要安装或者升级gettext,不知道这是啥原因,不管了,反正“Successfully bootstrapped”



4、安装vlc的依赖包:

sudo  apt-get build-dep vlc

这也挺大,122M




5、编译

./configure

make

在make的时候出现错误:

/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavformat.a: could not read symbols: Bad value

在调用ffmpeg的库函数时出现错误,这是64位系统会出现的问题

已经提示解决方案了:recompile with -fPIC

重新编译ffmpeg

$CFLAGS="-fPIC" ./configure 

make

make install

ldconfig


然后重新编译VLC

$CFLAGS="-fPIC" ./configure 

make

make install

ldconfig



这样就对了

6、运行

./vlc

VLC media player 2.1.0-pre1 Rincewind (revision 2.1.0-git-15-gb2cce4d)
X11 connection rejected because of wrong authentication.
xcb_connection_has_error() 已返回 true
Failed to stat home directory /home/hangma: 没有那个文件或目录
X11 connection rejected because of wrong authentication.
[0x1eea958] pulse audio output error: PulseAudio server connection failure: 拒绝连接
X11 connection rejected because of wrong authentication.
xcb_connection_has_error() 已返回 true
Failed to stat home directory /home/hangma: 没有那个文件或目录
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
[0x1e15ca8] main interface error: no suitable interface module
[0x1e012a8] main libvlc error: interface "globalhotkeys,none" initialization failed
X11 connection rejected because of wrong authentication.
[0x1e15ca8] dbus interface error: Failed to connect to the D-Bus session daemon: Failed to connect to socket /tmp/dbus-V22Eo9EKfT: 拒绝连接
[0x1e15ca8] main interface error: no suitable interface module
[0x1e012a8] main libvlc error: interface "dbus,none" initialization failed
[0x1e012a8] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Xlib:  extension "XInputExtension" missing on display "localhost:10.0".
X11 connection rejected because of wrong authentication.
"sni-qt/5438" WARN  17:54:10.060 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE


结合网上编译vlc的例子,我又安装了一个包:

sudo  apt-get  install checkinstall  lua50


出现上述错误的原因是:我使用putty远程登录ubuntu,所以在我的windows终端无法显示,后来在ubuntu上运行./vlc,就会出现vlc的界面

$./vlc

ubuntu下编译VLC源码


7、安装

make install 



可以卸载

make  uninstall

make distclean