[vlc-devel] Building VLC for Windows

Rafaël Carré funman at videolan.org
Sat Feb 4 01:40:39 CET 2012

Le 2012-02-03 19:04, Rafaël Carré a écrit :
> vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Feb  2 18:23:20 2012 -0500| [521f40906c11615b9da6fabb19870724b91769fb] | committer: Rafaël Carré
> contrib: detect mingw-w64 (as opposed to mingw.org)


I want to explain what is going on with all the mingw changes.

Q. What is Mingw?
A. Mingw is a set of headers and libraries which mimic the Windows SDK,
and let people build applications for Windows without Windows.
It's the equivalent of glibc for Linux.

Q. What is mingw.org?
A. Often called "mingw32", it's the first project which shipped such
libraries and headers, targetting Windows/i386.
On Debian it's installed in /usr/i586-mingw32msvc
See http://www.mingw.org/

Q. What is mingw-w64?
A. It's a fork of mingw.org which adds Win64 compatibility (targetting
x86_64), but keeps Win32 compatibility.
On Debian it's installed in /usr/x86_64-w64-mingw32 and
See http://mingw-w64.sourceforge.net/

Q. What does VLC build with?
A. It was always built with mingw.org
See http://wiki.videolan.org/Win32Compile

So to build VLC with mingw.org you need:
	gcc built for i586-ming32msvc target (available as gcc-mingw32 in
debian, which is gcc 4.4)
 	binutils built for i586-mingw32msvc target (available as
mingw32-binutils in debian, which is binutils 2.20)
	mingw.org >= 3.15 (only 3.13 is available in debian, you can get a more
recent package on http://people.videolan.org/~jb/debian/ , or get 3.15
from Ubuntu).
	directx, directshow, direct2d, and dxva2api headers which are absent
from mingw.org (that is taken care by the contrib)

If you want to use mingw-w64 (for either 32bits or 64bits), you need:
	gcc built for your target (debian has gcc-mingw-w64 which is gcc 4.6.2)
	binutils built for your target (debian has binutils-mingw-w64 which
depends on both targets)
	mingw-w64 built for your target.

So which version of mingw-w64 works with VLC ? Let's see....

<= 2.0.0 has a #define printf __mingw_printf which breaks printf format
attribute and C++ using printf as a name for class members, so it can
not be used to build Qt4.

2.0.1 has fixes for printf functions, but a bug in the definition of
asprintf will make VLC crash at runtime.

2.0.1+svn4784-1 available in Debian works, but
include/sdks/_mingw_directx.h incorrectly states that DirectX SDK is not
available while it is; you can change the #if 0 into #if 1 into that file.

I was recently given commit access to mingw-w64 and I have been
contributing fixes for those issues.

What remains to be done:
- Fix the availability of DirectX SDK in header
- Fix ID2D1HwndRenderTarget interface (d2d1.h in Debian's version is not
detected by VLC due to using C++ syntax, which is fixed already)

When that 2 changes will be done, 3.0 and 2.0.2 will be the first
versions of mingw-w64 able to build VLC out of the box (and without
using external headers).

You can find automated builds for both 32/64 bits target, and for Linux
i386/amd64 / Windows (presumably 32bits) and OSX (presumably i386) on:

However I don't know the schedule for rebuild.

So you can continue to use mingw.org without worrying, and if you have a
question about mingw-w64 I will be glad to answer.

In the meantime I advise to use debian sid versions of mingw-w64, and
fix /usr/*/include/sdks/_mingw_directx.h . I will speak soon with the
package maintainer to have a fixed version.

More information about the vlc-devel mailing list