Repository navigation
GLib 2.81.2
GLib 2.81.2 builds for x86_64 and aarch64 architectures.
Built from source with the following configuration:
- Version: GLib 2.81.2
- Architectures: x86_64 (native), aarch64 (native ARM64)
- Libraries: Both static (.a) and shared (.so) libraries included
- Static Libraries: Provided for creating fully static user applications
- Shared Libraries: Standard shared libraries for dynamic linking
- Type: Dual native compilation (static + shared) on respective architectures
- Minimal Dependencies: libmount, xattr, selinux, and NLS disabled for maximum portability
- Optimization: Stripped binaries and shared libraries for reduced download size
- Features: Core GLib functionality optimized for embedded/static deployment
- Dev Files: Headers, pkg-config files, and tools included for development
What is GLib?
GLib is a low-level core library that forms the basis for projects such as GTK and GNOME. It provides:
- Data structure handling for C (lists, trees, hashes, etc.)
- Portability wrappers and interfaces for runtime functionality
- Runtime functionality for applications and libraries
- Object system and signal framework (GObject)
- I/O channels and networking (GIO)
- Threading and synchronization primitives
- Internationalization support
- Memory management utilities
- String manipulation functions
Libraries Included
Core Libraries:
libglib-2.0.a/libglib-2.0.so- Core GLib functionalitylibgobject-2.0.a/libgobject-2.0.so- Object system and signalslibgio-2.0.a/libgio-2.0.so- I/O and networking functionalitylibgmodule-2.0.a/libgmodule-2.0.so- Dynamic module loading
Development Files:
- Header files in
include/glib-2.0/ - pkg-config files (
.pc) for build integration - GLib configuration headers
Tools:
glib-compile-schemas- Schema compilation toolgdbus- D-Bus introspection and testing toolgio- GIO command-line toolglib-compile-resources- Resource compilation toolglib-genmarshal- Signal marshaller generator
Use Cases
Static Linking (Recommended for BusyBox/Embedded):
Use the static libraries (.a files) to create fully self-contained binaries:
# For BusyBox/embedded systems - fully static
# Note: Libraries may be in lib/arch-triplet/ directory (e.g., lib/x86_64-linux-gnu/)
gcc -static \
-I/path/to/glib/include/glib-2.0 \
-I/path/to/glib/lib/x86_64-linux-gnu/glib-2.0/include \
-L/path/to/glib/lib/x86_64-linux-gnu \
program.c -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lrt -lm -o program
# Alternative using lib-std symlinks (if available)
gcc -static \
-I/path/to/glib/include/glib-2.0 \
-I/path/to/glib/lib-std/glib-2.0/include \
-L/path/to/glib/lib-std \
program.c -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lrt -lm -o program
# Verify no dynamic dependencies
ldd program # Should show 'not a dynamic executable' or minimal system depsDynamic Linking:
Use shared libraries for standard applications:
# Using pkg-config (recommended)
gcc $(pkg-config --cflags --libs glib-2.0) program.c -o program
# Manual linking (adjust path for architecture-specific directories)
gcc -I/path/to/glib/include/glib-2.0 -I/path/to/glib/lib/x86_64-linux-gnu/glib-2.0/include \
-L/path/to/glib/lib/x86_64-linux-gnu program.c -lglib-2.0 -o program
export LD_LIBRARY_PATH=/path/to/glib/lib/x86_64-linux-gnu:$LD_LIBRARY_PATHUsing pkg-config:
The build includes pkg-config files for easy integration:
# Set PKG_CONFIG_PATH (adjust for architecture-specific directories)
export PKG_CONFIG_PATH=/path/to/glib/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
# Or use lib-std symlinks if available
export PKG_CONFIG_PATH=/path/to/glib/lib-std/pkgconfig:$PKG_CONFIG_PATH
# Get compile flags
pkg-config --cflags glib-2.0 gobject-2.0 gio-2.0
# Get link flags
pkg-config --libs glib-2.0 gobject-2.0 gio-2.0
# Compile with pkg-config
gcc $(pkg-config --cflags glib-2.0) program.c $(pkg-config --libs glib-2.0) -o programBusyBox Integration:
Perfect for use with BusyBox environments and minimal systems:
# Static linking ensures no runtime dependencies
gcc -static \
-I/path/to/glib/include/glib-2.0 \
-I/path/to/glib/lib/glib-2.0/include \
-L/path/to/glib/lib \
program.c -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lrt -lmFiles
glib-2.81.2-x86_64.tar.gz: GLib build for x86_64 architectureglib-2.81.2-aarch64.tar.gz: GLib build for aarch64 architecture
Installation
Extract the appropriate archive:
tar -xzf glib-2.81.2-<arch>.tar.gzUsage Examples
Basic GLib Program:
#include <glib.h>
#include <stdio.h>
int main() {
// Initialize GLib
g_print("GLib version: %d.%d.%d\n",
glib_major_version, glib_minor_version, glib_micro_version);
// Use GLib data structures
GList *list = NULL;
list = g_list_append(list, "Hello");
list = g_list_append(list, "World");
for (GList *l = list; l != NULL; l = l->next) {
g_print("%s ", (char*)l->data);
}
g_print("\n");
g_list_free(list);
return 0;
}Static Linking Example:
# Extract GLib
tar -xzf glib-2.81.2-x86_64.tar.gz
# Compile with static GLib (no runtime dependencies)
# Libraries are in architecture-specific directory
gcc -static \
-I$PWD/glib-2.81.2-x86_64/include/glib-2.0 \
-I$PWD/glib-2.81.2-x86_64/lib/x86_64-linux-gnu/glib-2.0/include \
-L$PWD/glib-2.81.2-x86_64/lib/x86_64-linux-gnu \
program.c -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lrt -lm -o programDynamic Linking Example:
# Set up environment
export GLIB_ROOT=$PWD/glib-2.81.2-x86_64
export LD_LIBRARY_PATH=$GLIB_ROOT/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$GLIB_ROOT/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export PATH=$GLIB_ROOT/bin:$PATH
# Compile and run
gcc $(pkg-config --cflags glib-2.0) program.c $(pkg-config --libs glib-2.0) -o program
./programUsing GLib Tools:
# Extract and use GLib command-line tools
tar -xzf glib-2.81.2-x86_64.tar.gz
export PATH=$PWD/glib-2.81.2-x86_64/bin:$PATH
# Compile GSettings schemas
glib-compile-schemas schemas/
# Test D-Bus functionality
gdbus introspect --system --dest org.freedesktop.DBus --object-path /
# File operations with gio
gio list file:///tmp
gio info file:///etc/passwdIntegration with Other Builds:
This GLib can be used with the GCC, binutils, and other tool builds from this repository:
# Extract all tools
tar -xzf glib-2.81.2-<arch>.tar.gz
tar -xzf gcc-<version>-<arch>.tar.gz
tar -xzf binutils-<version>-<arch>.tar.gz
# Set up complete toolchain
export PATH=$PWD/gcc-<version>-<arch>/bin:$PWD/binutils-<version>-<arch>/bin:$PWD/glib-2.81.2-<arch>/bin:$PATH
export PKG_CONFIG_PATH=$PWD/glib-2.81.2-<arch>/lib/pkgconfig:$PKG_CONFIG_PATH
# For static linking (recommended for portability)
gcc -static \
$(pkg-config --cflags glib-2.0) \
program.c $(pkg-config --libs glib-2.0) -o programDevelopment Features
Complete Development Environment:
- All header files for GLib, GObject, and GIO
- pkg-config integration for easy build system integration
- Static libraries for embedded/minimal system deployment
- Shared libraries for standard desktop/server applications
- Command-line tools for development and debugging
pkg-config Files Included:
glib-2.0.pc- Core GLib librarygobject-2.0.pc- GObject systemgio-2.0.pc- GIO I/O librarygmodule-2.0.pc- Dynamic module loadinggthread-2.0.pc- Threading support
Compatibility Notes
- glibc 2.36+ Compatible: Built and tested for broad glibc compatibility
- BusyBox Ready: Static linking ensures compatibility with BusyBox environments
- Static Library Support: Static libraries (.a) available for creating dependency-free applications
- Minimal Dependencies: libmount, xattr, selinux, and NLS disabled for maximum portability
- Development Ready: Includes all headers and pkg-config files for development
- Performance: Optimized build with stripped binaries for minimal size
- Thread Safe: Built with threading support enabled
- Embedded Friendly: Configured specifically for embedded and minimal system deployment
Static vs Dynamic Usage:
- Use Static: For embedded systems, containers, BusyBox environments, or maximum portability
- Use Dynamic: For standard desktop/server applications where library sharing is beneficial
This build provides both options along with complete development files, allowing you to choose the appropriate linking method for your use case.