Win32CompileMSYSNew
Contents
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, September 2009, December 2009 and March 2010
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 alltogether. You can set File - Line endings - Default to "Unix (LF)", but it always saves opened files in the ending style they have.
Install MinGW
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
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.17
- w32api-3.14
- binutils-2.18
- gcc-core-3.4.5
- gcc-g++-3.4.5
- mingw32-make-3.81
Update Mingw GCC to 4.4.0
Use GCC 4.4.0, with http://sourceforge.net/projects/mingw/files/GCC%20Version%204/Current%20Release_%20gcc-4.4.0/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).
- 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.
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.
ALTERNATIVE for above installation: Install TDM MinGW 4.4.1
The above setup may produce build errors like "undefined reference to `__Unwind_SjLj_Register'" when compiling vlc. That is because the above 4.4.0 build uses DW2(Dwarf-2) unwinding.
You need a MinGW build of SJLJ unwinding.
An easy installer is offered on Twilight Dragon Media: (Thanks to MichaelMc)
- Use text editor to change MinGW\lib\gcc\mingw32\4.4.1\libstdc++.la file (line should be
library_names=''
) due to bug in latest MinGW.
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
- Install 7-zip and Mozilla Firefox
- 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
Accept Post Install: [y] MinGW Installed? : [y] path to MinGW: [c:/MinGW]
- Install MSys Developer Tooltkit: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe
AutoTools in MSYS
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
- 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%20libtool/libtool-2.2.7a-1/libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma/download
You can also compile them according to:
- 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
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:
- 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"
Install libgcrypt in MSys
http://prdownloads.sourceforge.net/mingw/libcrypt-1.1_1-2-msys-1.0.11-dll-0.tar.lzma
Install other tools in Mingw
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.
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\1.0 .
Get PKG-CONFIG from GNOME: ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip and ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.23-3_win32.zip Unzip them to C:\Msys\1.0 .
Install LUA tools
vlc uses the LUA scripting language (See lua.org).
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 $ make mingw
This should produce lua.exe, luac.exe and lua51.dll in the src directory. Put these in your /bin
$ cd src $ cp *.exe /bin $ cp *.dll /bin
--Belbear 12:58, 7 April 2010 (UTC)
Install Git and checkout VLC
See Git_Windows.
You can also retrieve the source code from VideoLAN Project: VLC media player source code
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
rm isn't needed with some contrib packages, because they don't contain those files.
Bootstrap VLC
cd 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 /
- 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
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.
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])