很多同学都在尝试编译 android 版本的 vlc时候发现很多编译问题,一般都编译好几次都没有编译通过。我在这里将我在比较常用的两个发行平台上编译过程中出现的问题说明记录一下:

先阅读一下官方给定的教程: https://wiki.videolan.org/AndroidCompile/ ,按照教程中的内容配置环境变量NDK包。注意到目前我写此文章的时间官方支持的 ndk 的版本是 NDKr4b 所以下载ndk的使用请使用该版本进行下载。

由于官方文档推荐的是 ubuntu 系统进行讲解说明的。但是对于我这种比较喜欢 fedora 和 opensuse rpm 安装包的同学来说确实存在问题了,所以我这边将在 fedora 和 opensuse 系统上安装的过程记录下来。

一. fedora 平台

      请使用最新的fedora 发行版本,目前我的fedora 系统是 fedora 27,默认你的系统不是刚刚安装,如果是刚刚按抓给你的请执行

dnf update -y 将系统更新一下,然后安装如下的内容:

dnf install -y automake autoconf
 
 
dnf install -y ant
 
 
dnf install -y gettext-devel 
 
 
dnf install -y cmake
 
 
#like debian os install build-essential
 
 
dnf groupinstall -y  
  "Development Tools"
 
 
dnf install -y libtool 
 
 
dnf install -y flex
 
 
dnf install -y patch 
 
 
dnf install -y pkg-config
 
 
dnf install -y protobuf-compiler 
 
 
dnf install -y ragel
 
 
dnf install -y subversion
 
 
dnf install -y unzip
 
 
dnf install -y git gitk

然后执行 ./compile.sh -l release或者 ./compile.sh 文章中推荐的命令。这样就会一直安装完成。

二. opensuse 平台

       我使用的是 opensuse-Tumbleweed 而不是比较稳定的 Leap 版本。 主要是有些软件例如: gettext 是有版要求的,而Leap 是使用比较老的版本。默认是需要跟行系统到比较新的版本,如果不是请先执行 zypper update -y,重启然后执行如下的命令按抓相关的软件:

zypper install -y automake autoconf
 
 
zypper install -y ant
 
 
zypper install -y gettext-devel 
 
 
zypper install -y cmake
 
 
#like debian os: apt-get install build-essential
 
 
#like fedora os: dnf groupinstall -y "Development Tools"
 
 
zypper install -y --type pattern devel_basis
 
 
zypper install -y libtool 
 
 
zypper install -y flex
 
 
zypper install -y patch 
 
 
zypper install -y pkg-config
 
 
# dnf install -y protobuf-compiler
 
 
# apt-get install -y protobuf-compiler
 
 
# replace by follow in opensuse
 
 
zypper install -y libprotobuf-c-devel libprotobuf-c1 libprotobuf-lite15 protobuf-c protobuf-devel
 
 
zypper install -y ragel
 
 
zypper install -y subversion
 
 
zypper install -y unzip
 
 
zypper install -y git gitk

在编译到一定的程度发现会报如下的错误:

configure: error: Cannot find native C99 compiler: please define BUILDCC.

该错误是没有发现你的 gcc 编译器,在 https://www.linuxquestions.org/questions/slackware-14/vlc-complains-that-my-compiler-is-not-native-c99-4175548893/ 上面有对应的解决方案。文章太长我将我的解决方案直接告诉大家吧:

进入 vlc 的目录下修改 configure 文件的如下内容:

test -n "$DESKTOP_FILE_VALIDATE" || DESKTOP_FILE_VALIDATE=":"
 
 
BUILDCC=/usr/bin/gcc
 
 
for ac_prog in c11-gcc c11 c99-gcc c99
 
 
do
 
 
# Extract the first word of "$ac_prog", so it can be a program name with args.
 
 
set dummy $ac_prog; ac_word=$2
 
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 
 
$as_echo_n "checking for $ac_word... " >&6; }
 
 
if ${ac_cv_prog_BUILDCC+:} false; then :
 
 
$as_echo_n "(cached) " >&6
 
 
else
 
 
if test -n "$BUILDCC"; then
 
 
ac_cv_prog_BUILDCC="$BUILDCC" # Let the user override the test.
 
 
else
 
 
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 
 
for as_dir in $PATH
 
 
do
 
 
IFS=$as_save_IFS
 
 
test -z "$as_dir" && as_dir=.
 
 
for ac_exec_ext in '' $ac_executable_extensions; do
 
 
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
 
 
ac_cv_prog_BUILDCC="$ac_prog"
 
 
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
 
 
break 2
 
 
fi
 
 
done
 
 
done
 
 
IFS=$as_save_IFS

其中开始的 BUILDCC=/usr/bin/gcc 是我添加的,主要是该内容是在执行时是空,所以直接添加对应的内容。

三. 其他的一些问题

    在执行 ./compile.sh 过程中发现有些下载不了的,这个需要设置代理(所谓的翻墙)去操作