原文请参考:https://wiki.videolan.org/Win32Compile/
configure过程中如果出现error: LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!
是因为mingw-64版本问题,版本必须为最新版本,更新方法是去 http://ftp.us.debian.org/debian/pool/main/m/mingw-w64/查看包,在ubuntu下可以使用一下命令安装:
wget http://ftp.us.debian.org/debian/pool/main/m/mingw-w64/mingw-w64-common_3.0.0-3_all.deb
dpkg -i mingw-w64-common_3.0.0-3_all.deb
需要安装的都安装上,比如如下:
mingw-w64_3.0.0-3_all.deb
mingw-w64-common_3.0.0-3_all.deb
mingw-w64-dev_3.0~svn5915-1_all.deb
mingw-w64-i686-dev_3.0.0-3_all.deb
mingw-w64-tools_3.0.0-3_amd64.deb
mingw-w64-x86-64-dev_3.0.0-3_all.deb
---------------------------------------------------------------------------------------------------------
This page will help you to compile VLC media player for Windows.
Contents[hide]
|
If you want to build VLC from source, you have several choices:
Method | Documentation | Notes |
---|---|---|
MinGW on Linux | Obtaining the toolchain | Preferred method (uses cross compilation). On Windows, you should do it in a virtual machine. |
MSYS+MinGW on Windows | Compile with MSys | Native compilation method. MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows. |
Cygwin on Windows | Compile with Cygwin | Build using cygwin as your compile environment. Error prone, and slow. |
To compile VLC for Windows (32-bits or 64-bits), the Mingw-w64 toolchain is required:
apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools
(on Debian you must be on wheezy or above to find this package)
Up to versions 2.0.x, VLC was compiled with the older mingw32 toolchain, which only supports 32-bits Windows. If you have problems with mingw-w64, you can try mingw32 instead:
apt-get install gcc-mingw32 mingw32-binutils
. Note that at least version 3.17 of Mingw32 is required, which Debian does not provide. You may obtain mingw32-runtime-3.17 here.emerge crossdev && crossdev mingw32
pacman -S mingw32-gcc
You will also need:
A number of example commands below include the identifier of the toolchain. This value is essential: it instructs the build system to use the correct toolchain and compile the program for Windows. Without the value, the build system will perform a native compilation for Linux (or whatever your computer runs). With an incorrect value, the build will fail.
This is known as the host triplet, although it's more of a pair than a triplet in the case of Mingw. The exact value depends on your installation of the toolchain. Notably on Debian/Ubuntu, these values must be used:
Again, you MUST substitute the value in the following command snippets.
$ git clone git://git.videolan.org/vlc.git vlc
See Git for more information.
$ cd vlc
Before compiling VLC, you need lots of other libraries. Here is how to get them:
$ mkdir -p contrib/win32 $ cd contrib/win32 $ ../bootstrap --host=i686-w64-mingw32 $ make prebuilt
or, if you want to compile the contribs yourself and are feeling adventurous and have lots of time to burn,
# apt-get install subversion yasm cvs cmake
$ mkdir -p contrib/win32 $ cd contrib/win32 $ ../bootstrap --host=i686-w64-mingw32 $ make fetch $ make
If you are on Linux 64-bit, you SHOULD remove some files, or install the lib32 packages (ia32-libs, multilibs, etc...)
$ rm -f ../i686-w64-mingw32/bin/moc ../i686-w64-mingw32/bin/uic ../i686-w64-mingw32/bin/rcc
In addition, install the qt4-tools package.
If your Mingw prefix is not i686-w64-mingw32 (you are NOT on Debian or Ubuntu), create a symlink to contribs:
$ ln -sf ../i686-w64-mingw32 ../i486-mingw32
Go back to the VLC source directory:
$ cd -
First, prepare the tree:
$ ./bootstrap
Then you can to configure the build with the ./configure
script.
Create a subfolder:
$ mkdir win32 && cd win32
Use the standard configuration:
$ ../extras/package/win32/configure.sh --host=i686-w64-mingw32
NB: use YOUR Xcompiling prefix here, like i486-mingw32
Alternatively, you can run configure manually:
$ ../configure --host=i686-w64-mingw32
See '../configure --help'
for more information.
Once configured, to build VLC, just run:
$ make
Once the compilation is done, you can build self-contained VLC packages with the following make
rules:
Command | Description |
---|---|
make package-win-common |
Creates a subdirectory named vlc-x.x.x with all the binaries. You can run VLC directly from this directory. |
make package-win-strip |
Same as above but will create 'stripped' binaries (that is, smallest size, unusable with a debugger). |
make package-win32-7zip |
Same as above but will package the directory in a 7z file. |
make package-win32-zip |
Same as above but will package the directory in a zip file. |
make package-win32 |
Same as above but will also create an auto-installer package. You must have NSIS installed in its default location for this to work. |
Well done—you're ready to use VLC!