development:build:compile-mingw
Building a GTK+ application on Win32 using MinGW (by example)
This is a step-by-step guide for building a GTK+ application on Win32 using Minimalist GNU for Windows (MinGW). I will do that by example, namely DFCGen (GTK+).
- Download MinGW from http://www.mingw.org and install it on your Win32 operating system (i installed
MinGW 20110802, using the associated installermingw-get-inst-20110802.exe).1) - Download an all-in-one GTK+ bundle from http://www.gtk.org/download/win32.php and extract the archive directly into the MinGW installation directory. Note: Be careful when overwriting files. I had some problems with
intl/gettext, because MinGW installedlibintlv1.2, but GTK wants to overwrite this with v1.1. - Start the MinGW shell (MSYS) and enter
gtk-demoto verify your installation. - Download additional tarball source packages (at this example GSL from http://www.gnu.org/software/gsl) and extract it into a directory anywhere.
- In MSYS shell change to that directory and do a package build:2)
./configure --prefix=/mingw; make; make install
- Extract the tarball distribution package, in this example
dfcgen-gtk-0.4.tar.gzto a directory, which is reachable by the MSYS shell. - In MSYS shell change to that directory and build the package (but do NOT a
make install):./configure; make
- Now some handy work comes into play:
- First create a new directory for gathering all Win32 installation files.
- Copy the generated executable
dfcgen-gtk.exeinto this directory and change to it. - Copy the following directories from MinGW into this “gathering” pool:
/mingw/etc→./etc/mingw/lib/gtk-2.0→./lib/gtk-2.0
-
data/filters→share/filtersdata/pixmaps→share/pixmapsdata/templates→share/templates
- Start
dfcgen-gtk.exefrom a DOS shell or from the file manager. This will produce an error, stating that a DLL is missing. Typically this is a DLL from the GTK+ package, which can be found anywhere under/mingw(probably in/mingw/bin). Copy the DLL also into the directory wheredfcgen-gtk.exenow resides. - Start
dfcgen-gtk.exeagain and repeat the procedure (until no error). - If you want another language than English (internationalization, i18n, locale, intl/gettext) copy also the following directories:
- from the MinGW installation:
/mingw/share/locale/de/LC_MESSAGES→./share/locale/de/LC_MESSAGES - from the
dfcgen-gtkbuild directory:po/de.gmo→./share/locale/de/LC_MESSAGES/dfcgen-gtk.mo(file renamed).
- Copy the “gathering” directory to your final Win32 installation directory, e.g.
C:\programs\dfcgen-gtk. You can startdfcgen-gtk.exedirectly from this location (or create a shortcut on your desktop).
development/build/compile-mingw.txt · Last modified: by 127.0.0.1
