Is GLib universal library?

Is GLib (iglib/, gio/, gmodule/, gobject/, gthread/) universal library or is it dedicated for GNOME?

If I make CLI program mainly for Ubuntu server runtime environment (so there is no GNOME), is it fine to use GLib and can I trust to it?

is it fine to use GLib and can I trust to it?

Yes, sure!

Ok, so, is GLib universal? Is developed like for Linux world or for GNOME world? Is it dedicated for GNOME? Is GLib GNOME’s like Libadwaita and GDM are or is it for Linux like systemd is?

Do you understand what I mean? Sure, I can use it, but if it’s dedicated for GNOME, it might turn against me. If it’s made for all in Linux, then I can trust that my usecase will be taken into account as well.

You are asking the wrong question.

There is no guarantee, at any point, that any free and open source software project will take into account your specific use case.

GLib provides you with an API, and a guarantee about API stability; it has requirements on the toolchain that you can use with it. That’s all you can rely on.

As far as you can be concerned: the majority of people contributing to GLib are GNOME developers; the GNOME project does not “own” anything, outside of the trademarks of the GNOME project. The people who maintain and contribute to GLib decide the technical direction of the project.

1 Like

It was just an example, but do you understand that there is a difference between e.g. GDM and systemd? The former is primarily for Gnome and the latter for Linux in general.

Good point!

I know that and that’s ok. This is getting a bit semantic, but is GLib GNOME’s? Think about originally RPM stood Red Hat Package Manager but now RPM Package Manager and 389 Directory Server was originally called Fedora Directory Server. Developers are still mostly the same, but the projects are now independent.

GLib is not meant to be used only for GNOME apps. You can use it as a helper library or a better libc for other projects as well. It’s used by flatpak, pkg-config, gstreamer, etc.

I’m not sure this is a great example. GDM and systemd perform different functions, and there are plenty of people who would say that systemd is opinionated, not built for Linux in general, and doesn’t fulfil their use case.

GLib is a platform library which is used by many hundreds of projects outside of GNOME. It is maintained with that in mind. As Emmanuele says, it has strict and documented API guarantees, so it’s not going to pull the rug out from underneath you.

As maintainers, we take people’s feature requests into account on a case-by-case basis, so there’s no guarantee that we will, or won’t, implement things for your use case. It generally depends on how useful the functionality would be for other people, how maintainable it is, and who’s going to spend the time to write the code.

1 Like

What do you exactly mean by this?

It provides a platform for application developers to build on. It abstracts over OS platform differences.

Another attempt to explain:

What defines this ‘platform’ that you talking about? Is it Gnome platform or GLib platform?

What underlying concern are you trying to address?

If GLib is for only GNOME, I prefer to use other universal, common libraries. I love GNOME, but I think a general purpose library like GLib should be generic and not DE specific.

It’s about the same as that the reason many projects didn’t want to use 389 Directory Server under its old Fedora Directory Server name.

It is not only for GNOME.

This is exactly what I’ve been trying to figure out. GLib suddenly looks a dedicated library for GNOME by GNOME Project.

To avoid ambiguity, could someone answer these:

  1. Is GLib GNOME’s library? Is it for GNOME and GNOME ‘platform’, for GTK and GTK world or for whole Linux?

  2. GTK is developed by GTK Team and in principle separate, independent project, although technically GNOME Foundation owns the trademark.
    So, is GLib developed by GLib Team etc or is it GNOME’s project?

  3. If I develop a CLI tool which normally not used with GNOME or related software (the tool is for minimal server and container enviroments), is it recommended to use GLib? Or is GLib primarily for only GNOME and related stuff?

All these questions have now been answered multiple times already, but OK:

  1. GLib is for use inside and outside of GNOME. Of the options you provide, ‘for whole Linux’ is the closest.
  2. GLib is developed by the GLib team, most of whom also work on GNOME modules.
  3. If you are writing a CLI tool in C, I would recommend you use GLib. It provides a lot of utility functions which you would otherwise have to write yourself, and smooths out a lot of differences between OS platforms.

I assumed from your questions that you didn’t understand my questions at first.

Thanks! I appreciate it :smile:

Execelent! Just curious, what are popular projects use GLib? Flatpak yes, but what about systemd? Wayland? PipeWire? KDE Plasma? Blender?

By GNOME modules you mean gnome-shell, nautilus, etc?

Wikipedia says:


Since GLib is not project of the GNOME Project, we should update to there that the developer is GLib Team. Also the link is now to

Wikipedia also says:

GLib is a bundle of three (formerly five) low-level system libraries written in C and developed mainly by GNOME. GLib’s code was separated from GTK, so it can be used by software other than GNOME and has been developed in parallel ever since.

This IMO gives a bit of a false impression. What about something like “GLib is a general purpose library for C by GLib Team. Originaly GLib’s code was separated from GTK. Nowdays GLib is used by many popular software like Flatpak, GTK and GNOME.”?

What do you think?

@kelw: The list of platforms supported by GLib are:

  • Linux
  • macOS
  • Windows
  • Android

For more detailed platform requirements, see

That should answer your question on whether GLib will work on a particular Linux (non-GNOME) environment.

See Building GLib for actual dependencies which are used by GLib.

Can you please explain where you are getting this impression? I would recommend to study closely the code that is in GLib. It is just a collection of common utilities: data structures, thread abstraction, I/O abstractions, unicode handling, etc. None of that has anything to do with GNOME nor was it invented by GNOME. In fact most every desktop and server application these days will probably use those things. And IMO GLib is useful if you are writing any high-level C application because it supplies many missing things that are not in the C standard library, i.e. things that you would find in newer languages such as C++ or Python but are still missing from standard C.

You can get this information pretty easily from your distro, for example in Fedora the command to list all packages using glib is this:

dnf repoquery --all --whatrequires glib2

AFAIK systemd, pipewire and wayland do not use glib because they have one restriction: they are supported on embedded platforms so they need to handle out-of-memory conditions. By design GLib does not fail gracefully in out-of-memory conditions so that is a rare situation where I would say do not use GLib. But unless you are already targeting a specific embedded platform with known strict memory limitations, you will probably not need to worry about that.