Building Mesa for windows 7. Mesa 9.1

Common scons options:

build=release
machine=x86
platform=windows
libgl-gdi
  1. Linux (Debian Wheezy), toolchain=crossmingw: Fails during linking phase because it can’t find __vscprintf, among other things. Works as of Debian Jessie 8.5 & Mesa d2f42a945ec0fbcc51b59cfd329258bd62ebf0d2 via:

    scons \
    toolchain=crossmingw \
    build=release \
    machine=x86 \
    platform=windows \
    libgl-gdi
    

    DLL is installed to build/windows-x86/gallium/targets/libgl-gdi/opengl32.dll

  2. Windows, toolchain=mingw: Fails with “The command line is too long.” despite multiple permutations of both snippits on LongCmdLinesOnWin32.

  3. Windows, VS2012 Express, MSVC_VERSION=11.0: Succeeds after removing stray C99-isms from src/glsl/ralloc.c::ralloc_size().


EDIT: More complete procedure:

  1. Install Visual Studio Express 2012 for Windows Desktop:

    http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop
    
  2. Install MinGW:

    http://www.mingw.org/
    http://sourceforge.net/projects/mingw/files/
    http://sourceforge.net/projects/mingw/files/latest/download?source=files
    mingw-get-inst-20120426.exe
    
    Run installer:
    Download latest repo catalogs
    Install to C:\MinGW (default)
    Check:
    * C compiler
    * C++ compiler
    * MSYS basic system
    * MinGW developer toolkit (should install msys-flex and msys-bison)
    
  3. Install Python 2.7:

    http://www.python.org/download/
    http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi
    
    You have to use 32-bit Python because the Scons people only distribute 32-bit installers.
    
    Install for all users (default)
    Install to C:\Python27 (default)
    Use default install options/customizations
    
  4. Install libxml2 for Python:

    http://www.lfd.uci.edu/~gohlke/pythonlibs/
    libxml2-python-2.9.1.win32-py2.7.‌exe
    
    Installer should find the python install automagically
    
  5. Install pywin32:

    http://pywin32.sourceforge.net/
    http://sourceforge.net/projects/pywin32/files/pywin32/
    http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/
    http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe
    
    Installer should find the Python install automagically
    
  6. Install Scons:

    http://www.scons.org/
    http://prdownloads.sourceforge.net/scons/scons-2.3.0-setup.exe
    
    Installer should find the Python install automagically
    
  7. Add these near the top of your PATH:

    C:\Python27\
    C:\Python27\Scripts
    
  8. Download Mesa:

    ftp://ftp.freedesktop.org/pub/mesa/
    ftp://ftp.freedesktop.org/pub/mesa/9.1.5/MesaLib-9.1.5.zip
    
    Extract somewhere (C:\Mesa-9.1.5)
    
  9. Start MSYS shell:

    C:\mingw\msys\1.0\msys.bat
    
    Change into mesa src directory:
    cd /c/Mesa-9.1.5/
    
  10. Build Mesa:

    scons.py \
    build=release \
    machine=x86 \
    platform=windows \
    MSVC_VERSION=11.0 \
    libgl-gdi \
    

This should create an opengl32.dll in build\windows-x86\gallium\targets\libgl-gdi.

With a little bit more legwork it’s possible to build llvmpipe.

Leave a Comment