Building Thrift D on Windows

klickverbot edited this page Mar 27, 2012 · 7 revisions

The D library itself does not require any extra configuration and can be built using DMD without any tooling support. However, to conveniently build the Thrift compiler, the D libraries and the D test suite, you might want set up a MinGW environment:

  • Install DMD 2.058, make sure it is on the %PATH%.

  • Install MinGW (e.g. by using the graphical installer, needed: C++ compiler, MSYS Basic System, MinGW Development Toolkit)

  • The Thrift build system depends on pkg-config, so get the GLib "Run-time", gettext-runtime "Run-time" and pkg-config "Tool" and "Dev" packages from the GTK website and extract them to your MinGW directory.

  • Recommended: Install D headers and libraries for OpenSSL and libevent (see below).

  • Fetch the Thrift sources, i.e. d-gsoc branch from this very repository.

  • Initialize the build system by running ./ in the Thrift directory (from the MinGW prompt).

  • Run ./configure, possibly supplying the DMD_LIBEVENT_FLAGS and DMD_OPENSSL_FLAGS variables (see below). The »Building D library« line in the report at the end should say »yes«.

  • Build the Thrift compiler by running make CXXFLAGS=-DMINGW in the compiler/cpp directory.

  • Build the D Thrift library by running make in the lib/d directory.

You should now have a working build of the Thrift compiler and the Thrift D libraries. At this point, it is probably a good idea to run the test suite by issuing make check in the lib/d directory.

Installing libevent on Windows

Static linking of libraries is tricky on Windows due to obejct file format mismatch (COFF vs. OMF) and DMD not using Micosoft's C runtime, so the easiest way is to link in libevent as a DLL. To make this easier, I have set up a fork which includes __declspec(dllexport) annotations for the public API: You have two options:

Either, build the library yourself:

  • Fetch the latest source from GitHub.
  • Build the DLL, e.g. by running nmake /f Makefile.nmake libevent.dll from a Visual Studio command prompt.
  • Using COFFIMPLIB (download), convert the import library to OMF: coffimplib.exe libevent.lib libevent.omf.lib

Or, use the pre-built binaries from the Download section of my GitHub fork and install the DLL somewhere it can be found later.

Finally, you need the Deimos headers for libevent ( from GitHub. Just download them and put them somewhere on the DMD import search path.

When configureing Thrift later, set the DMD_LIBEVENT_FLAGS variable appropriately, e.g. DMD_LIBEVENT_FLAGS='C:\Devel\Tools\dmd\lib\libevent.omf.lib' ./configure.

Installing OpenSSL on Windows

First, install a DLL version of OpenSSL on your system, e.g. by using the »Win32 OpenSSL v1.0.0e« installer from (the »Light« version does not include the import libraries).

Then, create OMF import libraries for the OpenSSL DLLs using COFFIMPLIB (download):

coffimplib C:\OpenSSL-Win32\lib\ssleay32.lib ssleay32.omf.lib
coffimplib C:\OpenSSL-Win32\lib\libeay32.lib libeay32.omf.lib

Alternatively, you can download the libraries created by this procedure at GitHub.

Finally, fetch the Deimos headers for OpenSSL ( from GitHub and put them somewhere on the DMD import search path.

When configureing Thrift later, set the DMD_OPENSSL_FLAGS variable appropriately, e.g. DMD_OPENSSL_FLAGS='C:\Devel\Tools\dmd\lib\ssleay32.omf.lib C:\Devel\Tools\dmd\lib\libeay32.omf.lib' ./configure.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.