1、编译环境(ubuntu1~18.04.1)
2、更新和升级系统
1 2 | # apt-get install update # apt-get install upgrade |
3、安装编译工具
1 | apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools |
4、安装开放工具包
1 2 3 4 | # 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 |
5、获取VLC源码
1 | $ git clone http://git.videolan.org/git/vlc.git |
6、编译第三方软件包
有两种方式:一种是下载第三方软件包的源码,进行编译,需要较长的编译时间;另一种是直接下载已经编译好的,这是方式速度快;
6.1 下载&编译第三方软件包
1 2 3 4 5 6 | # apt-get install subversion yasm cvs cmake ragel autopoint $ mkdir -p contrib/win32 $ cd contrib/win32 $ ../bootstrap --host=i686-w64-mingw32 $ make fetch // 时间有点长 $ make // 编译时间也有点长 |
6.1.1 编译和下载第三方软件包出现的问题及解决办法
6.1.1.1下载过程中会出现“The remote end hung up unexpectedly”
1 2 | error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly |
解决办法:
1 2 3 4 | git config http.postBuffer 524288000 git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999 git config –list |
6.1.1.2 ‘meson’: No such file or directory
1 2 3 | env: ‘meson’: No such file or directory ../src/fribidi/rules.mak:22: recipe for target '.fribidi' failed make: *** [.fribidi] Error 127 |
解决办法
1 2 | # apt-get install meson # pip3 install meson |
这样安装的版本太低,后面编译还会提示报错
6.1.1.3 /usr/bin/env: ‘python’: No such file or directory
解决办法
1 | # apt-get install python |
6.1.1.4 meson.build:25:0: ERROR: Meson version is 0.45.1 but project requires >= 0.47.0.
解决办法
1 2 | wget http://mirrors.edge.kernel.org/ubuntu/pool/universe/m/meson/meson_0.51.2-1_all.deb dpkg -i meson_0.51.2-1_all.deb |
6.1.1.5 Program nasm found: NO meson.build:372:4: ERROR: Program(s) [‘nasm’] not found or not executable
解决办法
1 2 3 4 5 6 | wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz tar xvf nasm-2.14.02.tar.gz cd nasm-2.14.02/ ./configure make -j32 make install |
6.1.1.6…/src/protobuf/rules.mak:43: *** protoc system version 3.0.0 and required version 3.1.0 do not match. Stop.
解决办法
1 2 3 4 5 6 7 | wget ..../protobuf-3.1.0-cpp.tar.gz tar -xvf protobuf-3.1.0-cpp.tar.gz cd protobuf-3.1.0/ ./configure make -j32 make make install |
6.1.1.7 can not open libprotoc.so.11
解决办法
1 | export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH |
6.1.1.8 make[7]: flex: Command not found
解决办法
1 | apt-get install flex |
6.1.1.9 make[7]: bison: Command not found
解决办法
1 | apt-get install bison |
6.1.1.10 wine: ‘/home/gmt’ is not owned by you, refusing to create a configuration directory there
解决办法
1 2 | mkdir /home/gmt/.wine chown -R root:root /homegmt/.wine |
6.2 直接下载编译好的第三方软件包
1 2 3 4 | $ mkdir -p contrib/win32 $ cd contrib/win32 $ ../bootstrap --host=i686-w64-mingw32 $ make prebuilt |
6.3 编译VLC
6.3.1 删除没用的文件夹
1 | root@gmt:~/work/vlc/contrib/win32# rm -rf ../i686-w64-mingw32/bin/moc ../i686-w64-mingw32/bin/uic ../i686-w64-mingw32/bin/rcc |
6.3.2 回到VLC 目录,进行bootstrap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | root@gmt:~/work/vlc# ./bootstrap autoreconf: Entering directory `.' autoreconf: running: autopoint --force Copying file ABOUT-NLS Copying file po/Makevars.template Copying file po/Rules-quot Copying file po/boldquot.sed Copying file po/[email protected] Copying file po/[email protected] Copying file po/insert-header.sin Copying file po/quot.sed Copying file po/remove-potcdate.sin autoreconf: running: aclocal -I m4 --force -I m4 autoreconf: configure.ac: tracing autoreconf: running: libtoolize --copy --force libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'autotools'. libtoolize: copying file 'autotools/ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. libtoolize: copying file 'm4/libtool.m4' libtoolize: copying file 'm4/ltoptions.m4' libtoolize: copying file 'm4/ltsugar.m4' libtoolize: copying file 'm4/ltversion.m4' libtoolize: copying file 'm4/lt~obsolete.m4' autoreconf: running: /usr/bin/autoconf --include=m4 --force autoreconf: running: /usr/bin/autoheader --include=m4 --force autoreconf: running: automake --add-missing --copy --force-missing configure.ac:36: installing 'autotools/compile' configure.ac:23: installing 'autotools/config.guess' configure.ac:23: installing 'autotools/config.sub' configure.ac:27: installing 'autotools/install-sh' configure.ac:27: installing 'autotools/missing' parallel-tests: installing 'autotools/test-driver' bin/Makefile.am: installing 'autotools/depcomp' configure.ac: installing 'autotools/ylwrap' autoreconf: Leaving directory `.' Successfully bootstrapped |
6.3.3 configure
1 2 3 4 | root@gmt:~/work/vlc# mkdir win32 && cd win32 root@gmt:~/work/vlc/win32# export PKG_CONFIG_LIBDIR=/home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/pkgconfig root@gmt:~/work/vlc/win32# export PKG_CONFIG_PATH_CUSTOM=$PKG_CONFIG_LIBDIR root@gmt:~/work/vlc/win32# ../extras/package/win32/configure.sh --host=i686-w64-mingw32 --build=x86_64-pc-linux-gnu |
6.3.4 build
1 | root@gmt:~/work/vlc/win32# make |
6.3.1.1 错误及解决办法
编译 microdns 错误
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | make[4]: Entering directory '/home/gmt/work/vlc/win32/modules' CCLD libmicrodns_plugin.la /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(mdns.c.obj): In function `mdns_init': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:407: undefined reference to `os_mcast_join' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(mdns.c.obj): In function `mdns_listen_probe_network': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:648: undefined reference to `poll' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(mdns.c.obj): In function `mdns_listen': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:707: undefined reference to `os_deadline' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(mdns.c.obj): In function `mdns_serve': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:759: undefined reference to `os_deadline' /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:770: undefined reference to `poll' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(mdns.c.obj): In function `mdns_strerror': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/mdns.c:616: undefined reference to `os_strerror' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(rr.c.obj): In function `rr_read_A': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/rr.c:279: undefined reference to `inet_ntop' /home/gmt/work/vlc/contrib/i686-w64-mingw32/lib/libmicrodns.a(rr.c.obj): In function `rr_read_AAAA': /home/gmt/work/vlc/contrib/win32/microdns/build/../src/rr.c:246: undefined reference to `inet_ntop' collect2: error: ld returned 1 exit status Makefile:16335: recipe for target 'libmicrodns_plugin.la' failed make[4]: *** [libmicrodns_plugin.la] Error 1 make[4]: Leaving directory '/home/gmt/work/vlc/win32/modules' Makefile:30885: recipe for target 'all-recursive' failed make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory '/home/gmt/work/vlc/win32/modules' Makefile:11990: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/gmt/work/vlc/win32/modules' Makefile:1576: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/gmt/work/vlc/win32' Makefile:1461: recipe for target 'all' failed make: *** [all] Error 2 |
解决办法
1、搜索os_mcast_join 函数,有相关实现代码,参数类型也匹配正确;排除代码问题;
2、在文件mdns.c中插入错误代码,在此make, 竟然没有报错,也没有编译我修改的源文件;
3、在root@gmt:~/work/vlc/contrib/win32/microdns#目录下没有Makefile 和 configure 相关文件;
4、现在是microdns-0.1.12.tar.xz,下载另一个版本microdns-0.0.10.tar.gz试试,需要修改两个文件 rules.mak 和 SHA512SUMS;
修改文件 rules.mak
1 | root@gmt:~/work/vlc/contrib/src/microdns# vi rules.mak |
修改后内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # libmicrodns LIBMICRODNS_VERSION := 0.0.10 LIBMICRODNS_URL := https://github.com/videolabs/libmicrodns/releases/download/$(LIBMICRODNS_VERSION)/microdns-$(LIBMICRODNS_VERSION).tar.gz ifndef HAVE_MACOSX ifdef BUILD_NETWORK PKGS += microdns endif endif ifeq ($(call need_pkg,"microdns >= 0.0.1"),) PKGS_FOUND += microdns endif $(TARBALLS)/microdns-$(LIBMICRODNS_VERSION).tar.gz: $(call download_pkg,$(LIBMICRODNS_URL),microdns) .sum-microdns: $(TARBALLS)/microdns-$(LIBMICRODNS_VERSION).tar.gz microdns: microdns-$(LIBMICRODNS_VERSION).tar.gz .sum-microdns $(UNPACK) $(APPLY) $(SRC)/microdns/0001-build-fix-getifaddrs-detection.patch $(APPLY) $(SRC)/microdns/0002-fix-dummy-mdns_list_interfaces.patch $(MOVE) .microdns: microdns $(RECONF) cd $< && $(HOSTVARS) ./configure $(HOSTCONF) cd $< && $(MAKE) install touch $@ |
修改 SHA512SUMS
1 | root@gmt:~/work/vlc/contrib/src/microdns# vi SHA512SUMS |
修改后内容如下:
1 | 47faa9d6342d3ae2b138009765a5a684e2c2474e53de15dc1deb88f87dbe558e79ab392f71971ee162eac3cf995f26ed35a74d6abfaf074dc1a249d042843954 microdns-0.0.10.tar.gz |
修改后再次 make fetch(下载第三方源码包) ,make microdns模块
1 2 | root@gmt:~/work/vlc/contrib/win32# make fetch root@gmt:~/work/vlc/contrib/win32# make |
成功后回到VLC源码WIN32目录,再次编译VLC,编译通过;
1 | root@gmt:~/work/vlc/win32# make |
6.3.5 打包一(make package-win-common)
1 2 3 4 5 | root@gmt:~/work/vlc/win32# make package-win-common root@gmt:~/work/vlc/win32# ls bin compile config.log cvlc doltcompile extras lib m4 modules po rvlc src svlc vlc-4.0.0-dev _win32 compat config.h config.status doc doltlibtool include libtool Makefile package-win-install qvlc share stamp-h1 test vlc.exe |
打包成功会生成 vlc-4.0.0-dev _win32 文件夹,vlc.exe 及相关的库都在这个文件夹内。
6.3.5 打包二(make package-win32 打包同时还制作安装包)
另外还增加 npapi-vlc Web插件的编译
1 | root@gmt:~/work/vlc/win32# make package-win32 |
错误:
1 2 3 | /bin/bash: 7z: command not found Makefile:2529: recipe for target 'package-win32-7zip' failed make: *** [package-win32-7zip] Error 127 |
解决办法:
1 | root@gmt:~/work/vlc/win32# apt-get install p7zipfull |
再次root@gmt:~/work/vlc/win32# make package-win32
1 2 3 4 5 6 7 8 | root@gmt:~/work/vlc/win32# make package-win32 ... Files read from disk: 693 Archive size: 40255118 bytes (39 MiB) Everything is Ok makensis require to build NSIS installer not found or too old Makefile:2518: recipe for target 'package-win32-exe' failed make: *** [package-win32-exe] Error 1 |
错误 makensis require to build NSIS installer not found or too old
解决办法:
下载一个windows NSIS installer 工具来制作安装包
6.4 windows 制作安装包
1、下载制作工具并安装
下载链接https://nchc.dl.sourceforge.net/project/nsis/NSIS%203/3.05/nsis-3.05-setup.exe
2、复制文件
root@gmt:~/work/vlc/win32/vlc-4.0.0-dev# cp …/extras/package/win32/NSIS/vlc.win32.nsi ./
root@gmt:~/work/vlc/win32/vlc-4.0.0-dev# cp …/extras/package/win32/NSIS/spad.nsi ./
3、运行NSIS