Documentation

Mogrix is a deterministic SRPM conversion engine that transforms Fedora 40 packages into IRIX-compatible software.

Major Achievements

ir8 Browser

The first WebKit-based browser for IRIX. Built on the full GTK3 stack with WebKitGTK, providing complete HTTP rendering capabilities. A milestone in bringing modern web technology to IRIX.

Golang Port

Go 1.24.1 successfully ported to IRIX N64. Full runtime support including goroutines, channels, TLS 1.3, and HTTP networking. This required significant work on the Go runtime and syscall layer for MIPS/IRIX.

WebKitGTK

Complete WebKitGTK stack running on IRIX with full HTTP rendering pipeline. Required porting the entire dependency chain including cairo, pixman, pango, and GTK3.

GTK3 Stack

Complete GTK3 application framework working on IRIX, enabling modern GUI applications. Includes cairo graphics, pixman rendering, pango text layout, and harfbuzz font shaping.

Getting Started

Prerequisites

Bootstrap Installation (Recommended)

The easiest way to get started is with the self-installing bootstrap bundle.

Important: Do not mix Mogrix RPMs with an existing SGUG-RSE installation. If you have /usr/sgug from a previous SGUG-RSE install, rename or remove it before running the bootstrap:
mv /usr/sgug /usr/sgug.old

Run as root:

curl -O https://packages.mogrix.unxmaal.com/bundles/mogrix-bootstrap.run
chmod +x mogrix-bootstrap.run
./mogrix-bootstrap.run

This installs the minimum dependencies and configuration for tdnf in /usr/sgug. Once complete, you can install any Mogrix package:

tdnf install nano
tdnf install weechat
tdnf install mogrix-essentials

Alternative: Standalone Bundles

If you want to try Mogrix without affecting /usr/sgug, use standalone bundles instead. These are completely self-contained and install to /opt/mogrix-apps, so they work alongside any existing SGUG-RSE installation.

See available bundles

How Mogrix Works

Mogrix converts Fedora 40 SRPMs through a deterministic, rules-based transformation:

FC40 SRPM → [Extract] → Spec + Sources
                ↓
          MOGRIX Engine
                ↓
     ┌─────────┬──────────┬──────────┐
     ↓         ↓          ↓          ↓
   Rules    Headers     Compat    Analysis
  (YAML)   Overlays    Sources    (Static)
                ↓
          [Rewrite Spec]
                ↓
    RSE SRPM (self-contained)
                ↓
         [Cross-compile]
                ↓
         MIPS N32 RPM

Key Features

Bundle Installation

Bundles are self-installing .run files. Place them anywhere and run:

Installation Steps

# 1. Download
curl -O https://packages.mogrix.unxmaal.com/bundles/nano.run

# 2. Make executable
chmod +x nano.run

# 3. Run the installer
./nano.run

# 4. Add to PATH (add to .profile for persistence)
PATH=/opt/mogrix-apps/bin:$PATH; export PATH

# 5. Run
nano

Directory Structure

After installation:

/opt/mogrix-apps/
  bin/                          # Shared directory - add to PATH once
    nano                        # Trampoline script
    weechat                     # Another trampoline
  nano-7.2-6-irix-bundle/       # Self-contained bundle
    _bin/                       # Actual binaries
    _lib32/                     # Required libraries (pruned)
    share/                      # Data files
    uninstall                   # Cleanup script

Repository Usage

Setup

# Create repo config
cat > /etc/yum.repos.d/mogrix.repo << 'EOF'
[mogrix]
name=Mogrix IRIX Packages
baseurl=https://packages.mogrix.unxmaal.com/repo/
enabled=1
gpgcheck=0
EOF

# Refresh cache
tdnf makecache

Common Commands

tdnf search <package>    # Search for packages
tdnf install <package>   # Install a package
tdnf update              # Update all packages
tdnf remove <package>    # Remove a package
tdnf list installed      # List installed packages

Known IRIX Limitations

Mogrix works around these IRIX-specific issues:

Issue Workaround
fopencookie crashes Use funopen (BSD-style)
%zu format corrupts varargs Use %u/%d (32-bit)
No __thread TLS Remove via patch, use static
brk() heap limited to 176MB Use dlmalloc (mmap-based)
Global GOT > 4370 entries -Bsymbolic-functions flag
Missing setenv/unsetenv Compat wraps putenv

IRIX ABI Deep Dive

Building complex software for IRIX requires understanding several low-level ABI constraints. These discoveries were made through extensive debugging with Ghidra and runtime analysis.

GOT Entry Limit (~4370 entries)

The IRIX dynamic linker has a hard limit of approximately 4370 GOT (Global Offset Table) entries per shared object. When a library exceeds this limit, the linker silently fails to resolve symbols, causing mysterious crashes. This limit was discovered through Ghidra analysis of rld.

# Symptoms: undefined symbols at runtime despite correct linking
# Solution: reduce GOT pressure with -Bsymbolic-functions
LDFLAGS="-Wl,-Bsymbolic-functions"

Symbol Resolution & DT_MIPS_GOTSYM

IRIX uses a MIPS-specific dynamic linking optimization where symbols below the DT_MIPS_GOTSYM threshold are resolved at load time. Symbols above this threshold use lazy binding. When GOT entries are exhausted, symbols intended for lazy binding fail to resolve.

Workaround: Preload problematic shared libraries with _RLD_LIST to force early symbol resolution before GOT exhaustion occurs.

R_MIPS_REL32 Relocation Issues

Function pointers stored in static data structures require R_MIPS_REL32 relocations. The IRIX linker sometimes mishandles these, especially in position-independent code with complex initialization patterns.

# Problem: function pointers in static structs resolve to wrong addresses
# Solution: use -Bsymbolic-functions and avoid -z relro
LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,norelro"

Critical Linker Flags

Flag Purpose
-Bsymbolic-functions Resolve function symbols internally, reducing GOT pressure
-z norelro Disable RELRO (not supported by IRIX)
--version-script filtering Remove GNU symbol versioning that IRIX cannot process

Memory: dlmalloc for Large Heaps

IRIX's brk() system call limits the traditional heap to approximately 176MB. For applications requiring more memory (like WebKit), we use dlmalloc configured to use mmap() directly, enabling heap sizes up to 1.2GB.

# In compat layer:
# - Replace malloc/free/realloc with dlmalloc implementations
# - dlmalloc uses mmap() which can allocate up to ~1.2GB
# - Required for WebKitGTK, large builds, etc.

Suite Bundles

For convenience, Mogrix provides curated suite bundles that install collections of related packages:

Install via repository: tdnf install mogrix-essentials

Or download from the bundles page.

Resources