[Mesa-users] How I succeeded in building Mesa llvmpipe 64-bit on Windows
Tscharser at gmx.net
Mon Oct 29 09:20:02 PDT 2012
I successfully built llvmpipe on Windows with native Visual Studio 2008sp1, and wanted to share my experiences.
Most I did was 64-bit, however, it should work for 32-bit compile settings, also.
- Python 2.7 (32-bit)
- SCons 2.2
- MSYS, e.g. provided by MinGW. Including Flex & Bison. MSYS Console: "mingw-get install msys-flex msys-bison", and environment path modified respectively (e.g. "PATH=...;C:\MinGW\msys\1.0\bin;").
MESA 8.0.2 with LLVM 2.9
Start with LLVM:
- LLVM required patch source code a bit in prior: http://llvm.org/bugs/show_bug.cgi?id=9976 , and http://llvm.org/bugs/attachment.cgi?id=6634
- Use Cmake to configure, runtime libraries linked with /MT (statically)
- Define Install target in CMake and install binaries after build.
- Set install path on environment: "SET LLVM=C:\MyLLVMInstall"
- Visual Studio 64 Bit doesn't like DLL exports by DEF file AND by declspec. Modify include/gl.h around ~ line 56: # define GLAPI /*declspec(dllexport)*/
- Open Visual Studio x64 command prompt
- Invoke build by: c:\python27\scons.bat build=release llvm=yes platform=windows machine=x86_64 libgl-gdi
MESA 9.0 with LLVM 3.1
- Works quite the same way without having to patch LLVM.
MESA 8.0.5 with LLVM 2.9
- Got a compile error in shaderobj.c (~280), after defining the unsigned int in a different way, compile succeeds. However:
- DLL crashes after about 100 rendered frames all the time - don't know why.
I tried native MinGW
- I installed 64 bit from http://tdm-gcc.tdragon.net/download (experimental)
- I invoked build process by calling: c:\python27\scons.bat build=release llvm=yes platform=windows toolchain=mingw machine=x86_64 libgl-gdi
Result: Initially, SCons always tried to use the VC compiler, after setting all up on a different VM, I ended in the well-known "command line too long" problem (http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=883411)
I see no solution to this without having the Mesa Developers to take care of it in their built solution.
I tried cross-compile using Ubuntu
- different way to tell mesa the LLVM root, try: "export LLVM=/home/myLLVMInstall" or "export LLVM_ROOT=/home/myLLVMInstall"
- I got compile errors, maybe related to https://bugs.freedesktop.org/show_bug.cgi?id=44618
- So far no success in using the software rasterizer of mesa, DLL crashes on use
- OSMesa exports all symbols under windows - So far, I cannot use it along with llvmpipe.
- On all tested systems, CPU resources have not been exhausted properly by llvmpipe. However, performance much better compared to Microsoft software renderer.
- On some tested systems, performance was unequivocal slow. After disabling the LLVM threader (Env. var. LP_NUM_THREADS = 0), performance again was as expected with this setting.
- VS 2010 might also work, but VS 2012 struggles with compiler keywords.
Some links that might be helpful (not all emerged to be correct though):
Hope that helps.
More information about the mesa-users