Building VLC with Python bindings for Windows

This page describes how to cross-compile vlc for Windows on Debian. See also BrowserPlugin.

Cross-compiling with mingw32 is the preferred method for building vlc for Windows.

Look also here: http://wiki.videolan.org/Win32Compile

Building version 0.8.6a

Prerequisites

  • The 0.8.6a sources: The original sources can be found here http://download.videolan.org/pub/videolan/vlc/0.8.6a/, and the modified version by Ivaylo here http://www.st.ewi.tudelft.nl/~ivaylo/files/vlc/ (to be added)
  • mingw32: On Debian you need to install the mingw32 package.
  • pre-built libraries: You can get them here http://downloads.videolan.org/pub/videolan/testing/win32/. For our build we use contrib-20070530-win32-bin-gcc-3.4.5-only.tar.bz2. Extract the archive in / with
    cd /; tar -xjf contrib-20070530-win32-bin-gcc-3.4.5-only.tar.bz2
    
    
  • Python 2.4 sources prepared for win32, and python24.dll: Extract the dll and the Python sources in the same directory you have the vlc-0.8.6a sources directory. Then, configure the Python sources with:
    ./configure --host=mingw32 --with-gcc=i586-mingw32msvc-gcc  --with-cxx=i586-mingw32msvc-g++ --enable-shared
    
    
  • For making packages and zip archives (see below) you need to install the tofrodos and zip packages.

Configuring

Before building, vlc has to be configured:

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

   --enable-mediacontrol-python-bindings 

   --disable-cddax --disable-vcdx --enable-goom 

   --enable-twolame --enable-dvdread 

   --enable-debug

Compiling

Do a make. It will result in many errors that you can solve with the help of the list below:

  • on mediacontrol compile errors use a line with compiler changed to i586-mingw32msvc-g++
  • on vlc/modules/audio_filter/converter error mentioning "dca_something" errors use a line with "-ldca" added
  • on modules/codec/flac.c errors: replace flac.c with the latest flac.c and replace some of the include lines (those 2 after decoder.h that give the error)
  • on ntohl errors in libFLAC: add -lwsock32 to the compile line
  • on twolame errors: define LIBTWOLAME_STATIC before including twolame header in modules/codec/twolame.c
  • on a52 errors: add -la52 to the last compile line
  • for python bindings use the following script:
    i586-mingw32msvc-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC 
    
      -I../.. -I./../../include -I/usr/win32/include -I../../../Python-2.4.2 -I../../../Python-2.4.2/Include 
    
      -c ./vlcglue.c -o ../../bindings/mediacontrol-python/./vlcglue.o -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 
    
      -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE 
    
      -DLOCALEDIR="d:\projects\tribler\video\vlc-0.8.6a\locale" 
    
      -DDATA_PATH="d:\projects\tribler\video\vlc-0.8.6a" 
    
      -DPLUGIN_PATH="d:\projects\tribler\video\vlc-0.8.6a\plugins" -DDEBUG -O3 -ffast-math -funroll-loops 
    
      -mtune=pentium2 -g
    
    i586-mingw32msvc-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC 
    
      -I../.. -I./../../include -I/usr/win32/include -I../../../Python-2.4.2 -I../../../Python-2.4.2/Include 
    
      -c ./../../src/control/mediacontrol_init.c 
    
      -o ../../bindings/mediacontrol-python/./../../src/control/mediacontrol_init.o -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 
    
      -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLOCALEDIR="/usr/local/share/locale" 
    
      -DDATA_PATH="/usr/local/share/vlc" -DPLUGIN_PATH="/usr/local/lib/vlc" -DDEBUG -O3 -ffast-math -funroll-loops -mtune=pentium2 -g
    
    i586-mingw32msvc-g++  -Wsign-compare -Wall -mms-bitfields -pipe -shared 
    
      ../../bindings/mediacontrol-python/./vlcglue.o ../../bindings/mediacontrol-python/./../../src/control/mediacontrol_init.o 
    
      ../../src/libvlc.a ../../../python24.dll -o ../../bindings/mediacontrol-python/lib.linux-x86_64-2.4/vlc.so 
    
      -L../.. ../../modules/misc/memcpy/libmemcpymmx.a ../../modules/video_chroma/libi420_rgb_mmx.a 
    
      ../../modules/video_chroma/libi422_yuy2_mmx.a ../../modules/video_chroma/libi420_ymga_mmx.a 
    
      ../../modules/video_chroma/libi420_yuy2_mmx.a ../../modules/misc/memcpy/libmemcpymmxext.a 
    
      ../../modules/misc/memcpy/libmemcpy3dn.a ../../modules/demux/liblive555.a ../../modules/mux/mpeg/libmux_ts.a 
    
      ../../modules/codec/ffmpeg/libffmpeg.a ../../modules/stream_out/libstream_out_switcher.a 
    
      -L/usr/lib/python2.4 -g -Wl,--exclude-libs,libunicows.a -lunicows -lkernel32 -L/usr/win32/lib -liconv 
    
      /usr/win32/lib/libintl.a /usr/win32/lib/libiconv.a -lws2_32 -lnetapi32 -lwinmm -mwindows -L/usr/win32/lib 
    
      -L/usr/win32/live.com/UsageEnvironment -lUsageEnvironment -L/usr/win32/live.com/groupsock -lgroupsock 
    
      -L/usr/win32/live.com/BasicUsageEnvironment -lBasicUsageEnvironment -L/usr/win32/live.com/liveMedia -lliveMedia -lws2_32 
    
      -ldvbpsi -lavformat -lz -lpostproc -lavcodec -lavutil -lz -lfaac -lmp3lame -lfaad -lx264 -lole32 -loleaut32 -luuid -lstrmiids -la52
    
    cp lib.linux-x86_64-2.4/vlc.so vlc.dll
    
    
  • put -la52 in vlc-config next to -lavcodec (see if it solves 8)

Now you can do make package-win32-zip to get all the needed vlc stuff into a zip archive.

Installing

(to be finished)

Building version 0.8.6d

(To be done)