-
Notifications
You must be signed in to change notification settings - Fork 1
Building Thrift D on Windows
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 theGLib"Run-time",gettext-runtime"Run-time" andpkg-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-gsocbranch from this very repository. -
Initialize the build system by running
./bootstrap.shin the Thrift directory (from the MinGW prompt). -
Run
./configure, possibly supplying theDMD_LIBEVENT_FLAGSandDMD_OPENSSL_FLAGSvariables (see below). The »Building D library« line in the report at the end should say »yes«. -
Build the Thrift compiler by running
make CXXFLAGS=-DMINGWin thecompiler/cppdirectory. -
Build the D Thrift library by running
makein 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.
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: https://github.com/klickverbot/libevent. 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.dllfrom 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 (https://github.com/D-Programming-Deimos/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.
First, install a DLL version of OpenSSL on your system, e.g. by using the »Win32 OpenSSL v1.0.0e« installer from http://www.slproweb.com/products/Win32OpenSSL.html (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 (https://github.com/D-Programming-Deimos/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.