# OS161 Toolchain Build Fixes on Arch Linux (2026) This document summarizes the issues encountered and fixes applied when building the OS161 cross-compiler toolchain on a modern Arch Linux system. ## Environment - **OS:** Arch Linux (kernel 6.19.9) - **GCC:** 14.x (host compiler) - **Python:** 3.14 - **AUR packages:** `mips-harvard-os161-binutils`, `mips-harvard-os161-gcc48`, `mips-harvard-os161-gdb`, `sys161`, `guile2.0` --- ## Issue 1: `guile2.0` — Expired GPG Key **Package:** `guile2.0-2.0.14-6` **Error:** ``` -> FF478FB264DE32EC296725A3DDC0F5358812F8F2, required by: guile2.0 :: Importing keys with gpg... gpg: key DDC0F5358812F8F2: no public key - can't apply revocation certificate -> problem importing keys ``` **Cause:** The PGP signing key for Andy Wingo (guile maintainer) has expired and is no longer available on public keyservers. The PKGBUILD requires verification of a `.sig` file that cannot be validated. **Fix:** Edit `~/.cache/yay/guile2.0/PKGBUILD` to remove the `.sig` source and `validpgpkeys` array, then build manually with `makepkg --skippgpcheck`: ```diff -source=(https://ftp.gnu.org/pub/gnu/$_pkgname/$_pkgname-$pkgver.tar.gz{,.sig}) -validpgpkeys=('3CE464558A84FDC69DB40CFB090B11993D9AEBB5' # Ludovic Courtès - 'FF478FB264DE32EC296725A3DDC0F5358812F8F2') # Andy Wingo -md5sums=('333b6eec83e779935a45c818f712484e' - 'SKIP') +source=(https://ftp.gnu.org/pub/gnu/$_pkgname/$_pkgname-$pkgver.tar.gz) +md5sums=('333b6eec83e779935a45c818f712484e') ``` ```bash cd ~/.cache/yay/guile2.0 makepkg -si --noconfirm --skippgpcheck ``` --- ## Issue 2: `binutils` / `gcc48` — `static_assert` Keyword Conflict **Packages:** `mips-harvard-os161-binutils-2.24`, `mips-harvard-os161-gcc48-4.8.3` **Error:** ``` opcodes/mips-formats.h:83:7: error: expected identifier or '(' before 'static_assert' 83 | static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ | ^~~~~~~~~~~~~ ``` **Cause:** This old code uses `static_assert[condition]` as a compile-time assertion trick — declaring a zero-length array to force a compile error if the condition is false. This was common before C11. In C11, `_Static_assert` became a language keyword, and GCC 14 defines `static_assert` as a built-in macro expanding to it, even without including ``. The result: what was a valid identifier is now a reserved word. **Fix:** Force the C99 standard (where `static_assert` is not a keyword) via CFLAGS in each PKGBUILD: For `mips-harvard-os161-binutils` (`~/.cache/yay/mips-harvard-os161-binutils/PKGBUILD`): ```diff - make tooldir=/usr + make tooldir=/usr CFLAGS="${CFLAGS} -std=gnu99" ``` For `mips-harvard-os161-gcc48` (`~/.cache/yay/mips-harvard-os161-gcc48/PKGBUILD`): ```diff - export CFLAGS="-O2" - export CXXFLAGS="-O2" + export CFLAGS="-O2 -std=gnu99" + export CXXFLAGS="-O2 -std=gnu++98" ``` --- ## Issue 3: `gdb` — Multiple Compatibility Failures **Package:** `mips-harvard-os161-gdb-7.8` This package required three separate fixes. ### 3a. `static_assert` Keyword Conflict (same as Issue 2) Same root cause as above. However, `-std=gnu99` alone was not sufficient here because of the next issue. ### 3b. `implicit declaration of 'strcmp'` — GCC 14 Hard Error **Error:** ``` sim/common/gentmap.c:119:7: error: implicit declaration of function 'strcmp' 119 | if (strcmp (argv[1], "-h") == 0) note: include '' or provide a declaration of 'strcmp' ``` **Cause:** `sim/common/gentmap.c` calls `strcmp` without including ``. In C89/C99, this used to produce only a warning. **GCC 14 changed this to a hard error** regardless of the C standard mode. The flag `-Wno-implicit-function-declaration` does not suppress it because the sub-Makefile adds `-Wall` after CFLAGS, which re-enables the diagnostic as an error. **Fix:** Patch the source in the PKGBUILD's `prepare()` function (so it survives re-extraction), and use `-std=gnu89` (which avoids `static_assert` issues while being the appropriate standard for this K&R-era code): ```diff prepare() { cd gdb-${_pkgver} sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure patch -p1 -i ${srcdir}/gdb.patch + # GCC 14 made implicit function declarations hard errors; add missing include + sed -i '/#include /a #include ' sim/common/gentmap.c mkdir ${srcdir}/gdb-build } ``` ```diff - export CFLAGS="-O2" - export CXXFLAGS="-O2" + export CFLAGS="-O2 -std=gnu89" + export CXXFLAGS="-O2 -std=gnu++98" ``` ### 3c. `_PyOS_ReadlineTState` Removed in Python 3.12+ **Error:** ``` gdb/python/py-gdb-readline.c:57:29: error: '_PyOS_ReadlineTState' undeclared 57 | PyEval_RestoreThread (_PyOS_ReadlineTState); ``` **Cause:** `_PyOS_ReadlineTState` is a private CPython API that was removed in Python 3.12. The system runs Python 3.14, making this integration code completely incompatible. **Fix:** Disable Python support in the gdb configure step. Python scripting is not needed for OS161 kernel debugging: ```diff --disable-nls --nfp \ --disable-shared --disable-threads \ - --disable-werror + --disable-werror \ + --with-python=no ``` --- ## Summary Table | Package | Error | Root Cause | Fix | |---|---|---|---| | `guile2.0` | GPG key import failure | Maintainer key expired, not on keyservers | Remove `validpgpkeys` + `.sig` from PKGBUILD; build with `--skippgpcheck` | | `mips-harvard-os161-binutils` | `static_assert` keyword conflict | GCC 14 predefines `static_assert` as a C11 macro | Add `-std=gnu99` to `make` call | | `mips-harvard-os161-gcc48` | `static_assert` keyword conflict | Same as above | Set `CFLAGS="-O2 -std=gnu99"` in PKGBUILD | | `mips-harvard-os161-gdb` | `static_assert` + implicit `strcmp` + Python API removed | GCC 14 strictness + Python 3.14 incompatibility | Use `-std=gnu89`; patch `gentmap.c`; add `--with-python=no` |