Skip to content

Instantly share code, notes, and snippets.

@cchantep
Last active March 10, 2016 14:02
Show Gist options
  • Save cchantep/9345d51889c0148c2256 to your computer and use it in GitHub Desktop.
Save cchantep/9345d51889c0148c2256 to your computer and use it in GitHub Desktop.
How to build glib 2.38.2 for winxp.

GLib for Windows XP

GLib is a core framework to build multi-platform application.

This is how to build its 2.38.2 version for Windows XP.

Prerequisites

  • Windows XP OS. For testing purposes, you can consider VM from IEVMS.
  • MSYS2 Base for i686 arch. By time this is written, I use msys2-base-i686-20140507.tar.xz.
  • GCC & make. If not installed in MSYS2, it can be done using pacman: pacman -S gcc make (I have built poppler using GCC 4.5.2 for compat).
  • Python 2.5+. Under MSYS2 it can be installed with pacman -S python (with that, I currently have Python 3).
  • ZLib, FFI & gettext (pacman -S zlib-devel libffi-devel gettext-devel).

In MSYS2 launched using its mingw32_shell; Let's build it.

  1. Download sources for GLib 2.38.2: cd tmp && wget http://sources/url. I can't build more recent version on winxp.
  2. Extract thoses sources: xz -dv glib-2.38.2.tar.xz && tar -xvf glib-2.38.2.tar.
  3. In sources directory, configure it: cd glib-2.38.2 && CPPFLAGS="-march=i686 -D_WIN32_WINNT=0x0501" ./configure --prefix=/usr --with-python=$(which python).
    • CPPFLAGS="-march=i686 -D_WIN32_WINNT=0x0501" is required to ensure OS is properly detected while building GLib.
  4. Then finally make it: make install (or just make if you don't want to install it).
@mingwandroid
Copy link

Ok, but you are using MSYS2 GCC (and MSYS2 packages) which doesn't generate anything except MSYS2 executables, which are quite similar to Cygwin executables.

What is your goal here? To build Glib for Windows XP 32bit or to build Glib for Windows MSYS2 32bit? They are two very different things.

@Globik
Copy link

Globik commented Jan 29, 2016

Hallo mingwandroid,
I am on windows32 bit, my goal is to build the Janus webrtc gateway for Windows 32 bit. How to properly to build Glib with msys2?

@giograno
Copy link

Following your guide, I have the following error.

In file included from gconvert.c:35:0:
win_iconv.c: In function 'win_iconv_open':
win_iconv.c:792:18: error: '_errno' undeclared (first use in this function)
     cd->_errno = _errno;
                  ^
win_iconv.c:792:18: note: each undeclared identifier is reported only once for each function it appears in
win_iconv.c: In function 'make_csconv':
win_iconv.c:914:9: error: implicit declaration of function '_stricmp' [-Werror=implicit-function-declaration]
         if (_stricmp(p + 2, "nocompat") == 0)
         ^
win_iconv.c: In function 'name_to_codepage':
win_iconv.c:1007:5: error: implicit declaration of function '_strnicmp' [-Werror=implicit-function-declaration]
     else if (_strnicmp(name, "cp", 2) == 0)
     ^
cc1: some warnings being treated as errors

Could you please help me to resolve these errors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment