Building on Windows - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Building on Windows

Personal tools

From LuxRender Wiki

Revision as of 00:22, 22 December 2012 by Omniflux (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


What you need:

  • TortoiseHG (or any Murcurial client)
  • MS Visual Studio 2008, 2010 (or Visual C++ Express Edition, note that the express edition cannot compile the 64-bit version without manually installing and configuring an additional Windows SDK)
  • other dependencies will be downloaded semi-automatically by the install directions

What to do:

Check out sources from the repository (anonymously using TortoiseHG)

  1. Make an empty folder (for example, LuxSource). This is the BASE directory.
  2. Right-click the folder and select TortoiseHG -> Create Clone
  3. Enter "" into the "source path" field, and put in BASE/lux into the destination (where BASE is the base directory)
  4. Click "clone"
  5. Wait for the module to download
  6. Similarly check out the "windows" module into the BASE folder, using "" as the source path (set destination to BASE/windows/)
  7. Similarly check out the "luxrays" module into the BASE folder, using "" as the source path (set destination to BASE/luxrays/)

Build instructions (Semi-Automatic)

  1. Start the Visual Studio Command Prompt (located on the Start Menu)
    1. For 64bit you must use the 64bit Visual Studio Command Prompt
    2. Conversely, use the 32bit Visual Studio Command Prompt if you're building luxrender for 32 bit platforms (technically, this is only required when building certain dependencies, but there's no reason to change command prompts mid build).
  2. Navigate to the "windows" directory, then run getdeps.bat. This will download the required libraries for both the 32-bit and 64-bit builds.
  3. Run the appropriate build batch file (build-x64.bat for 64-bit builds, or build-x86.bat for 32-bit builds).
  4. If this is your first time building, build the dependencies. Follow the instructions as prompted by the build script. See the notes for tips when running the build script.
  5. When it's done, the build should be found inside the Dist directory (either inside the 32 or 64 folder, depending on 32 or 64 bits).


  1. LuxRender currently requires 1.47 ( or higher*) boost libraries. Other versions either haven't been tested, or are known to have bugs which will break LuxRender.
  2. There will be some errors when building the dependencies, as well as hundreds of warnings. As long as luxrender's build succeeds, it's ok to have errors/warnings
  3. Building the Qt libraries will take a very long time. If you're building the dependencies, wait for the install script to ask you to accept the license agreement, then go do something for the new few hours. The rest of the install script should be automated.
  4. This is current as of August 23, 2010. If you are unable to build luxrender, please see the Compilation and Portability Forum for any "quick-fixes". If you know it's a bug with the luxrender program, please submit a bug report.
  5. If you don't want to build lux and just want to test it (or use the latest build), you can usually find weekly builds for various platforms/configurations in the Weekly Builds Forum.
  6. Sometimes luxrender repository is busy, that could cause errors when creating a clone. Thanks to dougal2, a mirror has been created : try this one if you're getting errors like "transaction abort!" warning : The mirror has a 2 hour delay with the original repository
  • to assure networking across builds boost 1.47 is mandatory for lux 1.x !!!

VS Express 2008

This is how to configure VS Express 2008 to build x64 binaries on Windows 7 64bit:

Install Visual Studio Express

Fix build environment batch files

  • Fix the following files:
    • C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat
      • globally replace %~dp0bin\amd64\vcvarsamd64.bat with %~dp0bin\vcvars64.bat
      • globally replace %~dp0bin\x86_amd64\vcvarsx86_amd64.bat with %~dp0bin\vcvarsx86_amd64.bat
    • C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat
      • the 3rd line should read:
      • @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework
      • the 4th line should read:
      • @SET FrameworkVersion=v3.5
    • C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat
      • the 3rd line should read:
      • @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework64
      • the 4th line should read:
      • @SET FrameworkVersion=v3.5

Create 64 bit build environment link

  • Create a shortcut for the 64bit build environment using the following settings
    • Target: %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x64
    • Start In: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\"
    • Comment: Open Visual Studio 2008 Command Prompt (x64)
    • Name it "Visual Studio 2008 Command Prompt (x64)" (without the quotes) and place it in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual C++ 2008 Express Edition\Visual Studio Tools" (must be admin)
You must run the build batch file from within the command prompt that this shortcut opens.

You should now be able to build x64 binaries using both the command line tools, and be able to configure x64 targets using the VS IDE.

Visual Studio 2010

Visual Studio 2010 (and 2012) have a regression from Visual Studio 2008. To correct this regression, you will need to update the XML file [Program Files]\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets as follows:

Look for the CustomBuild task definition:

<Target Name="CustomBuild"
        Condition="'@(CustomBuild)' != ''"

Insert the following as the first child of this element:

<_ExpandedAdditionalInputs Include="%(CustomBuild.AdditionalInputs)"/>
<_ExpandedOutputs Include="%(CustomBuild.Outputs)"/>