vlc-3.0.7.1编译WIN32应该程序:
一、环境设置:
ubuntu16 begin 开始安装:Windows 10, 64-bit (Build 17134) 10.0.17134
VMware-workstation-full-14.1.3-9474260 VMware® Workstation 14 Pro 14.1.3 build-9474260
ubuntu-16.04.1-desktop-amd64
https://mirrors.ustc.edu.cn 设置镜像。等待更新完成。
二、工具安装与TARBALLS下载:
先安装基本的工具:
sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools
sudo apt-get install lua5.2 libtool automake autoconf autopoint make gettext pkg-config qt4-dev-tools qt5-default git subversion cmake cvs
wine64-development-tools libwine-dev zip p7zip nsis bzip2 zip p7zip nsis bzip2 yasm ragel ant dos2unix gperf flex bison
从其它地方下载VLC源码,解压到一个目录后进入:
cd vlc-3.0.7.1
mkdir -p win32 生成两个WIN32目录,一个在根目录下,下在CONTRIB下。
mkdir -p contrib/win32
cd contrib/win32 进入CONTRIB下的WIN32目录
../bootstrap --host=i686-w64-mingw32
make fetch
1,下载AOM需要翻墙:
Connecting to aomedia.googlesource.com (aomedia.googlesource.com)|74.125.142.82|:443... failed: Connection refused.
Connecting to aomedia.googlesource.com (aomedia.googlesource.com)|2607:f8b0:400e:c08::52|:443... failed: Network is unreachable.
../../contrib/src/aom/rules.mak:12: recipe for target '../../contrib/tarballs/aom-v1.0.0.errata.1.tar.gz' failed
make: *** [../../contrib/tarballs/aom-v1.0.0.errata.1.tar.gz] Error 4
https://blog.csdn.net/sxwyf248/article/details/7240290 ubuntu下使用终端设置网络代理
为AOM下载使用临时代理设置。 need fairwall
export https_proxy=http://d:d@192.168.124.113:9666 for aom download templ
代理一般比较慢,可在下载完成这个AOM后,换个终端代理就自动失效了,继续下载会快些。
三、MAKE遇到的问题与解决:
make
1,D3D
touch .lame
touch -r .lame .dep-lame
mkdir -p d3d11
cp ../../contrib/tarballs/d3d11.idl d3d11 && cd d3d11 && patch -fp1 < ../../../contrib/src/d3d11/processor_format.patch
patching file d3d11.idl
mkdir -p -- "/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include/"
i686-w64-mingw32-widl -DBOOL=WINBOOL -I/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include -I/usr/include/wine/windows/ -I/usr/include/wine/wine/windows/ -h -o /home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include/d3d11.h d3d11/d3d11.idl
d3d11/d3d11.idl:20: error: Unable to open include file oaidl.idl
../../contrib/src/d3d11/rules.mak:63: recipe for target '/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include/d3d11.h' failed
make: *** [/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include/d3d11.h] Error 1
contrib/src/中将d3d9 d3d11中的rules.mak第四行
IDL_INCLUDES = -I/usr/include/wine/windows/ -I/usr/include/wine/wine/windows/
改成:
IDL_INCLUDES = -I/usr/include/wine-development/windows/ -I/usr/include/wine/wine/windows/
2,JAVA
compile:
[javac] /home/d/Desktop/vlc-3.0.6/contrib/win32/bluray/src/libbluray/bdj/build.xml:24: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 33 source files to /home/d/Desktop/vlc-3.0.6/contrib/win32/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
/home/d/Desktop/vlc-3.0.6/contrib/win32/bluray/src/libbluray/bdj/build.xml:24: Compile failed; see the compiler error output for details.
Total time: 0 seconds
Makefile:2606: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 1
make[1]: Leaving directory '/home/d/Desktop/vlc-3.0.6/contrib/win32/bluray'
../../contrib/src/bluray/rules.mak:59: recipe for target '.bluray' failed
make: *** [.bluray] Error 2
看下JAVA版本
java --version
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode)
而VLC编译需要使用JDK1.8以上版本。
下载可用版本 note:change a install dir for jdk
wget http://111.1.50.20/files/4041000006F611C7/download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz
解压tar.gz 文件到自己指定的目录。我这儿是:/home/d/Downloads/
#tar -xzvf jdk-8u181-linux-x64.tar.gz
配置jdk环境变量
# sudo gedit /etc/profile
在文件最下面配上jdk的环境变量
export JAVA_HOME=/home/d/Downloads/jdk1.8.0_181 #此处为jdk解压的路径 use pwd look
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
保存退出
# sudo gedit /etc/environment
在最后添加一行:
JAVA_HOME=/home/d/Downloads/jdk1.8.0_181
保存退出
使jdk环境变量生效
# source /etc/profile
检查jdk是否生效
# java -version
# javac -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
继续安装,如果是在其它终端做的上述操作,在编译终端也须执行下:
# source /etc/profile
然后再看版本。
3,DAV1D
cd dav1d && rm -rf ./build
cd dav1d && CPPFLAGS=" -I/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include" CFLAGS=" -I/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include -g -O2" CXXFLAGS=" -I/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include -g -O2" LDFLAGS=" -L/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/lib " meson --default-library static --prefix "/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32" --backend ninja -Dlibdir=lib --buildtype release --cross-file /home/d/vlc-3.0.7.1/contrib/win32/crossfile.meson -D build_tests=false -D build_tools=false -D win32_ver=false build
/bin/sh: 1: meson: not found
../../contrib/src/dav1d/rules.mak:30: recipe for target '.dav1d' failed
make: *** [.dav1d] Error 127
这儿MESON版本需要0.47.0以上版本,不能使用 sudo apt-get install meson (只能安装0.45.0)安装。
而且需要先安装NASM,此版本也不能使用系统自带的(版本也比较旧了),需要自行下载新版本,按常规方法编译安装即可(./confgiure,make,make install),我这儿用的是nasm-2.14.02.tar.gz
https://blog.csdn.net/syx3239/article/details/83038132 meson安装
meson安装前必须确认是否已经安装python3.5以上的版本。
sudo apt-get install python3 python3-pip ninja-build
安装meson
pip3 install --user meson
You are using pip version 8.1.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
直接输入python - pip install --upgrade pip就可以了
DEPRECATION: Option uses prefix "build_", which is reserved for Meson. This will become an error in the future.
DEPRECATION: Option uses prefix "build_", which is reserved for Meson. This will become an error in the future.
DEPRECATION: Option uses prefix "build_", which is reserved for Meson. This will become an error in the future.
参考:
https://blog.csdn.net/syx3239/article/details/83038132 meson安装
https://www.linuxidc.com/Linux/2013-01/78271.htm Ubuntu上安装nasm以及nasm在Ubuntu上的简单使用
4,GCRYPT
i686-w64-mingw32-windres: versioninfo.rc.in:21: syntax error
Makefile:1224: recipe for target 'versioninfo.lo' failed
make[2]: *** [versioninfo.lo] Error 1
make[2]: Leaving directory '/home/d/Desktop/vlc-3.0.6/contrib/win32/gcrypt/src'
Makefile:487: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/d/Desktop/vlc-3.0.6/contrib/win32/gcrypt'
../../contrib/src/gcrypt/rules.mak:74: recipe for target '.gcrypt' failed
make: *** [.gcrypt] Error 2
解决方案:
修改 contrib/win32/gcrypt/configure.ac 第42行
修改前:m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
修改后:m4_esyscmd([printf %x $(wc -l < debian/changelog)]))
5,编译需要proto-buf-3.1.0需要下载独立安装
安装方法:./autogen.sh, ./configure, make, make check, make install.
6,安装过程中出现过的虚拟机不能重启问题:有时重启虚拟机有以下提示,再也进不去了
the system is running in low-graphics mode
网上查得如下方法:
步骤1:
重启虚拟机,按ctrl + alt + F1 进入纯字符界面,输入账号和密码
步骤2:
1:cd /etc/X11
2:sudo cp xorg.conf.failsafe xorg.conf
3:sudo reboot
7,软件安装过程中可能某些软件弹出一引起类似的对话框
Package configuration
┌──────────────────────────────┤ Configuring ttf-mscorefonts-installer ├──────────────────────────────┐
│ │
按TAB键焦点OK回车或点击即可。不用TAB选中OK焦点时不要指望鼠标,非焦点时鼠标点击OK是无效的,并不能让焦点自动停在OK,所以看现象就象卡死不返回了,且记鼠标在此模式下无效。
8,MAKE完成后退出CONTRIB,进入根目录的WIN32:
cd ../..
cd win32
../bootstrap
d@ubuntu:~/vlc-3.0.7.1/win32$ ../bootstrap
NOTE: autopoint (GNU gettext-tools) appears to be missing or out-of-date.
Please install or update GNU gettext tools.
Otherwise, you will not be able to build a source tarball.
此时需要安装 GETTEXT的0.19.8这个版本,从网上下载,编译安装即可。
9,配置:
export PKG_CONFIG_PATH=$HOME/vlc-3.0.7.1/contrib/i686-w64-wingw32/lib/pkgconfig
export PKG_COFIG_LIBDIR=$HOME/vlc-3.0.7.1/contrib/i686-w64-mingw32/lib/pkgconfig
export PKG_CONFIG_PATH_CUSTOM=$PKG_CONFIG_LIBDIR
../configure --host=i686-w64-mingw32
make
10,缺的几个文件(wrl文件夹,roapi.h dwrite.h dwrite_1.h dwrite_2.h versionhelpers.h等)出处见下 放在:contrib/i686-w64-mingw/include
参考我的:https://blog.csdn.net/DANFBAORE/article/details/82892467
https://forum.videolan.org/viewtopic.php?f=32&t=137580&p=453684&hilit=roapi.h%3A80%3A25#p453684
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/v5.x/tree/mingw-w64-headers/include/wrl/wrappers/
报错类似如下 :
/usr/share/mingw-w64/include/roapi.h:80:25: error: ‘RoUninitialize’ was not declared in this scope
{ RoUninitialize (); }
--
../../modules/text_renderer/freetype/fonts/dwrite.cpp:32:22: fatal error: dwrite_2.h: No such file or directory
compilation terminated.
--
Makefile:1437: recipe for target 'all' failed
make: *** [all] Error 2
11,DXGI_SWAP_EFFECT_FLIP_DISCARD报错:
../../modules/video_output/win32/direct3d11.c:514:27: error: ‘DXGI_SWAP_EFFECT_FLIP_DISCARD’ undeclared (first use in this function)
out->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
这儿需要加入文件:
dxgi.h
12,缺的定义‘_WIN32_WINNT_WINBLUE’:
/home/d/vlc-3.0.7.1/contrib/i686-w64-mingw32/include/versionhelpers.h:70:45: error: ‘_WIN32_WINNT_WINBLUE’ undeclared (first use in this function)
网上查得:
#define _WIN32_WINNT_WINBLUE 0x0603 // Windows 8.1
直接在接口前加上这句。
13,打包与压缩失败问题:
make package-win-common
cp: cannot stat '../share/hrtfs': No such file or directory
Makefile:2410: recipe for target 'package-win-common' failed
自己建一个空的也行,从安装包里取一个也行放在share目录下。
sudo make package-win32-7zip
Making install in activex
make[3]: Entering directory '/home/d/vlc-3.0.7.1/win32/npapi-vlc/activex'
make[3]: *** No rule to make target '/usr/include/wine/windows/stdole2.idl', needed by 'stdole2.tlb'. Stop.
make[3]: Leaving directory '/home/d/vlc-3.0.7.1/win32/npapi-vlc/activex'
Makefile:481: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/home/d/vlc-3.0.7.1/win32/npapi-vlc'
Makefile:2388: recipe for target 'install-npapi' failed
make[1]: *** [install-npapi] Error 2
make[1]: Leaving directory '/home/d/vlc-3.0.7.1/win32'
Makefile:2342: recipe for target 'build-npapi' failed
make: *** [build-npapi] Error 2
sudo apt-get install wine-dev 继续。
/bin/bash: 7z: command not found
Makefile:2516: recipe for target 'package-win32-7zip' failed
make: *** [package-win32-7zip] Error 127
不知什么原因7ZIP不认了,换个打包压缩方式:
sudo make package-win32-zip
12,将包拷贝到WINDOWS,运行失败2
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Makefile:2345: recipe for target 'fetch-npapi' failed
make: *** [fetch-npapi] Error 128
找不到libssp-0.dll 运行失败 从旧版本上拷贝一个,注意32位与64位不能混淆。
到此,VLC完全运行正常。播放推流一切正常。
13,主要命令汇总:
1 sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools
2 sudo apt-get install lua5.2 libtool automake autoconf autopoint make gettext pkg-config qt4-dev-tools qt5-default git subversion cmake cvs wine64-development-tools zip p7zip nsis bzip2 yasm ragel ant curl dos2unix gperf flex bison
5 cd /Home/vlc-3.0.7.1
6 cd vlc-3.0.7.1/contrib/win32
7 ../bootstrap --host=i686-w64-mingw32
8 make fetch
10 source /etc/profile //这儿是为了JAVA JDK设置生效。
11 make
12 sudo apt-get install python3 python3-pip ninja-build //这儿及以下是安装MESON
13 pip3 install --user meson
14 sudo pip install --upgrade pip
15 pip3 install --user meson
16 make
17 cd ../..
18 cd win32
22 ../bootstrap
23 export PKG_CONFIG_PATH=$HOME/vlc-3.0.7.1/contrib/i686-w64-wingw32/lib/pkgconfig
24 export PKG_COFIG_LIBDIR=$HOME/vlc-3.0.7.1/contrib/i686-w64-mingw32/lib/pkgconfig
25 export PKG_CONFIG_PATH_CUSTOM=$PKG_CONFIG_LIBDIR
26 ../configure --host=i686-w64-mingw32
27 sudo make
33 sudo make package-win-common
39 sudo apt-get install wine-dev //这儿可能弹对话框要求确认。
51 sudo make package-win32-zip