Win32CompileMSYSNew

From VideoLAN Wiki
Revision as of 01:19, 28 December 2009 by TypX (talk | contribs) (→‎PKG-CONFIG)
Jump to navigation Jump to search

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.

This howto was re-created by Jean-Baptiste Kempf and updated in June 2009.


Install MinGW

Use the main installer 5.1.4 found at http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.4/MinGW-5.1.4.exe/download

Go through the wizard, selecting "Downloading and Install" and using the candidate release. Select gcc, g++ and MinGW make. It should download automatically:

  • mingwrt-3.15
  • w32api-3.12
  • binutils-2.18
  • gcc-core-3.4.5
  • gcc-g++-3.4.5
  • mingw32-make-3.81

Notes from December 2009

Currently the MinGW installer adds mingwrt-3.17 which is not compatible with the precompiled contribs mentioned below. You should manually download and install 3.15 found at http://sourceforge.net/projects/mingw/files/MinGW%20Runtime/mingwrt-3.15.2/mingwrt-3.15.2-mingw32-dev.tar.gz/download

The precompiled contribs also require gcc 4.2.1 found at http://sourceforge.net/projects/mingw/files/GCC%20Version%204/Previous%20Testing_%20gcc-4.2.1-sjlj%20-2/gcc-core-4.2.1-sjlj-2.tar.gz/download http://sourceforge.net/projects/mingw/files/GCC%20Version%204/Previous%20Testing_%20gcc-4.2.1-sjlj%20-2/gcc-g%2B%2B-4.2.1-sjlj-2.tar.gz/download

After downloading and unpacking those two files you can switch MinGW to use the new version with

mv /mingw/bin/c++.exe /mingw/bin/c++.345.exe
mv /mingw/bin/g++.exe /mingw/bin/g++.345.exe
mv /mingw/bin/g++-sjlj.exe /mingw/bin/g++.exe
mv /mingw/bin/g++-sjlj.exe /mingw/bin/c++.exe

It also needs http://sourceforge.net/projects/mingw/files/GCC%20Version%204/Current%20Release_%20gcc-4.4.0/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

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

AutoTools

Update your autoconf, automake and libtool by downloading and installing them, keeping in mind that you need to extract the content of the usr folder in C:\Msys

You can also compile them according to:


Install other tools

http://prdownloads.sourceforge.net/mingw/libcrypt-1.1_1-2-msys-1.0.11-dll-0.tar.lzma

Installing mingw-utils is recommended: http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz, extract it to mingw/bin.

Installation of wget too: http://prdownloads.sourceforge.net/mingw/wget-1.9.1-mingwPORT.tar.bz2

Although this is a mingwPORT package it already has a precompiled wget on board. Extract the .tar.bz2 file. It contains wget.exe in the bin subfolder, extract it to mingw/bin.

Install Git and checkout VLC

See Git_Windows.

You can also retrieve the source code from VideoLAN Project: VLC media player source code

PKG-CONFIG

pkg-config is a mess, this is not NEWS... And you cannot compile it from Windows because of a few bugs...

Get Glib from GNOME: http://ftp.gnome.org/pub/GNOME/binaries/win32/glib/2.18/glib_2.18.2-1_win32.zip Unzip it to C:\Msys.

Get PKG-CONFIG from GNOME: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.23-3_win32.zip Unzip it to C:\Msys.

Contribs

Take the precompiled contribs from:

http://people.videolan.org/~jb/Contribs/

Copy them in your ~

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


Bootstrap VLC

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

It should warn about gettext... Just ignore.


Configure

sh extras/package/win32/configure-msys.sh
  • If you downloaded a VLC source code tarball, retrieve configure-msys.sh and configure-common.sh from [vlc.git] / extras / package / win32 /


Compile

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

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

Once the compilation is done, build self-contained VLC packages with 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).

  • If you have permissions problems running make package-*, chmod 777 -R the vlc folder.
  • 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.