Building on Windows with MingW, and dealing with libintl_gettext errors

It’s a work in progress, but I’m working on an updated makefile for MingW based on the default Makefile, which supports both SDL and non-SDL builds and deals with undefined reference errors related to libintl_gettext.

This assumes you’ve already installed Cataclysm’s dependencies (SDL, SDL_ttf and freetype if you want tiles) and have at least a little experience using MingW. I’d recommend installing the GNUWin32 package since it contains fully native ports of several libraries used by Cataclysm, along with others that may be of use in the future. I haven’t tested this with the version of libintl that comes with MingW, as I replaced it on this machine a while ago.

To build, copy makefile.mingw to the project’s root folder, open a command window there and type:

make -f makefile.mingw

For the SDL version:

make TILES=1 -f makefile.mingw

For optimizations, add RELEASE=1 (default level is -O2, -Og if DEBUG is defined).
The primary addition to the makefile is -DLIBINTL_STATIC. In libintl.h, this can cause trouble:

#ifdef LIBINTL_STATIC #define LIBINTL_DLL_EXPORTED #else /* LIBINTL_STATIC */ #ifdef BUILDING_LIBINTL #define LIBINTL_DLL_EXPORTED __declspec(dllexport) #else #define LIBINTL_DLL_EXPORTED __declspec(dllimport) #endif #endif /* LIBINTL_STATIC */

The errors found here relating to libintl_gettext are the result of the linker looking for static implementations which are hidden by default. Luckily, it’s a simple enough fix. Either:

  • avoid statically linking to libintl, or
  • define LIBINTL_STATIC.

A couple of issues, as of this posting: O3 optimization is still causing a segfault when the player tries to construct something. And at least on this machine, compiling with MingW appears to completely break the frame rate. I’m anxious to figure that one out.

Please let me know how it works, especially if it doesn’t. :slight_smile: