Install (MinGW)

From Open Babel
Revision as of 07:22, 1 April 2009 by Amaunz (Talk | contribs)

Jump to: navigation, search

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.

Date: March 31, 2009, Andreas Maunz. Tested with OB 2.1.1 on Windows Vista.


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:

        echo -I/home/libxml2-2.7.3.win32/include/libxml -I/home/libxml2-2.7.3.win32/include


        echo /c/Windows/System32/libxml2.dll -liconv -lm -Wl,-s -lwsock32 -liberty

Install current Msys and MinGW version.

Unpack OB source, start Msys and change to OB directory.

Build OB:

cd src/formats/inchi
cd ../../../tools

You may want to leave out boost and/or loading of dynamic modules: ./configure --without-boost --disable-dynamic-modules.

Edit the Makefile and exchange the following lines

babel_DEPENDENCIES = ../src/
babel_LDADD = ../src/


babel_DEPENDENCIES = ../src/ $(formats_objects)
babel_LDADD = ../src/ $(formats_objects)

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 as well as the DLL will be placed in /local/bin (C:\Msys\local\bin).

cd ..
make install

--Amaunz 07:18, 31 March 2009 (PDT)