Using MingW to build VLC from the source

Submitted by yuz on Mon, 2006-04-10 21:46.

Finally I've successfully built VLC on WinXP! This whole build process is not as easy as I expected. So now I'm documenting the whole process here in case I forget it in the future.

In the last few days I've been researching a cross-platform DVD player alternative to replace my own YZDVD, which is Win32 only. Between Mplayer and VLC, I choose VLC to play with because I like its modular extensible architecture.

Now, why do I pick MingW over CygWin? Because I hate to make too many choices in a short period of time:-) CygWin is huge with so many packages! No, this is not a rational reason, in fact, I will be trying CygWin pretty soon.

First, install MSYS+MingW environment.

  1. uncheck the "TAR file smart CR/LF conversion" checkbox found in the WinZip Configuration -> Miscellaneous tab of the Options menu.
  2. install MSYS-1.0.10.exe to c:\msys\1.0
  3. unzip mingw-runtime-3.9.tar.gz to c:\msys\1.0\mingw
  4. unzip w32api-3.6.tar.gz to c:\msys\1.0\mingw
  5. unzip binutils-2.15.91-20040904-1.tar.gz to c:\msys\1.0\mingw
  6. unzip gcc-core-3.4.2-20040916-1.tar.gz to c:\msys\1.0\mingw
  7. unzip gcc-g++-3.4.2-20040916-1.tar.gz to c:\msys\1.0\mingw
  8. unzip mingw-utils-0.3.tar.gz to c:\msys\1.0\mingw
  9. install msysDTK-1.0.1.exe to c:\msys\1.0
  10. install gdb-5.2.1-1.exe to c:\msys\1.0
  11. install gettext-0.10.40-20011107.zip to c:\msys\1.0\local
  12. set up environment variable HOME pointing to c:\home

Second, download VLC source vlc-snapshot-20060410.tar.gz, unzip it to c:\home.

Third, download contrib-20060330-win32-bin-gcc-3.4.5-only.tar.bz2 from http://download.videolan.org/pub/, extract it in your root directory with the following command:

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

Fourth, build VLC source, enter directory vlc-0.8.5-test2

  1. run ./bootstrap
  2. edit configure, go to line 29960, comment out PKG_PROG_PKG_CONFIG(), save.
  3. create a script named "config", save it with these lines:
    #! /bin/sh
    PKG_CONFIG_PATH=/usr/win32/lib/pkgconfig \
    CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml -I/usr/local/include" \
    LDFLAGS="-L/usr/win32/lib -L/usr/local/lib" \
    ./configure \
    --disable-gtk \
    --disable-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 --disable-hal \
    --enable-debug

  4. run ./config
  5. edit vlc-0.8.5-test2/src/misc/charset.c file, insert "#include 'locale.h'" at line 47, save it.
  6. run make in directory vlc-0.8.5-test2. wait half hour and you will see vlc.exe is created in vlc-0.8.5-test2/
  7. open Makefile in vlc-0.8.5-test2/, comment out lines from 1629 to 1631. modify line 1667, 1668, change "sed -i" to "sed -e".
  8. run make package-win32-base, this creates a sub directory for installation packaging.

I believe some of the manual modifications above won't be necessary if I do the build in a CygWin environment. I will find out pretty soon.

thanX !

After 2 days strugling with de cygwin build, I decided to give MSYS a try, mainly because I found this post :-)
I'm very excited cause I could build my own VLC version in less than an hour !!! ...more over: I could even recompile the latest (or so...) liveMedia library with MSYS, and get it linked with VLC... wow!
Just a couple of things,
1) For the real newbie I think it could help to point out in which "step" did you "open" de MSYS console. I did about "third", because I wanted to execute the tar command just as it looks there.
2) A very stupid question (maybe): what is the HOME environment variable for ? I mean, I defined it at the Windows level, but it isn't "visible" inside the MSYS console. So I guessed it might be used to locate any of the executables invoked during the build. Is it used by "configure" ? by "make" ? the gcc compiler ?
Thanks a lot for any answer.
Diego

HOME environment variable

I'm glad my post is helpful.

HOME defines the default login MSYS directory, the directory you are in when you first start the MSYS console. If you type "ls" in the MSYS console, you will find out all the contents listed are actually from the directory defined in HOME.

It's not used to locate execuatbles, it's purely used for organizing downloaded files. It acts as the user home directory of UNIX/LINUX environment. It's not used by "configure" or "make" or "gcc". These commands do their jobs inside unzipped source directory "vlc-0.8.5-test2" in a relative way.