libvlc-3.0.8 的交叉编译是去年做的,因为太忙,所以今天才把它记录下来。编译花了一周时间才完成,主要原因是第三方库获取方式不对,开始不知道,编译的时候一直报错,怎么都查不出原因。后来才知道对于vlc3.x版本,vlc-contrib-x86_64-w64-mingw32-latest.tar.bz2 不能使用手动下载的,要make fetch,需要VPN,如果没有VPN,不要紧,这里有https://blog.youkuaiyun.com/qq_18286031/article/details/85993485 提供的make fetch 下来的x86_64-w64-mingw32 包,可以直接使用。使用时注意,不需要编译了。我会把编译好的libvlc-3.0.8库上传到资源。编译好的库已加上录像接口,并且解决了播放RTSP流时,如果断流会内存暴涨导致软件崩溃的问题。
好,我们开始吧!
- 所需环境
ubuntu18.04系统 可以使用虚拟机 确保联网
- vlc-3.0.8源码获取
https://codeload.github.com/videolan/vlc-3.0/zip/3.0.8
- 在/home 目录下新建文件夹 harray,将vlc源码解压到harray目录下,改名为vlc-3.0
/home/harray/vlc-3.0
- 更新编译环境
sudo apt-get update
sudo apt-get upgrade
- 安装必要的软件
sudo apt-get install lua5.2 libtool automake autoconf autopoint make gettext pkg-config
sudo apt-get install qt4-dev-tools qt5-default git subversion cmake cvs
sudo apt-get install wine64-development-tools zip p7zip nsis bzip2
sudo apt-get install yasm ragel ant default-jdk protobuf-compiler dos2unix
sudo apt-get install gperf flex bison
- 配置contrib (有VPN的可以fetch)
将x86_64-w64-mingw32 包解压到/home/harray/vlc-3.0/contrib/下
- 退到主目录
cd home/harray/vlc-3.0
mkdir x86_64 && cd x86_64
../bootstrap
- 配置环境变量
gedit /etc/profile
将 /home/harray/vlc-3.0/contrib/x86_64-w64-mingw32/lib/pkgconfig 配置进去
export PATH=$PATH:/home/harray/vlc-3.0/contrib/x86_64-w64-mingw32/lib/pkgconfig
- 编译
make
- 打包
make package-win-common
wine ./vlc-3.0.8/vlc.exe
make package-win32-7zip
遇到的一些问题和解决方法
- You need 32-bits luac when using lua from contrib:
apt-get install lua5.2:i386
- 打包时遇到 cannot stat ‘…/share/hrtfs’: No such file or directory
cd vlc-3.0.8/share
touch hrtfs
手动建了这个vlc-3.0.8/share/hrtfs(空文件),打包成功
- 运行时找不到 libssp-0.dll
将 libssp-0.dll 加入到最后打包的根目录中
- 安装 protoc 过程中./autogen.sh 报错
运行./autogen.sh 时,由于“你懂的”的原因,autogen无法curl下载到gmock的源代码包,所以把gmock的包放到protoc目录下,让直接使用gmock。具体做法是:
1、解压gmock,这里我会提供gmock-1.7.0.zip,也可以网上下载。
2、把gmock解压出来的目录拷贝到protobuf目录下,改名为gmock
mv gmock-1.7.0 gmock
3、vim aotogen.sh将如下代码注释
if test ! -e gmock; then
echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
curl -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
unzip -q gmock-1.7.0.zip
rm gmock-1.7.0.zip
mv gmock-1.7.0 gmock
fi
4、保存,然后开始编译 protoc 3.1.0。
- 编译好的vlc库
https://download.csdn.net/download/z373248439/14144141
编译参考:
https://blog.youkuaiyun.com/yibu_refresh/article/details/84633439
https://blog.youkuaiyun.com/qq_18286031/article/details/85993485