Linux(ubuntu, linuxmint)系统下编译VLC

系统linuxming 19.3,virtualbox machine.

1.基本步骤参考:

https://wiki.videolan.org/UnixCompile/

使用VLC3.0(尤其是播放SRT),请参考下面的方法:
https://www.cnblogs.com/FutaAlice/p/9041756.html

 

安装相关工具

$ sudo apt-get install git build-essential pkg-config libtool automake autopoint gettext
$ sudo apt-get install lua5.1 lua5.1-dev
$ sudo apt-get install libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-composite0-dev
$ sudo apt-get install flex bison gperf ant libxcb-xkb-dev libasound2-dev
$ sudo apt-get install ninja-build

 

安装GL库

sudo apt-get install mesa-common-dev
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev

2.download sourcecode.

$ git clone git://git.videolan.org/vlc.git
$ cd vlc
$ ./bootstrap

3. 编译第三库

有两种方法:

(1)使用编译好的库,适用于成熟版本,因为这些库一般比较老

$  sudo apt-get build-dep vlc

使用推荐的方法,但需要在 software source 中勾选 source code repositories (ubuntu 在software & updates中勾选 source code,并选择下载地址)

(2)手动编译,适用于新版本

$ apt-get install subversion yasm cvs cmake ragel
$ cd contrib
$ mkdir native
$ cd native
$ ../bootstrap
$ make

(3)编译FFmpeg,如果有特殊的需要,比如需要支持srt协议(首先要安装libsrt)

 

git clone https://git.ffmpeg.org/ffmpeg.git

cd ./ffmpeg

./configure --prefix=host --enable-shared

 make && make install

cd ./host/lib sudo

cp -r ./* /usr/local/lib

修改pkg_config路径:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

4.开始编译

$ ./configure --enable-run-as-root

如果提示qt版本低,需要下载错误提示的高版本的qt,下载地址:https://download.qt.io/archive/qt/,下载完成后安装,假设下载的 5.12.3版本,安装目录为默认目录。

 sudo chmod +x qt-opensource-linux-x64-5.12.3.run
 sudo ./qt-opensource-linux-x64-5.12.3.run
默认安装目录 /opt/Qt5.12.3

指定Qt目录,重新执行configure

$ ./configure --enable-run-as-root PKG_CONFIG_PATH=/opt/Qt5.12.3/5.12.3/gcc_64/lib/pkgconfig

成功后,开始make

$ make

$ sudo make install

5.编译过程中一些错误的解决方案

(1) meson 版本低(安装0.47.0为例)

$ sudo apt-get install python3-pip
$ pip3 install meson==0.47.0

(2)nasm 版本低

$ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
$ tar xjvf nasm-2.14.04.tar.bz2
$ cd nasm-2.14.01
$ ./autogen.sh
$ ./configure

$ make

$ sudo make install

(3)安装 protoc 及版本低的问题

sudo apt-get install autoconf automake libtool curl make g++ unzip

git clone https://github.com/google/protobuf.git

cd protobuf

git submodule update --init --recursive

./autogen.sh

./configure

make

make check

sudo make install

sudo ldconfig # refresh shared library cache

(4) 更新gcc到最新版本(以gcc7为例)

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update

$ sudo apt-get install -y gcc-7 g++-7

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值