Difference between revisions of "Win32CompileMSYSNew"

From VideoLAN Wiki
Jump to navigation Jump to search
(Complete rework by Vince, replacing JB's original with his blessing - http://forum.videolan.org/viewtopic.php?f=32&t=76483&p=255461#p255466)
Line 1: Line 1:
== Introduction ==
+
= Introduction =
  
MSYS is a helper environment for MinGW, the compiler chain for Windows based on GCC. It is the fastest way to build VLC natively on Windows.
+
==About==
 +
MSys is a helper environment for MinGW, the compiler chain for Windows based on GCC. It is the fastest way to build VLC natively on Windows.
  
This howto was re-created by [[User:J-b|Jean-Baptiste Kempf]] and updated in June 2009, September 2009, December 2009 and March 2010
+
VLC is a complex program with many dependencies, so minimal command-line experience is required (who would want to build VLC without having command-line experience ?). Also, don't be in a hurry (2 hours is a minimum for the whole process) and don't despair if it doesn't work first time.
  
 +
This version is mainly an update by Vicne of the original howto by [[User:J-b|Jean-Baptiste Kempf]].
 +
 +
==On the edge vs Conservative==
 +
This update aims at building version 1.1.0rc (latest official build at time of writing) natively in the most straightforward way.
 +
 +
Of course, if you want to live on the edge, feel free to select more recent versions of the proposed tools, contribs or sources, but the build has only been thoroughly validated with the versions indicated in the main text flow.
 +
 +
:''Such alternative ways are indented, italicized and marked "Note for the brave" :-). Your mileage may vary''
 +
 +
==Acknowledgements==
 +
Thanks go to J-b, gnosygnu and MichaelMc
 +
 +
= Windows tools needed =
 
== Text editor ==
 
== Text editor ==
  
 
To edit unix-style text documents you need a suitable editor.
 
To edit unix-style text documents you need a suitable editor.
  
