請移步https://higoge.github.io/,全部下載資料在那個博客都能找到。謝謝。 php
--------------------------------------------------------------------html
若是按照上一篇博客《windows平臺下vlc編譯之一:編譯環境構建》安裝好了Cygwin,下載了源碼和第三方庫以後,咱們就能夠編譯vlc了。這篇博客先講如何編譯vlc-0.8.6i.
git
步驟一:解壓源碼和第三方庫。github
源文件:http://download.videolan.org/pub/videolan/vlc/0.8.6i/vlc-0.8.6i.tar.gzbootstrap
庫:http://download.videolan.org/pub/testing/win32/contrib-20070530-win32-bin-gcc-3.4.5-only.tar.bz2windows
將vlc-0.8.6i.tar.gz和contrib-20070530-win32-bin-gcc-3.4.5-only.tar.bz2拷貝到/home/username/下面(username爲登錄的用戶目錄),運行如下命令解壓:ide
tar xjvf contrib-20070530-win32-bin-gcc-3.4.5-only.tar.bz2 -C /
tar xzvf vlc-0.8.6i.tar.gzui
作一點點清理工做編碼
rm -rf /usr/win32/bin/moc
rm -rf /usr/win32/bin/rcc
rm -rf /usr/win32/bin/uicurl
步驟二:Bootstrap
cd vlc-0.8.6i
./bootstrap
可能出現的錯誤:
+ aclocal-1.9 -I m4
/usr/bin/m4:configure.ac:4643: cannot create temporary file for diversion: Permission denied
autom4te-2.61: /usr/bin/m4 failed with exit status: 1
aclocal-1.9: autom4te failed with exit status: 1
分析:殺毒軟件有關係,好比Jeremiah用的Mcafee就會出這樣的錯誤。
解決方法:關閉殺毒軟件從新運行./bootstrap。
步驟三:編輯vlc腳本
在vic-0.8.6i下新建文本文件"configure-vlc01.sh"(見附件),內容以下:
PKG_CONFIG_PATH=/usr/win32/lib/pkgconfig \
CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml" \
LDFLAGS=-L/usr/win32/lib \
CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \
./configure \
--disable-gtk \
--enable-nls --enable-sdl --with-sdl-config-path=/usr/win32/bin \
--enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
--with-ffmpeg-zlib --enable-faad --enable-flac --enable-theora \
--with-wx-config-path=/usr/win32/bin \
--with-freetype-config-path=/usr/win32/bin \
--with-fribidi-config-path=/usr/win32/bin \
--enable-live555 --with-live555-tree=/usr/win32/live.com \
--enable-caca --with-caca-config-path=/usr/win32/bin \
--with-xml2-config-path=/usr/win32/bin \
--with-dvdnav-config-path=/usr/win32/bin \
--disable-cddax --disable-vcdx --enable-goom \
--enable-twolame --enable-dvdread \
--enable-shared-libvlc \
--enable-debug
想知道每一個--enable,--disable是什麼意思,能夠使用以下命令將configure的參數信息保存到confHelp.txt中,之後對照該文件查看修改vlc編譯腳本。
./configure -h > confHelp.txt
步驟四:運行vlc腳本
轉換下腳本的編碼格式:
dos2unix configure-vlc01.sh
運行腳本:
./configure-vlc01.sh
若是腳本遇到了相似Permission denied的錯誤,提高腳本的權限:
chmod 777 configure-vlc01.sh
若是腳本運行成功,則會顯示以下信息:
vlc configuration
--------------------
vlc version : 0.8.6i
system : mingw32
architecture : i686 mmx
build flavour : debug optim devel
vlc aliases : svlc wxvlc
You can tune the compiler flags in vlc-config.
To build vlc and its plugins, type `./compile' or `make'.
步驟五:做一點點修改工做
因爲在編譯完成後vlc.exe會要求libvlc.dll.exe,這顯然是不對的。應該直接去調用libtool.dll,解決方案爲:
修改"/tmp/vlc-0.8.6i"目錄下的libtool文件4760行
prog)
case $host in
*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
esac
爲:
prog)
case $host in
#*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
*cygwin*) output=`$echo $output` ;;
esac
步驟六:make
運行:
make
若是是雙核的電腦,能夠運行:
make -j2
若是的電腦有N多個cpu,則參數能夠爲-jN,N爲cpu個數。這樣能將幾個cpu都利用起來,執行時間會縮短一些。
make的執行期間可能會出現錯誤,須要修改一些文件,當修改完成後,再執行make,之前make的東西會保留而繼續make剛纔出錯的地方。其實這種方式很方便咱們之後修改源代碼,從新make的時候它只會編譯修改的地方,很節省時間。
錯誤1:
In file included from file.c:30:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include/sys/stat.
h:113: error: parse error before "off_t"
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include/sys/stat.
h:118: error: parse error before '}' token
make[4]: *** [libaccess_output_file_plugin_a-file.o] Error 1
make[4]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/access_output'
make[3]: *** [all-modules] Error 1
make[3]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/access_output'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/wangwei1/vlc-0.8.6i'
make: *** [all] Error 2
解決方案:
//在"/usr/i686-pc-mingw32/include/sys"目錄下的stat.h的文件開始處添加以下代碼
#ifndef _OFF_T DEFINED
typedef long off_t;
#define _OFF_T DEFINED
#endif
錯誤2:
libdtstofloat32_plugin.a(libdtstofloat32_plugin_a-dtstofloat32.o): In function `
Open':
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:219: und
efined reference to `_dca_init'
libdtstofloat32_plugin.a(libdtstofloat32_plugin_a-dtstofloat32.o): In function `
DoWork':
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:303: und
efined reference to `_dca_syncinfo'
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:312: und
efined reference to `_dca_frame'
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:331: und
efined reference to `_dca_blocks_num'
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:335: und
efined reference to `_dca_block'
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:341: und
efined reference to `_dca_samples'
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:331: und
efined reference to `_dca_blocks_num'
libdtstofloat32_plugin.a(libdtstofloat32_plugin_a-dtstofloat32.o): In function `
Destroy':
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:376: und
efined reference to `_dca_free'
libdtstofloat32_plugin.a(libdtstofloat32_plugin_a-dtstofloat32.o): In function `
CloseFilter':
/home/wangwei1/vlc-0.8.6i/modules/audio_filter/converter/dtstofloat32.c:430: und
efined reference to `_dca_free'
collect2: ld returned 1 exit status
make[6]: *** [libdtstofloat32_plugin.dll] Error 1
make[6]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/audio_filter/conve
rter'
make[5]: *** [all-modules] Error 1
make[5]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/audio_filter/conve
rter'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/audio_filter'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/audio_filter'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/wangwei1/vlc-0.8.6i'
make: *** [all] Error 2
解決方案:
修改"/tmp/vlc-0.8.6i"目錄下的vlc-config 文件
dtstofloat32)
ldflags="${ldflags} -ldts_pic"
爲:
dtstofloat32)
ldflags="${ldflags} -ldts"
錯誤3:
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x3fb): undefined refer
ence to `_ntohl@4'
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x488): undefined refer
ence to `_ntohl@4'
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x4e5): undefined refer
ence to `_ntohl@4'
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x57f): undefined refer
ence to `_ntohl@4'
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x5d5): undefined refer
ence to `_ntohl@4'
/usr/win32/lib/libFLAC.a(bitwriter.o):bitwriter.c:(.text+0x66f): more undefined
references to `_ntohl@4' follow
collect2: ld returned 1 exit status
make[4]: *** [libflacdec_plugin.dll] Error 1
make[4]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/codec'
make[3]: *** [all-modules] Error 1
make[3]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules/codec'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/wangwei1/vlc-0.8.6i/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/wangwei1/vlc-0.8.6i'
make: *** [all] Error 2
解決方案:
修改"/tmp/vlc-0.8.6i"目錄下的vlc-config 文件
flacdec)
ldflags="${ldflags} -lFLAC"
爲:
flacdec)
ldflags="${ldflags} -lFLAC -lws2_32"
錯誤4:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include/wchar.h:4
27: error: `off_t' does not name a type
make[3]: *** [libaxvlc_a-main.o] Error 1
make[3]: Leaving directory `/home/wangwei1/vlc-0.8.6i/activex'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/wangwei1/vlc-0.8.6i/activex'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/wangwei1/vlc-0.8.6i'
make: *** [all] Error 2
解決方案:
//在"/usr/i686-pc-mingw32/include/"目錄下的wchar.h的文件開始處添加以下代碼
#ifndef _OFF_T DEFINED
typedef long off_t;
#define _OFF_T DEFINED
#endif
通常會遇到這四個錯誤,若是還出現了其餘錯誤,確定是哪一步搞錯了,若是仍是有錯誤,RPWT。
步驟七:打包
執行如下命令就會獲得綠色版的vlc:
make package-win32-base
在vlc-0.8.6i的目錄下又會出現一個目錄vlc-0.8.6i,裏面就是編譯好的vlc了。
若是執行:
make package-win32-zip
獲得的zip文件就是官網上提供的/win32/*.zip文件了。
若是想獲得安裝文件(後面講ActiveX的時候會用到),首先須要下載NSIS 2.41,給個鏈接:[url]http://prdownloads.sourceforge.net/nsis/nsis-2.41-setup.exe?download[/url]。
安裝NSIS 2.41,而後在打包好的vlc-0.8.6i下面右鍵vlc.win32.nsi,選擇Compile NSIS .。
期間會出錯誤,有關Mozilla插件的:
Error in macro InstallFile . macroline 1
Error in . "E:\cygwin\home\wangwei1\vlc-0.8.6i0\vlc-0.8.6i\vlc.win32.nsi" . line 445 -- aborting creation process
用文本編譯器打開vlc.win32.nsi,在第445行前加上;(分號)註釋起來。
; !insertmacro InstallFile mozilla\npvlc.dll
從新Compile NSIS .。運行成功以後,在編譯好的vlc-0.8.6i同級目錄裏面就會出現vlc-${VERSION}-win32.exe這個文件。這個就是本身編譯的vlc的安裝文件了。(文件名應該是vlc-0.8.6i-win32.exe,可是可能NSIS的腳本的問題,${VERSION}替換不了,手動改一下就好了。)
2009-07-09更新:
vlc.win32.nsi的第7行加入
!define VERSION "0.8.6i"
能夠解決${VERSION}的問題。
至此,vlc-0.8.6i算是編譯完成了。
2010-04-09更新:
錯誤修正:
若是運行vlc出現了“Windows沒法訪問指定設備...您可能沒有合適權限訪問”,或者“Permission denied”錯誤,請在打包好的vlc-0.8.6i目錄下執行如下命令。增長兩個文件的運行權限。
chmod 755 vlc.exe vlc.exe.manifest
參考網址:
1. [url]http://rogerfd.cn/?p=127[/url]
2. [url]http://www.onlyblog.com/blog2/zyjzyj2000/10242.html[/url]
3. [url]http://wiki.videolan.org/Win32CompileCygwinNew[/url]
4. [url]http://hi.baidu.com/yanjinbin/blog/item/3f84aac2b924801d0ef47735.html[/url]
5. [url]http://www.onlyblog.com/blog2/zyjzyj2000/10184.html[/url]
6. [url]http://forum.videolan.org/viewtopic.php?f=2&t=45683[/url]
7. [url]http://forum.videolan.org/viewtopic.php?f=14&t=46390[/url]
ps:感謝vlc研究羣(49846130)的yjvj提供的資料。