6

I went through all the steps on the compiling / installing page on Mesa's site, and read the FAQ. The final command that you send to scons for compilation throws errors within python scripts. This is my output. What am I doing wrong? Also if anyone has compiled dll's for mesa using up to date mesa and mingw, or VS2012, then please share!

Here is my output, I haven't programmed python in a long time but it appears a map/dictionary doesn't contain the key/value pair.

C:\Downloads\MesaLib-9.1.5\Mesa-9.1.5>scons platform=windows toolchain=crossming
w machine=x86_64 mesagdi libgl-gdi

scons: Reading SConscript files ...
KeyError: 'CCVERSION':
  File "C:\Downloads\MesaLib-9.1.5\Mesa-9.1.5\SConstruct", line 40:
    ENV = os.environ,
  File "C:\Python27\scons-2.3.0\SCons\Environment.py", line 1002:
    apply_tools(self, tools, toolpath)
  File "C:\Python27\scons-2.3.0\SCons\Environment.py", line 106:
    env.Tool(tool)
  File "C:\Python27\scons-2.3.0\SCons\Environment.py", line 1786:
    tool(self)
  File "C:\Python27\scons-2.3.0\SCons\Tool\__init__.py", line 183:
    self.generate(env, *args, **kw)
  File "C:\Downloads\MesaLib-9.1.5\Mesa-9.1.5\scons\gallium.py", line 313:
    ccversion = env['CCVERSION']
  File "C:\Python27\scons-2.3.0\SCons\Environment.py", line 412:
    return self._dict[key]
EddieV223
  • 5,085
  • 11
  • 36
  • 38
  • You're going to have to do better than that if you want an answer. Just saying "I went through a FAQ and it didn't work" isn't enough to answer anything. You didn't even bother to link to the FAQ in question, let alone tell us exactly what you did. – Nicol Bolas Jul 26 '13 at 03:18
  • Never could get MinGW to build workable Mesa binaries. Haven't tried recently though. What are you trying to cross-compile to? Win64 from Win32? – genpfault Jul 26 '13 at 04:34
  • Not trying to cross compile, just want to build openGL on this platform. The reason toolchain=crossmingw is because thats what the instructions said to do. I followed the instructions on the compiling/installing page of mesa's site. I followed each step, and every step was a success, except the last step which is a scons command to compile, I'm not sure what you expect me to tell you about that, the steps are listed on the page. What I ment by the FAQ was the FAQ page on mesa's site. There wasn't much on the FAQ that was relevant, I just wanted to point out that I did in fact read it. – EddieV223 Jul 26 '13 at 04:48
  • @genpfault did you get it compiled with Visual studio? – EddieV223 Jul 26 '13 at 04:57
  • @EddieV223: I did. See answer. – genpfault Jul 29 '13 at 07:07

1 Answers1

17

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.

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 2
    Applying the `ralloc.c` fix and your 10 steps (exactly), I was able to successfully compile `Mesa-9.1.5`. Thanks. :D – Mr. Smith Sep 21 '13 at 17:54
  • 2
    Since 64 bit Windows 7 is very common today (in year 2014), if you want to build a 64-bit opengl32.dll on 64bit Windows 7, specify machine=x86_64. PS: it is 64bit age now, it is surprising that we still have to work with command line often. It's something like leading a primitive life in modern society. I'm not clear if it is a good thing. – user2384994 May 20 '14 at 05:58