Building GLib

Glib is available from GTK by FTP. At the time of writing, the current version is 2.12.12

Download the source code

  • Connect to your server using PuTTY or some other SSH client
  • Connect to GTK’s FTP server by typing the command ftp ftp.gtk.org
  • Login using the username anonymous and password anon@
  • Change to the directory where the source code is stored cd /pub/glib/2.12/
  • Change the mode to binary by entering the command binary
  • Download the file using the command get glib-2.12.12.tar.gz
  • Also download the md5 checksum to verify the veracity of your download get glib-2.12.12.tar.gz.md5
  • Close your FTP session by typing quit
  • Having downloaded the source code, extract the files into a new directory by entering the command gunzip -c glib-2.12.12.tar.gz|tar x

Install dependencies

We need to download and install the libiconv and gettext libraries before we can build GLib. Also, since we do not have root access at Westhost, we need to tell all Linux packages to install to a different directory other than /usr/local. We do this by specifying

./configure --prefix=/usr/mylocal
NOTE: Create the directory /usr/mylocal if it does not already exist

Library Command Download Location
libiconv wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
libiconv wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz.sig
gettext ftp ftp://mirrors.usc.edu/pub/gnu/gettext/gettext-0.16.tar.gz
gettext ftp ftp://mirrors.usc.edu/pub/gnu/gettext/gettext-0.16.tar.gz.sig

libiconv and gettext depend on each other, so we need to build libiconv then gettext and the rebuild libiconv.

Build libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz.sig
gunzip -c libiconv-1.11.tar.gz | tar x
cd libiconv-1.11
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make >log.make 2>err.make
This will build with errors, so do not check err.make for errors
make install >log.install 2>err.install
cd ..

Build gettext

ftp mirrors.usc.edu
anonymous
anon@
cd pub/gnu/gettext
mode image
passive
get gettext-0.16.tar.gz
get gettext-0.16.tar.gz.sig
quit
gunzip -c gettext-0.16.tar.gz |tar x
cd gettext-0.16
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make>log.make 2>err.make
Check err.make for errors
make install> log.install 2>err.install
Check err.install for errors

Rebuild libiconv

cd ../libiconv-1.11
make distclean
./configure --prefix=/usr/mylocal >log.config 2>err.config
Check err.config for errors
make>log.make 2>err.make
Check err.make for errors
make install> log.install 2>err.install
Check err.install for errors
libtool --dry-run --finish /usr/mylocal/lib
libtool --finish /usr/mylocal/lib
cd ..

Build the GLib library

  • Change into the new directory cd glib-2.12.12
  • Run autoconfigure to determine the build parameters ./configure –with-libiconv –prefix=/usr/mylocal >log.config 2>err.config
  • Check the err.config file for any errors
  • Build the library make >log.make 2>err.make
  • Check err.make for errors
  • Install the library make install >log.install 2>err.install

Errors we encountered

#error GNU libiconv not in use but included iconv.h is from libiconv

Added –with-libiconv to ./configure

warning: passing arg 2 of `g_async_queue_push’ discards qualifiers from pointer target type

This is only a warning and so can be ignored

2 thoughts on “Building GLib

  1. Beautiful clear guide but my GLib configure script still thinks I dont have gettext even though I followed it to the letter.

    The error message is ”
    configure: error:
    *** You must have either have gettext support in your C library, or use the
    *** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html

    Can you help?

  2. The build process is unable to find your gettext library. Make sure that the path is included in the file /etc/ld.so.conf

    Mine looks like this

    /usr/mylocal/lib
    /usr/local/lib
    /lib

    Once you have edited the file, you will need to regenerate the server’s database by typing ldconfig -v.

    That should get you going again.

Comments are closed.