Install (MinGW)

This document contains instructions for building OpenBabel (OB) on Windows with MinGW. The resulting DLL (libopenbabel-3.dll) may be linked directly from Windows applications compiled with MinGW, so there is no need to deal with (import) libraries created with Microsoft Visual C++. This is especially useful if your existing software uses a GNU make based build system. Binaries created with MinGW are native and do not need an emulation layer, such as Cygwin.

Preliminaries:

OpenBabel requires libxml2 so make sure you have this library properly installed in your MinGW environment; libxml can be found here. Specifically, this requires you to edit the xml2-config script. I recommend you directly link a test application against libxml2.dll and insert the respective -I and -L flags into xml2-config. The relevant section of mine looks like this:

Update to the latest version of g++ for MinGW (g++-sjlj, see also the release notes). Unpack gcc-g++-4.2.1-sjlj-2.tar.gz and gcc-core-4.2.1-sjlj-2.tar.gz in your MinGW root directory, unpack OB source, start Msys and change to OB directory.

Repeat the editing for the rest of the executables if you need more than babel.exe. Then continue to build and install OB. The tools will be as well as the DLL will be placed in /local/bin (C:\Msys\local\bin).