编译vlc(一)
编译vlc源
官方文档:https://wiki.videolan.org/AndroidCompile/
我们按照官方文档首先需要下载相应的软件:
sudo apt-get install automake ant autopoint cmake build-essential libtool-bin patch pkg-config protobuf-compiler ragel subversion unzip git openjdk-8-jre openjdk-8-jdk flex python wget
请不要直接复制官网的软件下载,会出现无法下载的问题,因为\和空格无法删除
然后我们需要jdk1.8,首先我们可以先看下Java的版本:java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode)
有一些有自带的jdk,如上,这时候就需要重新下载1.8,为什么?
如果不下载1.8并且配置的话会报下面的这个错误
compile:
[javac] /root/myworkdir/vlc-android/vlc/contrib/contrib-android-aarch64-linux-android/bluray/src/libbluray/bdj/build.xml:26: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 33 source files to /root/myworkdir/vlc-android/vlc/contrib/contrib-android-aarch64-linux-android/bluray/src/libbluray/bdj/build
[javac] warning: [options] bootstrap class path not set in conjunction with -source 5
[javac] error: Source option 5 is no longer supported. Use 6 or later.
[javac] error: Target option 1.5 is no longer supported. Use 1.6 or later.
BUILD FAILED
/root/myworkdir/vlc-android/vlc/contrib/contrib-android-aarch64-linux-android/bluray/src/libbluray/bdj/build.xml:26: Compile failed; see the compiler error output for details.
Total time: 1 second
Makefile:2618: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 1
make[1]: Leaving directory '/root/myworkdir/vlc-android/vlc/contrib/contrib-android-aarch64-linux-android/bluray'
../../contrib/src/bluray/rules.mak:56: recipe for target '.bluray' failed
make: *** [.bluray] Error 2
这个错误就是需要一个1.8的jdk,这时候我们把Linux版本的jdk1.8下载好之后(这里不贴链接),需要配置Java环境
sudo vim /etc/profile
在最后一行加上
export JAVA_HOME=/root/myworkdir/jdk1.8.0_11//这里写上自己的jdk路径
export JAVA_BIN=$JAVA_HOME/bin
export JAVA_LIB=$JAVA_HOME/lib
export CLASSPATH=.:$JAVA_LIB/tools.jar:$JAVA_LIB/dt.jar
export PATH=$JAVA_BIN:$PATH
开始编译
./buildsystem/compile.sh -a arm64-v8(这个地方填写的是cpu版本)
如果你不知道cpu版本怎么写,可以
./buildsystem/compile.sh --help
进行查看
Use -a to set the ARCH:
ARM: (armeabi-v7a|arm)
ARM64: (arm64-v8a|arm64)
X86: x86, x86_64
Use --release to build in release mode
Use --signrelease to build in release mode and sign apk, see vlc-android/build.gradle
Use -s to set your keystore file and -p for the password
Use -c to get a ChromeOS build
Use -l to build only LibVLC
Use -b to bypass libvlc source checks (vlc custom sources)
现在就正式开始编译