Difference between revisions of "Win32Compile"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
How to compile VLC for Windows  
 
How to compile VLC for Windows  
  
== Before you start  ==
+
== Building Methods<br> ==
 
 
One common desire that leads people to want to rebuild VLC is to "rebuild a debug version" or "add printf()s", but this is not strictly necessary, as VLC includes a debug logging feature by default. If you are using a binary release (or have already built VLC), just run <code>'vlc.exe'</code> and select "Messages..." from the "Tools" menu.
 
 
 
You can also run VLC from the Windows command-line interpreter, <code>cmd.exe</code> (a.k.a. "DOS window"), in which case you'll be able to use the command-line arguments. You can obtain a list of these command line arguments by typing <code>'vlc --help'</code> or <code>'vlc --help --advanced'</code>.
 
 
 
To store a debug log of the current VLC session, you can use <code>'vlc -vvv --extraintf=logger'</code>. You will end-up with a <code>vlc-log.txt</code> file in your current directory.
 
 
 
== Building VLC from source  ==
 
  
 
If you want to build VLC from source, you have several choices:  
 
If you want to build VLC from source, you have several choices:  
Line 19: Line 11:
 
! Notes
 
! Notes
 
|-
 
|-
| Cross-compile with Mingw32 on Linux  
+
| Cross-compile with Mingw on Linux  
| None: read this page  
+
| This page  
| '''Preferred''' method (uses cross compilation). If on windows you can do it on a virtual machine, via dual-boot or from another computer. <br> ''Note: read [[Win32CompileFedora13]] if building on Fedora 13''
+
| '''Preferred''' method (uses cross compilation). On Windows, you should do it in a virtual machine.<br> ''Note: read [[Win32CompileFedora13]] if building on Fedora 13''
 
|-
 
|-
| Native-compile with [http://www.mingw.org MSYS+MINGW]  
+
| Native compilation with [http://www.mingw.org MSYS+MINGW]  
 
| [[Win32CompileMSYSNew]]  
 
| [[Win32CompileMSYSNew]]  
| '''Not recommanded''' native compilation method. MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows. It provides all the commonly-required Unix tools (like sh, gmake, and so forth).
+
| '''Native''' compilation method. MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows.
 
|-
 
|-
| Cross-compile with cygwin
+
| Native compilation with cygwin  
| [[Win32CompileCygwinNew]]
+
| [[Win32CompileCygwinNew]]  
| Build using cygwin as your cross compile environment. Error prone, and slow.
+
| Build using cygwin as your compile environment. '''Error''' prone, and '''slow'''.
 
|}
 
|}
  
== Obtaining the build tools ==
+
== Obtaining the toolchain ==
  
 
Each build method requires its own toolchain:  
 
Each build method requires its own toolchain:  
Line 43: Line 35:
 
| Cross-compile with mingw32 on GNU/Linux  
 
| Cross-compile with mingw32 on GNU/Linux  
 
|  
 
|  
*Debian/Ubuntu users can <code>apt-get install gcc-mingw32 mingw32-binutils</code>. <code>apt-get build-dep vlc</code> should download most of the needed libraries (according to the vlc version in the repositories), however building FFmpeg now requires mingw32-runtime &gt;= 3.17 and w32api &gt;= 3.13 so these might have to be updated manually. Install the lua compiler with <code>apt-get install lua5.1</code>.
+
*Debian/Ubuntu users can <code>apt-get install gcc-mingw32 mingw32-binutils</code>.&nbsp;<code></code>
 
*Gentoo users can <code>emerge crossdev &amp;&amp; crossdev mingw32</code>  
 
*Gentoo users can <code>emerge crossdev &amp;&amp; crossdev mingw32</code>  
 
*Other systems may attempt http://www.mingw.org/wiki/LinuxCrossMinGW
 
*Other systems may attempt http://www.mingw.org/wiki/LinuxCrossMinGW
 +
 
|-
 
|-
 
| Native-compile with [http://www.mingw.org MSYS+MINGW]  
 
| Native-compile with [http://www.mingw.org MSYS+MINGW]  
Line 54: Line 47:
 
|}
 
|}
  
 +
 +
== Get the source code ==
 +
$ git clone git://git.videolan.org/vlc.git<br><br>
 +
 
== 3rd party libraries.<br>  ==
 
== 3rd party libraries.<br>  ==
  
