ubuntu 19.04下交叉编译64位vlc 3.0.8
一、前言尝试了很多ubuntu版本和vlc版本。尝试了16.04编译3.0.8;尝试了18.04编译3.0.8、3.0.11、4.0,32位、64位;尝试了19.04、19.10、20.04;都会存在各种这样的报错,有的报错相同,有的报错不同;以至于消耗了很多时间精力,但也因此对vlc编译熟悉了很多。如果想编译一个可用的版本,按照规范操作,一路顺畅;如果想体验解决问题的成就感,请随意。二、环境准备
一、前言
尝试了很多ubuntu版本和vlc版本。
尝试了16.04编译3.0.8;尝试了18.04编译3.0.8、3.0.11、4.0,32位、64位;尝试了19.04、19.10、20.04;都会存在各种这样的报错,有的报错相同,有的报错不同;
以至于消耗了很多时间精力,但也因此对vlc编译熟悉了很多。
如果想编译一个可用的版本,按照规范操作,一路顺畅;如果想体验解决问题的成就感,请随意。
二、环境准备
ubuntu 19.04(虚拟机)
vlc 3.0.8
三、参考文献
https://wiki.videolan.org/Win32Compile/
稍微BB一下:
1. 官方文档提到,编译windows vlc,推荐使用ubuntu交叉编译;
2. 里面有32位和64位的区别,命令不一样,先想好要编译的位数,避免环境污染,出现乱七八糟的问题也浪费时间;
3. Mingw-w64 toolchain版本,18.04是不满足要求的,会出现莫名其妙的问题;
4. 命令中的HOST-TRIPLET,使用x86_64-w64-mingw32替代。
四、开始编译
4.1 更新ubuntu 19.04的源
官方已经停止支持了,而18.04因为Mingw-w64 toolchain版本不支持,最新的20.04编译也是存在其他未知报错,无疑,当前用19.04是最优选择。
首先更新一下软件源:ubuntu 19.04源
4.2 大概步骤
按照官网提供的顺序:
# apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-tools
# apt-get install lua5.2 libtool automake autoconf autopoint make gettext pkg-config
# apt-get install qt4-dev-tools qt5-default git subversion cmake cvs
# apt-get install wine64-development-tools libwine-dev zip p7zip nsis bzip2
# apt-get install yasm ragel ant default-jdk protobuf-compiler dos2unix
4.3 下载vlc 3.0.8源码
http://download.videolan.org/pub/videolan/vlc/3.0.8/vlc-3.0.8.tar.xz
解压,cd vlc
4.4 选择手动编译
# apt-get install subversion yasm cvs cmake ragel autopoint
想少绕弯,先执行设置LIBS吧,不要问为什么,不加你试试看~,注意红色命令。
#export LIBS=‘-lz -lpthread’
$ mkdir -p contrib/win32
$ cd contrib/win32
$ ../bootstrap --host=x86_64-w64-mingw32 --disable-protobuf
$ make fetch
$ make
等待很长时间。。。。。。
ps:make fetch其实就是下载一些必须的依赖库到tarball目录。过程中,可能会找不到x265-2.7.tar.bz2的库,可以自行下载,放入到tarball目录即可。
https://download.csdn.net/download/zhuxian2009/14061954
中间可能会报错,后面把报错内容单独拎出来写,先把主要流程记录一下;
$ cd -
$ ./bootstrap
$ mkdir win32 && cd win32
$ export PKG_CONFIG_LIBDIR=$HOME/vlc/contrib/x86_64-w64-mingw32/lib/pkgconfig
$ ../extras/package/win32/configure.sh --host=x86_64-w64-mingw32 --build=x86_64-pc-linux-gnu
$ make
又是一个漫长的编译时间,完成以后,vlc.exe就生成了。
make package-win-common
会生成到vlc-3.0.8目录下。
4.5 报错解决
————————————————————————————————————————————————————————————————
env: ‘meson’: No such file or directory
解决:
sudo apt install python3-pip
sudo pip3 install meson
————————————————————————————————————————————————————————————————
ERROR: Could not detect Ninja v1.7 or newer
解决:
sudo pip3 install ninja
————————————————————————————————————————————————————————————————
/usr/bin/env: ‘python’: No such file or directory
解决:
sudo apt-get install python
————————————————————————————————————————————————————————————————
/home/ym/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src/hb-mutex.hh:121: undefined reference to `pthread_mutex_unlock'
/usr/bin/x86_64-w64-mingw32-ld: ./.libs/libharfbuzz.a(libharfbuzz_la-hb-ot-shape-complex-arabic.o): in function `hb_mutex_t::fini()':
/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src/hb-mutex.hh:122: undefined reference to `pthread_mutex_destroy'
/usr/bin/x86_64-w64-mingw32-ld: /home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src/hb-mutex.hh:122: undefined reference to `pthread_mutex_destroy'
/usr/bin/x86_64-w64-mingw32-ld: ./.libs/libharfbuzz.a(libharfbuzz_la-hb-ot-shape-complex-arabic.o): in function `hb_mutex_t::unlock()':
/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src/hb-mutex.hh:121: undefined reference to `pthread_mutex_unlock'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:1807: main.exe] Error 1
make[4]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src'
make[3]: *** [Makefile:2994: install-recursive] Error 1
make[3]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src'
make[2]: *** [Makefile:3413: install] Error 2
make[2]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz/src'
make[1]: *** [Makefile:517: install-recursive] Error 1
make[1]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.11/contrib/win32/harfbuzz'
make: *** [../../contrib/src/harfbuzz/rules.mak:32: .harfbuzz] Error 2
解决:
export LIBS=‘-lz -lpthread’
————————————————————————————————————————————————————————————————
meson.build:331:4: ERROR: Program 'nasm' not found
sudo apt install nasm
————————————————————————————————————————————————————————————————
x86_64-w64-mingw32-windres: versioninfo.rc.in:21: syntax error
make[2]: *** [Makefile:1284: versioninfo.lo] Error 1
make[2]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/contrib/win32/gcrypt/src'
make[1]: *** [Makefile:487: install-recursive] Error 1
make[1]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/contrib/win32/gcrypt'
make: *** [../../contrib/src/gcrypt/rules.mak:76: .gcrypt] Error 2
解决:
gedit gcrypt/configure.ac
m4_define([mym4_revision],
- m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
+ m4_esyscmd([printf %x $(wc -l < debian/changelog)]))
————————————————————————————————————————————————————————————————
FFTW3 lib not found. Set FFTW3_DIR to find it.
-- Could NOT find KissFFT (missing: KISSFFT_SOURCE_DIR)
-- Checking for modules 'libavcodec;libavutil'
-- No package 'libavcodec' found
-- No package 'libavutil' found
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
CMakeLists.txt:146 (pkg_check_modules)
解决:
sudo apt-get install fftw3
export FFTW3_DIR="/usr/lib/x86_64-linux-gnu/"
————————————————————————————————————————————————————————————————
stream_out/chromecast/cast_channel.pb.h:25:10: fatal error: google/protobuf/generated_message_table_driven.h: No such file or directory
#include <google/protobuf/generated_message_table_driven.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [Makefile:26548: stream_out/chromecast/libstream_out_chromecast_plugin_la-cast.lo] Error 1
make[4]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/win32/modules'
make[3]: *** [Makefile:27485: all-recursive] Error 1
make[3]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/win32/modules'
make[2]: *** [Makefile:12539: all] Error 2
make[2]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/win32/modules'
make[1]: *** [Makefile:1553: all-recursive] Error 1
make[1]: Leaving directory '/home/zhuxian/workspace/vlc-3.0.8/win32'
make: *** [Makefile:1438: all] Error 2
解决
cd contrib/win32
../bootstrap --host=x86_64-w64-mingw32 --disable-protobuf
更多推荐
所有评论(0)