Difference between revisions of "Win32CompileMSYS"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 84: Line 84:
  
 
== Make (compile) ==
 
== Make (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 VLC_COMPILED_BY constant.
 
 
Type the following command :
 
  
 
  PATH=/usr/win32/bin:$PATH make -j4
 
  PATH=/usr/win32/bin:$PATH make -j4
  
If this step fails, try the following
+
'''Notes:'''
* Go back to "Precompiled contribs" section, and obtain the latest compiled contrib (under "Note for the brave")
+
* If your <username> starts with the "u" or "x" character, change C:\MSys\1.0\home\<username>\config.h and double all backslashes in VLC_COMPILED_BY constant.
* In the configure script section (configure-msys.sh), open that file and add --disable-upnp
 
  
 
== Create self-contained packages  ==
 
== Create self-contained packages  ==

Revision as of 12:01, 26 September 2012

Introduction

About

MSys is a helper environment for MinGW, the compiler chain for Windows based on GCC.

It can build VLC natively on Windows. Note that you should probably cross compile VLC from Linux, because it is faster, and feels easier.

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

Windows tools needed

Text editor

To edit unix-style text documents you need a suitable editor. Notepad is not enough.

  • Use notepad2. You can set File - Line endings - Default to "Unix (LF)", but it always saves opened files in the ending style they have.

Unzip Utility (7-zip)

Files to downloaded will have to be uncompressed. Some of them use Unix originated formats (.tar.gz, .tar.bz2, .tar.lzma), you will then need a versatile unzipping utility.

A recent version of 7-zip is therefore strongly advised.

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

TDM/MinGW Setup

Use the installer found at http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.7.1-2.exe/download

Go through the wizard:

  • Select "Create"
  • Select 32bits
  • Install to C:\MinGW
  • Keep default settings

MSys

Use the MSys package found at

Un-7zip it to C:\MinGW.

You should have C:\MinGW\msys now.

VLC sources

The build is made exclusively from the command line, so execute C:\MinGW\msys\msys.bat, then type the commands as mentioned further

Git

Clone the git repo

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

Get Build tools

cd vlc/extras/tools
./bootstrap
make

It should build autoconf, automake, libtool, pkg-config, cmake, yasm and ragel.

Note: Ragel compilation can fail, ignore it.

Get Precompiled contribs

cd vlc/contrib
mkdir win32 && cd win32
../bootstrap --build=i586-mingw32msvc
make prebuilt

Note: it will say tar complains, just ignore them and watch tar die.

mv i586-mingw32msvc ../mingw32
cd ../mingw32
change_prefix.sh

Build VLC

Bootstrap

./bootstrap

Configure

mkdir win32
cd win32
sh ../extras/package/win32/configure.sh --host=i586-pc-mingw32msvc --disable-nls

If you want any custom options, like "--disable-lua" or anything of that nature, you can append them.

Make (compile)

PATH=/usr/win32/bin:$PATH make -j4

Notes:

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

Create self-contained packages

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

make package-win-common

(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).

make package-win32-base-debug

(This will create a subdirectory named vlc-x.x.x with all the binaries containing debug info usable by gdb).

Troubleshooting

See Win32CompileMSYSTroubleShooting.

Acknowledgements

This howto was re-created by Jean-Baptiste Kempf and updated in June 2009, September 2009, December 2009 and March 2010.

It was updated in June 2010 by Vicne with the help of J-b, gnosygnu and MichaelMc

It was updated in July 2012 by gnosygnu. Note that there are several new notes in Win32CompileMSYSTroubleShooting. These reflect problems that were encountered on gnosygnu's setup (Windows XP SP3). Refer to this forum thread for more information.

See also