Line 69: Line 66:
 
== Configuring the build  ==
 
== Configuring the build  ==
  
First of all, [[GetTheSource]] then run <code>./bootstrap</code>.
+
First of all, [[GetTheSource]] then run <code>./bootstrap</code>.  
  
 
Once you've got all the files you need in place, you need to configure the build with the <code>./configure</code> script.  
 
Once you've got all the files you need in place, you need to configure the build with the <code>./configure</code> script.  
Line 76: Line 73:
  
 
*<code>extras/package/win32/configure.sh --with-contrib=/usr/win32 --host=i586-mingw32msvc</code>  
 
*<code>extras/package/win32/configure.sh --with-contrib=/usr/win32 --host=i586-mingw32msvc</code>  
*<code>extras/package/win32/configure.sh --with-contrib=/path/to/folder/containing/contribs</code>  
+
*<code>extras/package/win32/configure.sh --with-contrib=/path/to/folder/containing/contribs</code>
or just run configure manually, like
+
 
 +
or just run configure manually, like  
 +
 
 
*<code>./configure --with-contrib=/usr/win32 --host=i586-mingw32msvc</code>
 
*<code>./configure --with-contrib=/usr/win32 --host=i586-mingw32msvc</code>
  
See <code>'./configure --help'</code> for more information.
+
See <code>'./configure --help'</code> for more information.  
  
 
== Building VLC  ==
 
== Building VLC  ==
Line 93: Line 92:
 
! Description
 
! Description
 
|-
 
|-
| <code>make package-win32-strip</code> (might be package-win-strip)
+
| <code>make package-win32-strip</code> (might be package-win-strip)  
 
| Creates a subdirectory named <code>vlc-x.x.x</code> with all the binaries 'stripped' (that is, smallest size, unusable with a debugger)
 
| Creates a subdirectory named <code>vlc-x.x.x</code> with all the binaries 'stripped' (that is, smallest size, unusable with a debugger)
 
|-
 
|-

Revision as of 23:10, 2 December 2011

How to compile VLC for Windows

Building Methods

If you want to build VLC from source, you have several choices:

Method Documentation Notes
Cross-compile with Mingw on Linux This page Preferred method (uses cross compilation). On Windows, you should do it in a virtual machine.
Note: read Win32CompileFedora13 if building on Fedora 13
Native compilation with MSYS+MINGW Win32CompileMSYSNew Native compilation method. MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows.
Native compilation with cygwin Win32CompileCygwinNew Build using cygwin as your compile environment. Error prone, and slow.

Obtaining the toolchain

Each build method requires its own toolchain:

Method Notes
Cross-compile with mingw32 on GNU/Linux
Native-compile with MSYS+MINGW Read the documentation
Native-compile with Cygwin Read the documentation


Get the source code

$ git clone git://git.videolan.org/vlc.git

3rd party libraries.

VLC modules requires numerous open source projects to work (like AC3 audio decoding or MPEG-4 video decoding).

If you feel you must build these libraries from source, go to extras/contrib and read the README.

If you want to save yourself a lot of time and energy, use the pre-built versions of these libraries. You may download them from http://people.videolan.org/~jb/Contribs/, named in fashion of contrib-yyyymmdd-win32-version-bin-gcc-gccversion-only.tar.bz2.

Install the pre-built libraries into the standard directories (/usr/win32/*) by using

tar jxf contrib-20061122-win32-bin-gcc-3.4.5-only.tar.bz2 -C /

(Note the "-C /"!)

Configuring the build

First of all, GetTheSource then run ./bootstrap.

Once you've got all the files you need in place, you need to configure the build with the ./configure script.

Good configure examples can be found in some files (in git). From the vlc source base directory you could run:

  • extras/package/win32/configure.sh --with-contrib=/usr/win32 --host=i586-mingw32msvc
  • extras/package/win32/configure.sh --with-contrib=/path/to/folder/containing/contribs

or just run configure manually, like

  • ./configure --with-contrib=/usr/win32 --host=i586-mingw32msvc

See './configure --help' for more information.

Building VLC

Once configured, to build VLC, just run 'make'.

Once the compilation is done, you can either run VLC directly from the source tree or you can build self-contained VLC packages with the following make rules:

Command Description
make package-win32-strip (might be package-win-strip) Creates a subdirectory named vlc-x.x.x with all the binaries 'stripped' (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!