Difference between revisions of "Win32Compile"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 14: Line 14:
 
==Building VLC from the source code==
 
==Building VLC from the source code==
  
If you want to build VLC from sources, you can do it in several ways:
+
If you want to build VLC from source, you have several choices:
  
* on GNU/Linux, using the mingw32 cross-compiler. ''NOTE: This is the PREFERRED way of cross-compiling VLC.''
+
{| class="wikitable"
 
+
! Method
* natively on Windows, using cygwin (www.cygwin.com) with or without the POSIX emulation layer. This is the preferred way to compile vlc if you want to do it on Windows. NOTE: This is the PREFERRED way of building VLC natively (the others are not as much tested so expect more difficulties with them).
+
! Documentation
Read [[Win32CompileCygwin|How to build VLC with Cygwin]] to have more information.
+
! Notes
 
+
|-
* natively on Windows, using MSYS+MINGW (www.mingw.org) (MSYS is a minimal build environment to compile Unixish projects under windoze. It provides all the common Unix tools like sh, gmake...) Please note that the gettext utilities are not included in the default MSYS/MINGW packages so you won't be able to build VLC with i18n support.
+
| Cross-compile with mingw32 on GNU/Linux
Read [[Win32CompileMSYS|How to build VLC with MSYS]] to have more information.
+
| None
 
+
| '''Preferred''' cross-compilation method
* or natively on Windows, using Microsoft Visual C++. This is not adviced AT ALL. Even though we provide some msvc project files with vlc, this method is advised only if you just want to experiment/play with some basic functionality in vlc. The reason for this is that vlc depends on a lot of 3rd party libraries and building them in MSVC is not convenient and sometimes even impossible. ( NOTE: if you want to run vlc under the msvc debugger, you need to run it with the --fast-mutex --win9x-cv-method=1 options because the debugger usually loses signals sent by PulseEvent() )
+
|-
 +
| Native-compile with [http://www.cygwin.com Cygwin]
 +
| [[Win32CompileCygwin]]
 +
| '''Preferred''' native compilation method
 +
|-
 +
| Native-compile with [http://www.mingw.org MSYS+MINGW]
 +
| [[Win32CompileMSYS]]
 +
| MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows. It provides all the commonly-required Unix tools (like sh, gmake, and so forth). Please note that the gettext utilities are not included in the default MSYS/MINGW packages so you won't be able to build VLC with i18n support.
 +
|-
 +
| Native-compile with Microsoft Visual C++
 +
| None
 +
|
 +
'''Not advised.''' <P>
 +
Even though VLC includes some MSVC project files, this method is advised only if you just want to experiment/play with some basic functionality in VLC. VLC depends on a lot of third-party libraries and building them in MSVC is inconvenient (and in some cases, impossible). <BR>
 +
If you want to run VLC under the MSVC debugger, use <PRE>--fast-mutex --win9x-cv-method=1</PRE> because the debugger usually loses signals sent by PulseEvent().
 +
|}
  
 
==Getting the right compiler tools==
 
==Getting the right compiler tools==

Revision as of 16:31, 9 March 2007

From http://developers.videolan.org/vlc/vlc/INSTALL.win32

$Id: INSTALL.win32 15707 2006-05-22 09:42:08Z xtophe $
INSTALL file for the Windows9x/Me/NT4/2k/XP version of the VLC media player

Running VLC with debug

If you have already built VLC (see below) or are using a binary release, just run 'vlc.exe'.

You can also run VLC from a dos command box, in which case you'll be able to use the command line arguments. You can obtain a list of these command line arguments by typing 'vlc --help' or 'vlc --help --advanced'.

To store a debug log of the current VLC session, you can use 'vlc -vv --extraintf=logger'. You will end-up with a vlc-log.txt file in your current directory.

Building VLC from the source code

If you want to build VLC from source, you have several choices:

Method Documentation Notes
Cross-compile with mingw32 on GNU/Linux None Preferred cross-compilation method
Native-compile with Cygwin Win32CompileCygwin Preferred native compilation method
Native-compile with MSYS+MINGW Win32CompileMSYS MSYS is a minimal build environment to compile Unixish projects under Microsoft Windows. It provides all the commonly-required Unix tools (like sh, gmake, and so forth). Please note that the gettext utilities are not included in the default MSYS/MINGW packages so you won't be able to build VLC with i18n support.
Native-compile with Microsoft Visual C++ None Not advised.

Even though VLC includes some MSVC project files, this method is advised only if you just want to experiment/play with some basic functionality in VLC. VLC depends on a lot of third-party libraries and building them in MSVC is inconvenient (and in some cases, impossible).
If you want to run VLC under the MSVC debugger, use

--fast-mutex --win9x-cv-method=1
because the debugger usually loses signals sent by PulseEvent().

Getting the right compiler tools

cross-compiling with mingw32
You first need to download a GNU/Linux cross-compiler version of mingw32.
For Debian GNU/Linux users, you can use the mingw32, mingw32-binutils and mingw32-runtime packages.
compiling natively on Windows with cygwin
You will need to download and run the setup.exe app from cygwin's web site (www.cygwin.com). You will also need to make sure you install at least the gcc-g++, gcc-mingw, mingw-runtime and win32-api packages.
compiling natively on Windows with MSYS+MINGW
You will need to download and install the latest MSYS, MSYS-DTK and MINGW. The installation is really easy. Begin with the MSYS auto-installer and once this is done, extract MINGW into c:\msys\1.0\mingw. You also have to remember to remove the make utility included with MINGW as it conflicts with the one from MSYS (just rename or remove c:\msys\1.0\mingw\bin\make.exe).

Getting the additional libraries

VLC depends on other libraries to provide some features like ac3 audio decoding or mpeg4 video decoding, etc...

Depending on your needs you will have to compile/install some or all of these external libraries.

They can be found here (source code):

http://download.videolan.org/pub/testing/contrib/

We also provide a package with all the libraries already compiled so it is actually really easy to compile a full-featured version of vlc (these compiled libraries will only work with mingw or cygwin):

http://download.videolan.org/pub/testing/win32/contrib-20061122-win32-bin-gcc-3.4.5-only.tar.bz2 (Check out for more recent versions at the same location). The gcc version mentioned (3.4.5 in this case) is that of i586-mingw32msvc-gcc, which you can verify by typing i586-mingw32msvc-gcc --ver.

All you need to do is extract it in your root directory (the include files and libraries will be put in /usr/win32). You can do this with the following command:

tar -xjvf contrib-20061122-win32-bin-gcc-3.4.5-only.tar.bz2 -C /

Please note the "-C /".

An automated way of building the contrib libraries is provided in extra/contrib. It will download, configure and build the libraries. See the extras/contrib/README for more info.

A complete list of the libraries on which we depend can be found here:

http://developers.videolan.org/vlc/

Configuring the build

Once you've got all the files you need in place, you need to configure the build with the `./configure' script.

I'll assume that you are using the pre-compiled 3rd party libraries I'm providing and that they are in /usr/win32.

If you are cross-compiling from Debian, you can use something along those lines:

 ./bootstrap && \
 PKG_CONFIG_LIBDIR=/usr/win32/lib/pkgconfig \
 CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml" \
 LDFLAGS=-L/usr/win32/lib \
 CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ \
 ./configure --host=i586-mingw32msvc --build=i386-linux \
     --disable-gtk \
     --enable-nls --enable-sdl --with-sdl-config-path=/usr/win32/bin \
     --enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
     --with-ffmpeg-zlib --enable-faad --enable-flac --enable-theora \
     --with-wx-config-path=/usr/win32/bin \
     --with-freetype-config-path=/usr/win32/bin \
     --with-fribidi-config-path=/usr/win32/bin \
     --enable-live555 --with-live555-tree=/usr/win32/live.com \
     --enable-caca --with-caca-config-path=/usr/win32/bin \
     --with-xml2-config-path=/usr/win32/bin \
     --with-dvdnav-config-path=/usr/win32/bin \
     --disable-cddax --disable-vcdx --enable-goom \
     --enable-twolame --enable-dvdread \
     --enable-debug

If you are using cygwin, you can build VLC with or without the POSIX emulation layer. Without is usually better and with POSIX emulation hasn't been tested in about a year or so. So to build without the emulation layer, use something like this:

 ./bootstrap && \
 PKG_CONFIG_PATH=/usr/win32/lib/pkgconfig \
 CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml" \
 LDFLAGS=-L/usr/win32/lib \
 CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \
 ./configure \
     --disable-gtk \
     --enable-nls --enable-sdl --with-sdl-config-path=/usr/win32/bin \
     --enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
     --with-ffmpeg-zlib --enable-faad --enable-flac --enable-theora \
     --with-wx-config-path=/usr/win32/bin \
     --with-freetype-config-path=/usr/win32/bin \
     --with-fribidi-config-path=/usr/win32/bin \
     --enable-live555 --with-live555-tree=/usr/win32/live.com \
     --enable-caca --with-caca-config-path=/usr/win32/bin \
     --with-xml2-config-path=/usr/win32/bin \
     --with-dvdnav-config-path=/usr/win32/bin \
     --disable-cddax --disable-vcdx --enable-goom \
     --enable-twolame --enable-dvdread \
     --enable-debug

If you want to use the emulation layer, then just omit the CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" line. You're on your own though.

If you are compiling with MSYS/MINGW, then you can use something along those lines:

 ./bootstrap && \
 PKG_CONFIG_PATH=/usr/win32/lib/pkgconfig \
 CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml" \
 LDFLAGS=-L/usr/win32/lib \
 ./configure \
     --disable-gtk \
     --enable-nls --enable-sdl --with-sdl-config-path=/usr/win32/bin \
     --enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
     --with-ffmpeg-zlib --enable-faad --enable-flac --enable-theora \
     --with-wx-config-path=/usr/win32/bin \
     --with-freetype-config-path=/usr/win32/bin \
     --with-fribidi-config-path=/usr/win32/bin \
     --enable-caca --with-caca-config-path=/usr/win32/bin \
     --with-xml2-config-path=/usr/win32/bin \
     --with-dvdnav-config-path=/usr/win32/bin \
     --disable-cddax --disable-vcdx --enable-goom \
     --enable-twolame --enable-dvdread \
     --disable-mkv \
     --enable-debug

If you have used the "extras/contrib" way, you don't need to precise the CFLAGS, LDFLAGS and --with-foo-config-path=.

./bootstrap && \
 ./configure \
     --disable-gtk \
     --enable-nls --enable-sdl \
     --enable-ffmpeg --enable-faad --enable-flac --enable-theora \
     --disable-cddax --disable-vcdx --enable-goom \
     --enable-twolame --enable-dvdread \
     --enable-mkv --enable-caca --enable-live555\
     --enable-debug


See `./configure --help' for more information.

Actually Compiling the VLC source

Once configured, to build VLC, just run `make'.

Once the compilation is done, you can either run VLC directly from the source tree or you can build self-contained VLC packages with the following 'make' rules:

make package-win32-base

will create a subdirectory named vlc-x.x.x with all the binaries 'stripped' (ie. 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.

Well done, now you're ready to use VLC!