#### Beyond Linux® From Scratch (systemd Edition) - Version 11.1

### Chapter 9. General Libraries

- Prev

  fftw-3.3.10

- Next

  GLibmm-2.66.2

- Up
- Home

# GLib-2.70.4

## Introduction to GLib

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

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

### Package Information

- Download (HTTP): https://download.gnome.org/sources/glib/2.70/glib-2.70.4.tar.xz

- Download (FTP): ftp://ftp.acc.umu.se/pub/gnome/sources/glib/2.70/glib-2.70.4.tar.xz

- Download MD5 sum: 71e5bb2948622fab36f5fa683fd7d3ab

- Download size: 4.6 MB

- Estimated disk space required: 131 MB (add 5 MB for tests)

- Estimated build time: 0.5 SBU (add 0.4 SBU for tests; both using parallelism=4)

### Additional Downloads

- Optional patch: https://www.linuxfromscratch.org/patches/blfs/11.1/glib-2.70.4-skip_warnings-1.patch

### GLib Dependencies

#### Recommended

libxslt-1.1.35 and PCRE-8.45 (built with Unicode properties)

#### Optional

dbus-1.12.20 and bindfs (both may be used in some tests), GDB-11.2 (for bindings), docbook-xml-4.5, docbook-xsl-1.79.2, GTK-Doc-1.33.2 (to build API documentation), glib-networking-2.70.1 (for some tests, but this is a circular dependency), and sysprof-3.42.1

#### Additional Runtime Dependencies

gobject-introspection-1.70.0 (should be installed before gtk+, atk, etc.)

Quoted directly from the `INSTALL` file: “Some of the mimetype-related functionality in GIO requires the update-mime-database and update-desktop-database utilities”, which are part of shared-mime-info-2.1 and desktop-file-utils-0.26, respectively. These two utilities are also needed for some tests.

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/glib2

## 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.31, 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-2.70.4-skip_warnings-1.patch

### Warning

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}
    fi

Install GLib by running the following commands:

    mkdir build &&
    cd    build &&

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

### Note

If libxslt-1.1.35 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.70.4 &&
    cp -r ../docs/reference/{gio,glib,gobject} /usr/share/doc/glib-2.70.4

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

To test the results, after having installed the package, issue: ninja test. One test named `gio / file` is known to fail if the test is run as the `root` user.

Finally, if this is a reinstall from glib2-2.64.x or earlier, remove (as the `root` user) an obsolete header file that interferes with some packages:

    rm -f /usr/include/glib-2.0/glib/gurifuncs.h

## 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.

## Contents

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: libgio-2.0.so, libglib-2.0.so, libgmodule-2.0.so, libgobject-2.0.so, and libgthread-2.0.so
Installed Directories: /usr/include/gio-unix-2.0, /usr/include/glib-2.0, /usr/lib/glib-2.0, /usr/share/glib-2.0, /usr/share/doc/glib-2.70.4, and /usr/share/gtk-doc/html/{gio,glib,gobject} (optional)

### Short Descriptions

gapplication | can be used to start applications and to send messages to already-running instances of other applications
gdbus | is a simple tool used for working with D-Bus objects
gdbus-codegen | is used to generate code and/or documentation for one or more D-Bus interfaces
gio | is a utility that makes many GIO features available from the command line
gio-querymodules | 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
glib-compile-resources | 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
glib-compile-schemas | 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
glib-genmarshal | is a C code marshaller generation utility for GLib closures
glib-gettextize | is a variant of the gettext internationalization utility
glib-mkenums | is a C language enum description generation utility
gobject-query | is a small utility that draws a tree of types
gresource | offers a simple command line interface to GResource
gsettings | offers a simple command line interface to GSettings
gtester | is a test running utility
gtester-report | is a test report formatting utility
GLib libraries | contain low-level core libraries for the GIMP Toolkit

Last updated on

- Prev

  fftw-3.3.10

- Next

  GLibmm-2.66.2

- Up
- Home