Win32CompileMSYS

From VideoLAN Wiki
Revision as of 17:24, 25 October 2014 by SpeederC (talk | contribs) (Few adds after a test)
Jump to navigation Jump to search

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.

This howto ONLY works for VLC 2.1.x!

Advanced users only: If you want to make your own MSYS environment, please use Win32CompileMSYSNew. If you don't understand this message, it is best to ignore this.

Windows tools

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.

Prepare GNU on Windows

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/downloadhttp://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/tdm64-gcc-4.6.1.exe/download

Note: For a direct use with 32 bits computer, use the installer found at http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/tdm-gcc-4.6.1.exe/download

Go through the wizard:

  • Disable "Check for updated files on the TDM-GCC server"
  • Select "Create"
  • Install to C:\MinGW
  • Keep default settings

MSys

Use the MSys package found at http://people.videolan.org/~jb/msys/msys.7z

Un-7zip it to C:\MinGW\msys\.

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

Get VLC sources

Git

Clone the git repo

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

Get configuration tools

cd vlc/extras/tools
./bootstrap
make m4
make
export PATH=$PATH:$HOME/vlc/extras/tools/build/bin/

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

Note: Ragel compilation can fail with gcc 4.7, ignore it.
Note: If protobuf compilation fails, manually download https://github.com/google/protobuf/releases/download/v2.6.0/protobuf-2.6.0.tar.bz2, extract it to vlc\extras\tools\protobuf and comment $(UNPACK) and $(MOVE) for protobuf in vlc/extras/tools/tools.mak
Note: check that all is well with autoconf --version

Get precompiled 3rd party libraries

cd vlc/contrib
mkdir win32 && cd win32
../bootstrap --build=i686-w64-mingw32
make prebuilt
cd ..
ln -sf i686-w64-mingw32 mingw32
export PATH=$PATH:$HOME/vlc/contrib/mingw32/bin/
export PKG_CONFIG_PATH=$HOME/vlc/contrib/mingw32/lib/pkgconfig
rm $HOME/vlc/contrib/mingw32/bin/moc $HOME/vlc/contrib/mingw32/bin/uic $HOME/vlc/contrib/mingw32/bin/rcc $HOME/vlc/contrib/mingw32/bin/luac

Note: check that all is well with moc -v

Build VLC

Bootstrap

In VLC root folder, do:

./bootstrap

Configure

mkdir win32
cd win32
sh ../extras/package/win32/configure.sh --host=i686-w64-mingw32 --disable-nls

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

Make (compile)

make -j4

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.

Create 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-exe

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

This howto was re-re-created by Jean-Baptiste Kempf in September 2012.

See also