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-10.1
          platform.
        
        
          Package Information
        
        
        
          Additional Downloads
        
        
        
          GLib Dependencies
        
        
          Recommended
        
        
          libxslt-1.1.34 and PCRE-8.44 (built with Unicode
          properties)
        
        
          Optional
        
        
          dbus-1.12.20 and bindfs (both may be used in some tests),
          GDB-10.1 (for
          bindings), docbook-xml-4.5, docbook-xsl-1.79.2, GTK-Doc-1.33.2 (to
          build API documentation), and glib-networking-2.66.0 (for some
          tests, but this is a circular dependency)
        
        
          Additional Runtime Dependencies
        
        
          gobject-introspection-1.66.1
          (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: http://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.25, output numerous warnings when run
          from the command line. This patch enables the use of an environment
          variable, GLIB_LOG_LEVEL, that supresses
          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.66.7-skip_warnings-1.patch
        
          ![[Warning]](../images/warning.png) 
          
            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      \
      -Dman=true         \
      -Dselinux=disabled \
      ..                 &&
ninja
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            If libxslt-1.1.34 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.66.7 &&
cp -r ../docs/reference/{NEWS,gio,glib,gobject} /usr/share/doc/glib-2.66.7
        
          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.
        
        
          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
        
        
          -Dman=true: This switch
          causes the build to create and install the package man pages.
        
        
          -Dselinux=disabled: This
          switch disables support for selinux which is not supported in BLFS.
        
        
          -Dgtk_doc=true: This switch causes the
          build to create and install the API documentation.