Introduction to GLib

The GLib package contains low-level libraries useful for providing data structure handling for C, portability wrappers and interfaces for runtime functionality such as an event loop, threads, dynamic loading and an object system.

This package is known to build and work properly using an LFS 12.1 platform.

Package Information

Additional Downloads

GLib Dependencies



dbus-1.14.10 (for some tests), Fuse-3.16.2 and bindfs (both needed for one test), GDB-14.1 (for bindings), docbook-xml-4.5, docbook-xsl-nons-1.79.2, GTK-Doc-1.33.2 (to build API documentation), glib-networking-2.78.0 (for some tests, but this is a circular dependency), and sysprof

Additional Runtime Dependencies

Installation of GLib

If desired, apply the optional patch. In many cases, applications that use this library, either directly or indirectly via other libraries such as GTK+-3.24.41, output numerous warnings when run from the command line. This patch enables the use of an environment variable, GLIB_LOG_LEVEL, that suppresses unwanted messages. The value of the variable is a digit that corresponds to:

1 Alert
2 Critical
3 Error
4 Warning
5 Notice

For instance export GLIB_LOG_LEVEL=4 will skip output of Warning and Notice messages (and Info/Debug messages if they are turned on). If GLIB_LOG_LEVEL is not defined, normal message output will not be affected.

patch -Np1 -i ../glib-skip_warnings-1.patch


If a previous version of glib is installed, move the headers out of the way so that later packages do not encounter conflicts:

if [ -e /usr/include/glib-2.0 ]; then
    rm -rf /usr/include/glib-2.0.old &&
    mv -vf /usr/include/glib-2.0{,.old}

Install GLib by running the following commands:

mkdir build &&
cd    build &&

meson setup ..            \
      --prefix=/usr       \
      --buildtype=release \
      -Dman=true          &&


If libxslt-1.1.39 is installed, the above command may indicate several (about 33) errors that start with "Error: no ID for constraint linkend:" when generating the man pages. These are harmless.

The GLib test suite requires desktop-file-utils for some tests. However, desktop-file-utils requires GLib in order to compile; therefore, you must first install GLib and then run the test suite.

Now, as the root user:

ninja install &&

mkdir -p /usr/share/doc/glib-2.78.4 &&
cp -r ../docs/reference/{gio,glib,gobject} /usr/share/doc/glib-2.78.4

You should now install desktop-file-utils-0.27 and shared-mime-info-2.4 and proceed to run the test suite.



Do not run the test suite as root or some tests will fail unexpectedly and leave some non-FHS-compliant directories in the /usr hierarchy.

To test the results, after having installed the package, issue: LC_ALL=C ninja test as a non-root user.

Command Explanations

--buildtype=release: Specify a buildtype suitable for stable releases of the package, as the default may produce unoptimized binaries.

-Dman=true: This switch causes the build to create and install the package man pages.

-Dgtk_doc=true: This switch causes the build to create and install the API documentation.


Installed Programs: gapplication, gdbus, gdbus-codegen, gio, gio-querymodules, glib-compile-resources, glib-compile-schemas, glib-genmarshal, glib-gettextize, glib-mkenums, gobject-query, gresource, gsettings, gtester, and gtester-report
Installed Libraries:,,,, and
Installed Directories: /usr/include/gio-unix-2.0, /usr/include/glib-2.0, /usr/lib/gio, /usr/lib/glib-2.0, /usr/share/glib-2.0, /usr/share/doc/{glib-2.0,glib-2.78.4}, and /usr/share/gtk-doc/html/{gio,glib,gobject} (optional)

Short Descriptions


can be used to start applications and to send messages to already-running instances of other applications


is a simple tool used for working with D-Bus objects


is used to generate code and/or documentation for one or more D-Bus interfaces


is a utility that makes many GIO features available from the command line


is used to create a giomodule.cache file in the listed directories. This file lists the implemented extension points for each module that has been found


is used to read the resource description from a file and the files that it references to create a binary resource bundle that is suitable for use with the GResource API


is used to compile all the GSettings XML schema files in a directory into a binary file with the name gschemas.compiled that can be used by GSettings


is a C code marshaller generation utility for GLib closures


is a variant of the gettext internationalization utility


is a C language enum description generation utility


is a small utility that draws a tree of types


offers a simple command line interface to GResource


offers a simple command line interface to GSettings


is a test running utility


is a test report formatting utility

GLib libraries

contain low-level core libraries for the GIMP Toolkit