For those wishing to have a Notepad look-and-feel I recommend [http://sourceforge.net/projects/notepad2/ notepad2], which may tempt you to ditch Notepad alltogether.
+
For those wishing to have a Notepad look-and-feel I recommend [http://sourceforge.net/projects/notepad2/ notepad2], which may tempt you to ditch Notepad altogether.
 
You can set File - Line endings - Default to "Unix (LF)", but it always saves opened files in the ending style they have.
 
You can set File - Line endings - Default to "Unix (LF)", but it always saves opened files in the ending style they have.
  
== Install MinGW ==
+
== Unzip Utility ==
 +
Many files to downloaded will have to be uncompressed. As most of them use Linux-originated formats (.tar.gz, .tar.bz2, .tar.lzma), you will need a versatile unzipping utility. A recent version of [http://www.7-zip.org/ 7-zip] is therefore strongly advised.
  
Before installing, ensure your username does not contain spaces... (vlc will not build in a folder with spaces in it)
+
Please note that most archives contain directory structures. Unless otherwise stated, you have to merge the contents with the existing dirs
  
Use the main installer 5.1.6 found at
+
== Browser ==
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download
+
// TODO - is Firefox really needed ?
  
Go through the wizard:
+
Please install [http://www.getfirefox.com Mozilla Firefox]
* select "Downloading and Install"
 
* select candidate release
 
* select g++ and MinGW Make (in addition to the base system)
 
  
It will download (from http://prdownloads.sourceforge.net/mingw) and install (based on mingw.ini file Build 12):
+
= GNU Windows Environment =
* mingwrt-3.17-mingw32-dev.tar.gz
 
* mingwrt-3.17-mingw32-dll.tar.gz
 
* w32api-3.14-mingw32-dev.tar.gz
 
* binutils-2.18.50-20080109-2.tar.gz
 
* gcc-core-3.4.5-20060117-3.tar.gz
 
* gcc-g++-3.4.5-20060117-3.tar.gz
 
* mingw32-make-3.81-2.tar.gz
 
  
=== Update Mingw GCC to 4.4.0 ===
+
Before installing, ensure your Windows user name does not contain spaces (VLC will not build in a folder with spaces in it). If it does, please create another user on your system.
  
Use GCC 4.4.0, with
+
In the following text, we'll refer to this user name as "<username>". Replace it appropriately where needed of course.
http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-full-4.4.0-mingw32-bin-2.tar.lzma/download
 
  
Extract it to C:\Mingw and make it replace the current files (you can use 7-zip to extract the files).
+
== MinGW ==
  
* Use text editor to change MinGW\lib\gcc\mingw32\4.4.0\libstdc++.la file (line should be <code><nowiki>library_names=''</nowiki></code>) due to bug in latest MinGW.
+
:''Note for the brave : The steps advised below use a modified version of MinGW. Is you feel like staying with the vanilla MinGW intead, use the main installer 5.1.6 found at http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download , then go through the wizard:
 +
:''* select "Downloading and Install"''
 +
:''* select candidate release''
 +
:''* select g++ and MinGW Make (in addition to the base system)''
 +
:''Then, update Mingw GCC to 4.4.0 by downloading http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-full-4.4.0-mingw32-bin-2.tar.lzma/download and extracting it to C:\Mingw (replacing files when asked). Finally, you'll gave to fix the file C:\MinGW\lib\gcc\mingw32\4.4.0\libstdc++.la by opening it and changing the line defining library_names so that it reads <code><nowiki>library_names=''</nowiki></code>
 +
''
  
It also needs
+
=== TDM/MinGW Setup ===
http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-core-4.4.0-mingw32-dll.tar.gz/download
 
to be installed otherwise there are warnings about a libgcc_s_dw2-1.dll missing when it comes to compiling the qt4 interface.
 
  
=== ''ALTERNATIVE'' for above installation: Install TDM MinGW 4.4.1 ===
+
Use the installer found at
 +
http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download
  
The above setup may produce build errors like "undefined reference to `__Unwind_SjLj_Register'" when compiling vlc.
+
Go through the wizard:
That is because the above 4.4.0 build uses DW2(Dwarf-2) unwinding.
+
* unckeck "Check for updated files..."
 +
* Select "Create"
 +
* install to C:\MinGW
 +
* keep default settings (i.e. under the gcc node, "TDM Unstable: 4.4.1-tdm-2" should be selected)
  
You need a MinGW build of SJLJ unwinding.
+
=== MinGW utils ===
  
An easy installer is offered on [http://www.tdragon.net/recentgcc/ Twilight Dragon Media]: (Thanks to [[User:MichaelMc|MichaelMc]])
+
TODO - Is this step needed ?
* http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download
 
  
* Use text editor to change MinGW\lib\gcc\mingw32\4.4.1\libstdc++.la file (line should be <code><nowiki>library_names=''</nowiki></code>) due to bug in latest MinGW.
+
Installing mingw-utils is recommended: http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz
  
It also needs
+
Extract contents to c:\MinGW
http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-core-4.4.0-mingw32-dll.tar.gz/download
 
to be installed otherwise there are warnings about a libgcc_s_dw2-1.dll missing when it comes to compiling the qt4 interface.
 
  
== Install MSYS ==
+
== MSys ==
 +
=== MSys Setup ===
  
* Install 7-zip and Mozilla Firefox
+
Use the installer found at
* Install MSys 1.0.11-rc1 with the exe: http://sourceforge.net/project/downloading.php?group_id=2435&filename=MSYS-1.0.11.exe to default C:\Msys\1.0 folder
+
http://sourceforge.net/project/downloading.php?group_id=2435&filename=MSYS-1.0.11.exe  
 +
 
 +
Go through the wizard and install to to default C:\Msys\1.0
 +
 
 +
In the command window that opens, answer questions as follows:
 
  Accept Post Install: [y]
 
  Accept Post Install: [y]
 
  MinGW Installed? :  [y]
 
  MinGW Installed? :  [y]
 
  path to MinGW:      [c:/MinGW]
 
  path to MinGW:      [c:/MinGW]
* Install MSys Developer Tooltkit: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe
 
  
=== AutoTools in MSYS ===
+
=== MSys Developer Toolkit ===
 +
Use the installer found at
 +
http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe
 +
 
 +
Go through the wizard, keeping default values
 +
 
 +
=== AutoTools and libcrypt ===
  
Update your autoconf, automake and libtool by downloading and installing them, keeping in mind that you need to extract the content to C:\Msys\1.0
+
Update autoconf, automake, libtool as well as libcrypt by downloading the following files and extracting them to C:\Msys\1.0:
 
* http://sourceforge.net/projects/mingw/files/MSYS%20autoconf/autoconf-2.63-1/autoconf-2.63-1-msys-1.0.11-bin.tar.lzma/download
 
* http://sourceforge.net/projects/mingw/files/MSYS%20autoconf/autoconf-2.63-1/autoconf-2.63-1-msys-1.0.11-bin.tar.lzma/download
 
* http://sourceforge.net/projects/mingw/files/MSYS%20automake/automake-1.11-1/automake-1.11-1-msys-1.0.11-bin.tar.lzma/download  
 
* http://sourceforge.net/projects/mingw/files/MSYS%20automake/automake-1.11-1/automake-1.11-1-msys-1.0.11-bin.tar.lzma/download  
 
* http://sourceforge.net/projects/mingw/files/MSYS%20libtool/libtool-2.2.7a-1/libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma/download
 
* http://sourceforge.net/projects/mingw/files/MSYS%20libtool/libtool-2.2.7a-1/libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma/download
 +
* http://prdownloads.sourceforge.net/mingw/libcrypt-1.1_1-2-msys-1.0.11-dll-0.tar.lzma
 +
 +
=== Glib and PKG-CONFIG ===
 +
 +
Similarly, download the following files and extract them to C:\MSys\1.0:
 +
 +
* http://ftp.gnome.org/pub/GNOME/binaries/win32/glib/2.18/glib_2.18.2-1_win32.zip
 +
* ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
 +
* ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.23-3_win32.zip
 +
 +
=== Add pkg config path variable ===
  
You can also compile them according to:
+
Add the following line to the top of C:\MSys\msys.bat:
* http://trac.enlightenment.org/e/wiki/EFLWindowsXP (was: http://wiki.enlightenment.org/index.php/EFL_Windows_XP)
 
* http://www.mingw.org/wiki/msys
 
  
==== Patch libtools ====
+
set PKG_CONFIG_PATH=/win32/lib/pkgconfig
  
If you installed the TDM MinGW 4.4.1, you may also need to patch the downloaded libtools file in your msys after installing, because it is hardcoded for the 4.4.0 version of MinGW:
+
=== Fix libtool search dirs ===
* Use text editor to open /bin/libtools and find "compiler_lib_search_dirs" (lines 10244 to 10255) and change ALL "mingw32/4.4.0" instances to "mingw32/4.4.1"
 
  
==== Add a personal touch to your own build of vlc ====
+
Open C:\MSys\1.0\bin\libtool and change line 9926 by appending ' /mingw/lib' to the end of 'compiler_lib_search_dirs'. The line should then read :
  
This one isn't necessary to build vlc, but it adds a personal touch.
+
compiler_lib_search_dirs="/usr/lib /usr/lib /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /mingw/lib"
  
No 'compiled by' name will appear in vlc's about box when you run it. This is because msys lacks a 'whoami' command.
+
== LUA tools ==
  
Use your text editor to create a new file and enter a single line of text:
+
VLC uses the LUA scripting language (See [http://www.lua.org lua.org]).
 +
Unfortunately, no binaries are provided so you need to compile them.
  
echo 'insert your name here'
+
* Download the lua tools package from http://www.lua.org/ftp/lua-5.1.4.tar.gz
 +
* Uncompress it in your home folder (C:\MSys\1.0\home\<username>)
 +
* run C:\MSys\1.0\msys.bat
 +
* type the following commands:
  
Save it as 'whoami' in C:\msys\1.0\bin . Type 'whoami' in the console: It now returns your name.
+
cd ~/lua-5.1.4
 +
make mingw
  
=== Install libgcrypt in MSys ===
+
This should produce lua.exe, luac.exe and lua51.dll in the src directory. Put these in your /bin with the commands:
  
http://prdownloads.sourceforge.net/mingw/libcrypt-1.1_1-2-msys-1.0.11-dll-0.tar.lzma
+
cd src
 +
cp *.exe /bin
 +
cp *.dll /bin
 +
cd ..
  
=== Install other tools in Mingw ===
+
= Precompiled contribs =
  
Installing mingw-utils is recommended: http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz, extract it to mingw/bin.
+
:''Note for the brave : Alternatively, you can get the latest contrib from :http://people.videolan.org/~jb/Contribs/''
  
Installation of wget too: http://prdownloads.sourceforge.net/mingw/wget-1.9.1-mingwPORT.tar.bz2
+
* download the file http://people.videolan.org/~jb/Contribs/contrib-20100608-win32-bin-gcc-4.4.4-runtime-3.17-only.tar.bz2
 +
* extract it to C:\MSys\1.0 '''but without the /usr path'''. For example, one of the resulting files should be:
  
Although this is a mingwPORT package it already has a precompiled wget on board.
+
C:\MSys\1.0\win32\lib\libdvdnav.a
Extract the .tar.bz2 file. It contains wget.exe in the bin subfolder, extract it to mingw/bin.
 
  
=== PKG-CONFIG ===
+
= VLC sources =
  
pkg-config is a mess, this is not NEWS... And you cannot compile it from Windows because of a few bugs...
+
:''Note for the brave : This section lists the steps for VLC version 1.1.0rc. Alternatively, you can get the latest sources from the development tree using GIT. It's not as difficult as it looks and will avoid the need for multiple manipulations described here. If you want chose that route, please follow instructions on the [[Git_Windows]] page then skip to next section.''
  
Get Glib from GNOME: http://ftp.gnome.org/pub/GNOME/binaries/win32/glib/2.18/glib_2.18.2-1_win32.zip
+
== Base: VLC version 1.1.0rc ==
Unzip it to C:\Msys\1.0 .
 
  
Get PKG-CONFIG from GNOME: ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
+
* download the file http://download.videolan.org/pub/videolan/testing/vlc-1.1.0-rc/vlc-1.1.0-rc.tar.bz2
and ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.23-3_win32.zip
+
* extract it to C:\MSys\1.0\home\<username>
Unzip them to C:\Msys\1.0 .
+
* rename the vlc-1.1.0rc dir to vlc
  
---
+
== add missing configure-msys ==
 +
* Download http://git.videolan.org/?p=vlc.git;a=blob_plain;f=extras/package/win32/configure-msys.sh;hb=HEAD
 +
* Save it (not using proposed name) as C:\MSys\1.0\home\<username>\vlc\extras\package\win32\configure-msys.sh
  
Set PKG_CONFIG_PATH=/win32/lib/pkgconfig
+
== add missing configure-common ==
 +
* Download http://git.videolan.org/?p=vlc.git;a=blob_plain;f=extras/package/win32/configure-common.sh;hb=HEAD
 +
* Save it (not using proposed name) as C:\MSys\1.0\home\<username>\vlc\extras\package\win32\configure-common.sh
  
(e.g. by adding the Windows enviroment variable PKG_CONFIG_PATH in "Control Panel"->"System"->"Advanced System Settings"->"Environment Variables" and setting the value to /win32/lib/pkgconfig)
+
== add missing vlc_windows_interfaces.h ==
 +
* Download http://git.videolan.org/?p=vlc/vlc-1.1.git;a=blob_plain;f=include/vlc_windows_interfaces.h;h=36bfd4a64b1ec9b9b5da0e21de6d93f53f2eefc3;hb=3a4b30fcf1fbb9ef7a9c85a102183f8a3451622a
 +
* Save it (not using proposed name) as C:\MSys\1.0\home\<username>\vlc\include\vlc_windows_interfaces.h
  
--- (SJW 12/5/2010)
+
== duplicate missing position.h ==
  
== Install LUA tools ==
+
Duplicate the file as follows:
 +
source: C:\MSys\1.0\home\<username>\vlc\projects\mozilla\control\position.h
 +
target: C:\MSys\1.0\home\<username>\vlc\projects\activex\position.h
  
vlc uses the LUA scripting language (See [http://www.lua.org lua.org]).
+
== add dummy lua extension ==
 +
* create the directory C:\msys\1.0\home\<username>\vlc\share\lua\extensions
 +
* create an empty file and save it as C:\MSys\1.0\home\<username>\vlc\share\lua\extensions\readme.txt
  
If you don't have a lua.exe and luac.exe:
 
* Download the lua tools from http://www.lua.org/ftp/lua-5.1.4.tar.gz
 
Untar it in your home folder.
 
There are no binaries supplied, so you need to compile this:
 
  
$ cd ~/lua-5.1.4
+
= Last changes : whoami and hostname =
$ make mingw
 
  
This should produce lua.exe, luac.exe and lua51.dll in the src directory. Put these in your /bin
+
Whoami is not available on Windows, and hostname doesn't support the -f option used by the build process. These utilities are used to show the name and computer of the person who compiled VLC in the 'About' box.
  
$ cd src
+
:''Note for the brave : the steps below are file changes so that compile works, but an alternative is to download and install GNU whoami and hostname functionality. This can be achieved by extracting who.exe, whoami.exe and hostname.exe from http://sourceforge.net/projects/mingw/files/MSYS/coreutils/coreutils-5.97-2/coreutils-5.97-2-msys-1.0.11-ext.tar.lzma/download and saving them to C:/MSys/1.0/bin''
$ cp *.exe /bin
 
$ cp *.dll /bin
 
  
--[[User:Belbear|Belbear]] 12:58, 7 April 2010 (UTC)
+
== Whoami ==
 +
Create a new file containing the single line:
  
== Install Git and checkout VLC ==
+
echo '<username>'
  
See [[Git_Windows]].
+
and save it as C:\MSys\1.0\bin\whoami (without any extension)
  
You can also retrieve the source code from [http://www.videolan.org/vlc/download-sources.html VideoLAN Project: VLC media player source code]
+
== Hostname ==
  
== Contribs ==
+
Modify configure.ac so that it doesn't call 'hostname -f' as follows:
 +
* open C:\MSys\1.0\home\<username>\vlc\configure.ac
 +
* goto line 4728
 +
* change it as follows:
  
Take the precompiled contribs from:
+
old: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2> /dev/null || hostname`", [host which ran configure])
  http://people.videolan.org/~jb/Contribs/
+
  new: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])
  
Copy them in your ~
+
= Build VLC =
tar xvjf contrib-20090813-win32-bin-gcc-4.2.1-sjlj-runtime-3.15.2-only.tar.bz2 -C /
 
rm -v /usr/win32/bin/moc /usr/win32/bin/uic /usr/win32/bin/rcc
 
  
rm isn't needed with some contrib packages, because they don't contain those files.
+
The build is made exclusively from the command line, so if you closed the prompt at the LUA step, re-execute C:\MSys\1.0\msys.bat, then type the commands as mentioned
  
== Bootstrap VLC ==
+
== Bootstrap ==
  
 
  cd vlc
 
  cd vlc
Line 174: Line 212:
 
  cp -v /usr/share/aclocal/* m4/
 
  cp -v /usr/share/aclocal/* m4/
 
  PATH=/usr/win32/bin:$PATH ./bootstrap
 
  PATH=/usr/win32/bin:$PATH ./bootstrap
It should warn about gettext... Just ignore.
 
 
  
 
== Configure ==
 
== Configure ==
  
 
  sh extras/package/win32/configure-msys.sh
 
  sh extras/package/win32/configure-msys.sh
* If you downloaded a VLC source code tarball, retrieve ''configure-msys.sh'' and ''configure-common.sh'' from [[http://git.videolan.org/?p=vlc.git;a=summary vlc.git]] / extras / package / win32 /
 
* If Your user name starts from "u" or "x" characters, change config.h (double all backslashes in COMPILED_BY constant to avoid compilation errors) after configuring.
 
  
 
== Compile ==
 
== Compile ==
  
PATH=/usr/win32/bin:$PATH make
+
Note : If Your <username> starts with the "u" or "x" character, change C:\MSys\1.0\home\<username>\config.h and double all backslashes in COMPILED_BY constant
If you have Cygwin and others tools installed, try using a shorter PATH inside MSYS shell i.e.
 
$ echo $PATH
 
.:/usr/local/bin:/mingw/bin:/bin
 
  
==Creating self-contained packages==
+
./compile
  
Once the compilation is done, build self-contained VLC packages with the following "make" commands:
+
== Create self-contained packages ==
 +
 
 +
Once the compilation is done, build self-contained VLC packages with one of the following "make" commands:
  
 
  make package-win32-base
 
  make package-win32-base
Line 206: Line 239:
 
(Same as above but will also create an auto-installer package. You will need to have NSIS installed in its default location for this to work).
 
(Same as above but will also create an auto-installer package. You will need to have NSIS installed in its default location for this to work).
  
* If you have permissions problems running make package-*, chmod 777 -R the vlc folder.
+
=Troubleshooting=
* If you have permissions problems running vlc.exe after packaging, rename or delete vlc.exe.manifest
 
 
 
== Random bootstrap, configure, and make errors ==
 
 
 
There have been reports of random msys errors during bootstrap, configure, and make. They usually don't repeat themselves between runs. Rule out that your mingw-msys installation is at fault by building in windows safe mode. Even if this works, it may then be more practical to try a cross-compilation build.
 
 
 
== Troubleshooting ==
 
  
 
* It doesn't link, and complains about missing gcc symbols: You missed this line in the instructions:
 
* It doesn't link, and complains about missing gcc symbols: You missed this line in the instructions:
Line 222: Line 248:
 
to  
 
to  
 
<pre>AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])</pre>
 
<pre>AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])</pre>
 +
* If compile complains about a config.h and pthread.h not found problem, just delete config.h

Revision as of 08:18, 13 June 2010

Introduction

About

MSys is a helper environment for MinGW, the compiler chain for Windows based on GCC. It is the fastest way to build VLC natively on Windows.

VLC is a complex program with many dependencies, so minimal command-line experience is required (who would want to build VLC without having command-line experience ?). Also, don't be in a hurry (2 hours is a minimum for the whole process) and don't despair if it doesn't work first time.

This version is mainly an update by Vicne of the original howto by Jean-Baptiste Kempf.

On the edge vs Conservative

This update aims at building version 1.1.0rc (latest official build at time of writing) natively in the most straightforward way.

Of course, if you want to live on the edge, feel free to select more recent versions of the proposed tools, contribs or sources, but the build has only been thoroughly validated with the versions indicated in the main text flow.

Such alternative ways are indented, italicized and marked "Note for the brave" :-). Your mileage may vary

Acknowledgements

Thanks go to J-b, gnosygnu and MichaelMc

Windows tools needed

Text editor

To edit unix-style text documents you need a suitable editor.

For those wishing to have a Notepad look-and-feel I recommend notepad2, which may tempt you to ditch Notepad altogether. You can set File - Line endings - Default to "Unix (LF)", but it always saves opened files in the ending style they have.

Unzip Utility

Many files to downloaded will have to be uncompressed. As most of them use Linux-originated formats (.tar.gz, .tar.bz2, .tar.lzma), you will need a versatile unzipping utility. A recent version of 7-zip is therefore strongly advised.

Please note that most archives contain directory structures. Unless otherwise stated, you have to merge the contents with the existing dirs

Browser

// TODO - is Firefox really needed ?

Please install Mozilla Firefox

GNU Windows Environment

Before installing, ensure your Windows user name does not contain spaces (VLC will not build in a folder with spaces in it). If it does, please create another user on your system.

In the following text, we'll refer to this user name as "<username>". Replace it appropriately where needed of course.

MinGW

Note for the brave : The steps advised below use a modified version of MinGW. Is you feel like staying with the vanilla MinGW intead, use the main installer 5.1.6 found at http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download , then go through the wizard:
* select "Downloading and Install"
* select candidate release
* select g++ and MinGW Make (in addition to the base system)
Then, update Mingw GCC to 4.4.0 by downloading http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-full-4.4.0-mingw32-bin-2.tar.lzma/download and extracting it to C:\Mingw (replacing files when asked). Finally, you'll gave to fix the file C:\MinGW\lib\gcc\mingw32\4.4.0\libstdc++.la by opening it and changing the line defining library_names so that it reads library_names=''

TDM/MinGW Setup

Use the installer found at http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download

Go through the wizard:

  • unckeck "Check for updated files..."
  • Select "Create"
  • install to C:\MinGW
  • keep default settings (i.e. under the gcc node, "TDM Unstable: 4.4.1-tdm-2" should be selected)

MinGW utils

TODO - Is this step needed ?

Installing mingw-utils is recommended: http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz

Extract contents to c:\MinGW

MSys

MSys Setup

Use the installer found at http://sourceforge.net/project/downloading.php?group_id=2435&filename=MSYS-1.0.11.exe

Go through the wizard and install to to default C:\Msys\1.0

In the command window that opens, answer questions as follows:

Accept Post Install: [y]
MinGW Installed? :   [y]
path to MinGW:       [c:/MinGW]

MSys Developer Toolkit

Use the installer found at http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe

Go through the wizard, keeping default values

AutoTools and libcrypt

Update autoconf, automake, libtool as well as libcrypt by downloading the following files and extracting them to C:\Msys\1.0:

Glib and PKG-CONFIG

Similarly, download the following files and extract them to C:\MSys\1.0:

Add pkg config path variable

Add the following line to the top of C:\MSys\msys.bat:

set PKG_CONFIG_PATH=/win32/lib/pkgconfig

Fix libtool search dirs

Open C:\MSys\1.0\bin\libtool and change line 9926 by appending ' /mingw/lib' to the end of 'compiler_lib_search_dirs'. The line should then read :

compiler_lib_search_dirs="/usr/lib /usr/lib /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1 /bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /usr/lib/gcc-lib/i686-pc-msys/2.95.3-1/../../../../i686-pc-msys/lib /mingw/lib"

LUA tools

VLC uses the LUA scripting language (See lua.org). Unfortunately, no binaries are provided so you need to compile them.

cd ~/lua-5.1.4 
make mingw

This should produce lua.exe, luac.exe and lua51.dll in the src directory. Put these in your /bin with the commands:

cd src 
cp *.exe /bin
cp *.dll /bin
cd ..

Precompiled contribs

Note for the brave : Alternatively, you can get the latest contrib from :http://people.videolan.org/~jb/Contribs/
C:\MSys\1.0\win32\lib\libdvdnav.a

VLC sources

Note for the brave : This section lists the steps for VLC version 1.1.0rc. Alternatively, you can get the latest sources from the development tree using GIT. It's not as difficult as it looks and will avoid the need for multiple manipulations described here. If you want chose that route, please follow instructions on the Git_Windows page then skip to next section.

Base: VLC version 1.1.0rc

add missing configure-msys

add missing configure-common

add missing vlc_windows_interfaces.h

duplicate missing position.h

Duplicate the file as follows:

source: C:\MSys\1.0\home\<username>\vlc\projects\mozilla\control\position.h
target: C:\MSys\1.0\home\<username>\vlc\projects\activex\position.h

add dummy lua extension

  • create the directory C:\msys\1.0\home\<username>\vlc\share\lua\extensions
  • create an empty file and save it as C:\MSys\1.0\home\<username>\vlc\share\lua\extensions\readme.txt


Last changes : whoami and hostname

Whoami is not available on Windows, and hostname doesn't support the -f option used by the build process. These utilities are used to show the name and computer of the person who compiled VLC in the 'About' box.

Note for the brave : the steps below are file changes so that compile works, but an alternative is to download and install GNU whoami and hostname functionality. This can be achieved by extracting who.exe, whoami.exe and hostname.exe from http://sourceforge.net/projects/mingw/files/MSYS/coreutils/coreutils-5.97-2/coreutils-5.97-2-msys-1.0.11-ext.tar.lzma/download and saving them to C:/MSys/1.0/bin

Whoami

Create a new file containing the single line:

echo '<username>'

and save it as C:\MSys\1.0\bin\whoami (without any extension)

Hostname

Modify configure.ac so that it doesn't call 'hostname -f' as follows:

  • open C:\MSys\1.0\home\<username>\vlc\configure.ac
  • goto line 4728
  • change it as follows:
old: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2> /dev/null || hostname`", [host which ran configure])
new: AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])

Build VLC

The build is made exclusively from the command line, so if you closed the prompt at the LUA step, re-execute C:\MSys\1.0\msys.bat, then type the commands as mentioned

Bootstrap

cd vlc
cp -v /usr/win32/share/aclocal/* m4/
cp -v /usr/share/aclocal/* m4/
PATH=/usr/win32/bin:$PATH ./bootstrap

Configure

sh extras/package/win32/configure-msys.sh

Compile

Note : If Your <username> starts with the "u" or "x" character, change C:\MSys\1.0\home\<username>\config.h and double all backslashes in COMPILED_BY constant

./compile

Create self-contained packages

Once the compilation is done, build self-contained VLC packages with one of the following "make" commands:

make package-win32-base

(This will create a subdirectory named vlc-x.x.x with all the binaries "stripped" without any debugging symbols).

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 will need to have NSIS installed in its default location for this to work).

Troubleshooting

  • It doesn't link, and complains about missing gcc symbols: You missed this line in the instructions:

Use text editor to change MinGW\lib\gcc\mingw32\4.4.0\libstdc++.la file (line should be library_names=) due to bug in latest MinGW.

  • Compilation stops early, after configure was complaining about mismatched quotes:

Check the VLC_COMPILE_HOST variable in your config.h - if it's Option f is not valid then hostname -f fails (on Windows, there is no such option as -f). In configure.ac change

AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2> /dev/null || hostname`", [host which ran configure])

to

AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])
  • If compile complains about a config.h and pthread.h not found problem, just delete config.h