VLC编译问题

在Ubuntu下编译VLC源代码生成的VLC无法播放Youtube视频(比如https://www.youtube.com/watch?v=mDp-ABzpRX8)

错误提示如下:

zlf@ubuntu:~/vlc-2.1.5$ ./vlc
VLC media player 2.1.5 Rincewind (revision 2.1.4-49-gdab6cb5)
[0x9872a98] main libvlc: 正在以默认界面运行 vlc,使用 'cvlc' 将 vlc 运行在无界面的状态下。
[0x9931448] main tls client error: TLS client plugin not available
[0xb5d034d8] main input error: open of `https://www.youtube.com/watch?v=mDp-ABzpRX8' failed

原因是缺少TLS客户端插件,因此需要将GnuTLS库编译进来。

这里下载GnuTLS库的最新版本3.3.12,configure时报错,显示缺少依赖库Libnettle,而且只能适配2.7.1,nettle3.0还不行。

zlf@ubuntu:~/gnutls-3.3.12$ ./configure --prefix=/usr
configure: error:
  ***
  *** Libnettle 2.7.1 was not found. Note that this version of gnutls doesn't support nettle 3.0.
又去下载NETTLE库,编译安装,再运行GnuTLS的configure,NETTLE倒是检查通过,但依然报错,还需要HOGWEED库和GMP。
zlf@ubuntu:~/gnutls-3.3.12$ ./configure --prefix=/usr
..................
checking for NETTLE... yes
checking for HOGWEED... no
configure: error:
  ***
  *** Libhogweed (nettle's companion library) was not found. Note that you must compile nettle with gmp support.
下载GMP库,编译安装:How to Install GMP in Ubuntu
下载HOGWEED库,编译安装。
然后,需要重新配置安装NETTLE,可以参考这篇文章(遇到了一模一样的问题)。
再再次重新配置编译GnuTLS,
configure正常通过,但make时又报错了,典型的undefined reference to的error问题。
 
 
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac96_set_key'
../lib/.libs/libgnutls.so: undefined reference to `nettle_salsa20_crypt'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac128_update'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac96_set_nonce'
../lib/.libs/libgnutls.so: undefined reference to `nettle_salsa20_set_key'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac128_set_nonce'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac128_set_key'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac96_digest'
../lib/.libs/libgnutls.so: undefined reference to `nettle_salsa20_set_iv'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac128_digest'
../lib/.libs/libgnutls.so: undefined reference to `nettle_salsa20r12_crypt'
../lib/.libs/libgnutls.so: undefined reference to `nettle_umac96_update'
collect2: ld returned 1 exit status
make[4]: *** [psktool] Error 1
make[4]: Leaving directory `/home/zlf/gnutls-3.3.12/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/zlf/gnutls-3.3.12/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/zlf/gnutls-3.3.12/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zlf/gnutls-3.3.12'
make: *** [all] 错误 2

尝试了一些方法没搞定,只好求助Linuxfromscratch网站了,跟着上面的安装指导操作。

configure时需要指定根证书,但本机上没有/etc/ssl/ca-bundle.crt,因此需要去http://certifie.com/ca-bundle/下载一个现成的或自己制作一个。

./configure --prefix=/usr --with-default-trust-store-file=/etc/ssl/ca-bundle.crt

configure成功后make又报错了。

/home/zlf/gnutls-3.3.12/build-aux/missing: line 81: makeinfo: command not found
WARNING: 'makeinfo' is missing on your system.
         You should only need it if you modified a '.texi' file, or
         any other file indirectly affecting the aspect of the manual.
         You might want to install the Texinfo package:
         <http://www.gnu.org/software/texinfo/>
         The spurious makeinfo call might also be the consequence of
         using a buggy 'make' (AIX, DU, IRIX), in which case you might
         want to install GNU make:
         <http://www.gnu.org/software/make/>
make[4]: *** [gnutls.info] Error 127
make[4]: Leaving directory `/home/zlf/gnutls-3.3.12/doc'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/zlf/gnutls-3.3.12/doc'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/zlf/gnutls-3.3.12/doc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zlf/gnutls-3.3.12'
make: *** [all] 错误 2

原因是没有makeinfo命令,安装texinfo。

zlf@ubuntu:~$ makeinfo
程序“makeinfo”尚未安装。  您可以使用以下命令安装:
sudo apt-get install texinfo
zlf@ubuntu:~$ sudo apt-get install texinfo

终于make GnuTLS成功了。

make check也PASS了。

最后是sudo make install,OK!

终于安装好了GnuTLS库,可以继续编译VLC了,VLC的configure中默认是使能GnuTLS的,因此configure后直接make。

这次用的是专业安装指导

但安装后的VLC并没有GnuTLS的插件(VLC-工具-插件及扩展-插件)!还是没有将其编译进去?

检查GnuTLS的configure,发现configure找到的GnuTLS版本是2.12.14,并非自己安装的最新的3.3.12。

zlf@ubuntu:~/gnutls-3.3.12$./configure --enable-gnutls
......
checking for GNUTLS... no
configure: error: Requested 'gnutls >= 3.0.20' but version of GnuTLS is 2.12.14
You may find new versions of GnuTLS at http://www.gnu.org/software/gnutls/.)

确认了一下自己下载的GnuTLS的版本,确实是3.3.12。

zlf@ubuntu:~/gnutls-3.3.12$ ./configure --version
GnuTLS configure 3.3.12
generated by GNU Autoconf 2.69

zlf@ubuntu:~$ pkg-config --modversion gnutls
3.3.12

又确认了一下安装到/usr/lib下的GnuTLS的版本,也是3.3.12。

zlf@ubuntu:/usr/lib/pkgconfig$ vim gnutls.pc
显示gnutls的Version: 3.3.12

最后在Ubuntu软件中心里发现了旧版的GnuTLS 2.12.14,将其卸载。

继续configure,继续报错,这次是缺少新版本的libgcrypt。

checking whether GCRYCTL_SET_THREAD_CBS is declared... no
configure: error: libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.

GNUPG官网下载libgcrypt的TAR包,解压配置编译安装。

继续configure,继续报错,这次是缺少新版本的libgpg-error。同上搞定。

configure终于通过!

开始make,报错。

make[4]: 正在进入目录 `/home/zlf/vlc-2.1.5/modules/misc'
  CC     libxml_plugin_la-libxml.lo
  CCLD   libxml_plugin.la
  CC     libexport_plugin_la-html.lo
  CC     libexport_plugin_la-m3u.lo
  CC     libexport_plugin_la-xspf.lo
  CC     libexport_plugin_la-export.lo
  CCLD   libexport_plugin.la
  CC     libgnutls_plugin_la-gnutls.lo
gnutls.c:39:27: 致命错误: gnutls/gnutls.h:没有那个文件或目录
编译中断。
make[4]: *** [libgnutls_plugin_la-gnutls.lo] 错误 1
make[4]:正在离开目录 `/home/zlf/vlc-2.1.5/modules/misc'
make[3]: *** [all] 错误 2
make[3]:正在离开目录 `/home/zlf/vlc-2.1.5/modules/misc'
make[2]: *** [all-recursive] 错误 1
make[2]:正在离开目录 `/home/zlf/vlc-2.1.5/modules'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/zlf/vlc-2.1.5'
make: *** [all] 错误 2

打开gnutls.c看了下,发现需要gnutls/gnutls.h和gnutls/x509.h两个头文件,将它们拷贝至/usr/include下。

zlf@ubuntu:~/gnutls-3.3.12/lib/includes/gnutls/$ sudo cp gnutls.h x509.h /usr/include/gnutls

继续make,继续报错,这次又缺少头文件combat.h,继续拷贝。

zlf@ubuntu:~/gnutls-3.3.12/lib/includes/gnutls/$ sudo cp compat.h /usr/include/gnutls

继续make,成功!

make check,PASS!

打开VLC,检查插件设置,终于有TLS了。

 

总结:

1、Ubuntu可以使用apt-get命令直接下载安装软件包,也可以下载压缩包然后解压配置编译安装,后者可以自由决定软件包版本;
2、每个软件下几乎都有README文档和INSTALL文档,遇到问题先去看下,没坏处;
3、每个软件或命令都有--help选项,遇到问题先去看下,没坏处;
4、折腾过程中根据错误提示,看帮助看代码,网上搜索,一步一步解决。

 

posted on 2015-02-04 13:22  教员的小学森  阅读(4857)  评论(0编辑  收藏  举报