Windows Build Setup w/ Ninja for LLDB

Hey all,

Can somebody tell me what I need to install on a fresh Window 8.1 x86_64 box to get an lldb windows build working?

Here is what I’ve tried so far:

  • VS 2013
  • ninja - sync from github, build 32-bit version. (The --x64 build option seems to always bring up an error dialog box in a VS 2013 64-bit window, so I use the x86 32-bit VS command prompt and build it as 32-bit. This might be part of my issue).
  • Initially I installed’s Python 2.7 64-bit. I later tried the 32-bit after hitting issues in the build process.
  • cmake I tried the same with 3.0.0 but backed off to to normalize with Zachary’s setup and avoid any issues that Reid may have seen with 3.0.0 recently.
  • Installed gnuwin32.

I sync llvm, llvm/tools/clang, and llvm/tools/lldb to the llvm, clang and lldb repos.

I ensure python is not in my path (i.e. ‘where python’ does not find anything). I do have gnuwin32/bin, cmake and ninja in my path.

I run:

mkdir build
cd build
cmake -GNinja …\llvm

I get an error after about 200 files in from trying to build that says:
Building lldb python wrapper
FAILED: cmd.exe /c cd /D D:\lldb\git\build\tools\lldb\scripts && env PYTHON_EXEC
UTABLE=C:/Python27/python.exe D:/lldb/git/llvm/tools/lldb/scripts/build-swig-wra D:/lldb/git/llvm/tools/lldb D:/lldb/git/build/tools/lldb/scripts
D:/lldb/git/build/tools/lldb/scripts D:/lldb/git/build -m && env PYTHON_EXECUTA
BLE=C:/Python27/python.exe D:/lldb/git/llvm/tools/lldb/scripts/finish-swig-wrapp D:/lldb/git/llvm/tools/lldb D:/lldb/git/build/tools/lldb/scripts D
:/lldb/git/build/tools/lldb/scripts D:/lldb/git/build -m
env: D:/lldb/git/llvm/tools/lldb/scripts/ Exec for
mat error

That version is with a 32-bit python. I get the same error with a 64-bit python installed in the same location.

I have tried disabling python:

delete the build dir
mkdir build
cd build
cmake -DLLDB_DISABLE_PYTHON=1 -GNinja …\llvm

Same error - it still detects the python (not in the path) and still uses it.

I’ve tried -DDISABLE_PYTHON=1 instead, that one just tells me that variable is not used.

So - I’m missing something basic here. I do not have cygwin in my path. I used msysgit to get the source.

Right now I would just settle for being able to disable python, even though we need that running at some point.

Thanks for any help!

Todd Fiala

Hi Todd,

You can build with Python successfully on Windows.
If you define both -DLLDB_DISABLE_PYTHON=0 and -D LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION=1, it should build properly.

You're right, it's currently broken for building without Python.
I just checked CMakelists.txt. An ifdef is missing, so you cannot build on Windows without Python for now.

I can't commit the fix now, can fix it when I'm back in office tomorrow or you can commit this to CMakeLists.txt.
--- CMakeLists.txt Thu Jul 3 22:55:07 2014
+++ CMakeLists.txt Thu Jul 3 22:57:26 2014
@@ -316,7 +316,9 @@

+ add_subdirectory(scripts)
+endif ()


Hi Deepak,

If you define both -DLLDB_DISABLE_PYTHON=0 and -D LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION=1, it should build properly.

Great, I’ll try that out.

I’ll also have a look at your patch and at least verify it works over here without Python.

This is getting me further. Here’s what I’ve changed:

  • added swig (from the swigwin exe download), added to my path.
  • added python to my path. There is a build failure without it due to what looks like usage of the python exe without using the cmake-discovered python (the c:\python27\python.exe is discovered by cmake without it being in the path). We’ll want to track that down.
  • Used the cmake command line that Deepak suggested:


That’s roughly 1200 of 2779 files in now. I’ll report back on what that does.

I’ll also try out Deepak’s patch to see if it works when using the default on Windows of not using Python.

When I’m done with this, I plan to update the web site on a valid lldb Windows build setup.


That’s roughly 1200 of 2779 files in now. I’ll report back on what that does.

So that setup did produce exes and ran through to completion. There were some linkage warnings throughout the build:

c:\python27\include\pymath.h(22) : warning C4273: ‘round’ : inconsistent dll lin

But lldb still ran, I could load an image (tried ‘image create c:/bin/ninja’, and it correctly told me it was an i386 image), and that’s about it.

For reference, it took just under 14 minutes to build on a 24 core Xeon running at roughly 3.8 GHz, using an OCZ RevoDrive X3 SSD raid and 48 GB of RAM.

Trying that non-Python config patch now.

Confirmed that with Deepak’s patch on my Windows 8.1 x86_64 setup, the following cmake configuration built with ninja:

cmake -GNinja …\llvm


This correctly built without python support. All those inconsistent linkage warnings also disappeared.


Yeah I think we’re going to want to get that patch in there since it fixes the default Windows build. I’m going to give it a run through Linux and FreeBSD tonight to make sure it doesn’t break them (the logic looks fine but I’d like to verify).