使用UBUNTU16.04.1 64位編譯vlc-3.0.7.1的WIN32版本

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:[email protected]: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

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章