系統linuxming 19.3,virtualbox machine.
1.基本步驟參考:https://wiki.videolan.org/UnixCompile/
$ git clone git://git.videolan.org/vlc.git
$ cd vlc
$ ./bootstrap
2.安裝工具
$ sudo apt-get install git build-essential pkg-config libtool automake autopoint gettext
$ sudo apt-get install lua5.1
$ sudo apt-get install libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0dev libxcb-composite0-dev
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
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 $ pip 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