Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions content/blog/2026-06-19-gsoc-app-compat-library-upgrades.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
title: "GSoC'26: Upgrading Application Library Ports to Newer Upstream Versions"
description: |
A technical update on the first three weeks of Google Summer of Code 2026 with
Unikraft, covering the upgrade of SQLite, Lua, and Redis library ports, as well
as two core bug fixes discovered along the way.
publishedDate: 2026-06-19
authors:
- RaduAndreiTudorica
tags:
- gsoc
- gsoc2026
- lib-ports
- sqlite
- lua
- redis
---

## Project Overview

My Google Summer of Code 2026 project focuses on upgrading Unikraft's application library ports to their latest upstream versions.
Unikraft maintains ports of widely used libraries — such as SQLite, Lua, Redis, Nginx, Python3, and libgo — that enable applications to run as unikernels.
As upstream projects release new versions, these ports must be updated to stay current.
The goal is to systematically upgrade each library port, resolve any build and runtime issues that arise, and validate that the resulting unikernels function correctly.

## Work Completed

### lib-sqlite: Upgrade from `3.40.1` to `3.53.1`

SQLite `3.53.1` is the latest stable release.
The upgrade required updating the version, SHA256 checksum, and download URL in `Library.uk` and `Makefile.uk`.

During testing, `stdout` was not appearing on the serial console.
After investigation (and help from Stefan Jumarea), the fix was enabling `CONFIG_LIBPOSIX_TTY_STDOUT_SERIAL` in the defconfig for the SQLite application in `catalog-core`.
This option was missing and is likely absent in other application defconfigs as well.

Relevant pull requests:

- [lib-sqlite#12](https://github.com/unikraft/lib-sqlite/pull/12): version bump
- [catalog-core#106](https://github.com/unikraft/catalog-core/pull/106): add `CONFIG_LIBPOSIX_TTY_STDOUT_SERIAL` to SQLite defconfig

Tested with `kraft build` and `kraft run` using the `catalog/library/sqlite` application.
A SELECT query on the Chinook sample database returned the expected 10 rows.

### lib-lua: Upgrade from `5.4.4` to `5.4.8`

Lua `5.4.8` is the latest release in the `5.4` series.
The upgrade followed the same pattern as SQLite:
updating the version string and SHA256 in `Library.uk`, and the version variable in `Makefile.uk`.

Relevant pull request:

- [lib-lua#12](https://github.com/unikraft/lib-lua/pull/12): version bump

Tested with `kraft build` and `kraft run` using the `catalog/library/lua/5.4` application.
The `helloworld.lua` example ran successfully.

### lib-redis: Upgrade from `7.0.11` to `8.0.2`

Redis `8.0.2` is the most significant upgrade in the project.
Redis 8 introduced substantial changes to the codebase between versions `7.0.11` and `8.0.2`, requiring several non-trivial modifications:

**Patch changes:**

- Dropped patch `0001` (un/likely macro redefinition guards): Redis 8 defines these macros upstream, so the patch caused a redefinition error and was removed.
- Rewrote patch `0002` (bytesToHuman static linkage): the function signature changed in Redis 8 — both the return type (now `char *` in `redis-cli.c`) and the addition of a `size_t size` parameter — so the patch was updated to match the new signatures.

**New source files:**

Redis 8 added 13 new `.c` files that were not present in the `Makefile.uk` source list:
`cluster_legacy.c`, `crccombine.c`, `ebuckets.c`, `eventnotifier.c`, `iothread.c`, `kvstore.c`, `logreqres.c`, `lolwut8.c`, `mstr.c`, `socket.c`, `strl.c`, `threads_mngr.c`, and `unix.c`.

**C++ dependency (fast_float + fpconv):**

Redis 8 introduced a new double-conversion path using `deps/fast_float/` and `deps/fpconv/`.
`fast_float_strtod.cpp` is a C++ source file, requiring:

- `LIBREDIS_CXXINCLUDES-y` entries for the `fast_float` headers and the compiler intrinsics directory (using `$(shell $(CC) -print-file-name=include)` for portability).
- Adding `fast_float_strtod.cpp` and `fpconv_dtoa.c` to `LIBREDIS_SRCS-y`.
- Linking the C++ runtime libraries (`libcxx`, `libcxxabi`, `libunwind`, `compiler-rt`) in the application Kraftfile.

**AVX2 guard:**

Redis 8's `config.h` automatically defines `HAVE_AVX2` on GCC ≥ 5 targeting x86_64, which causes build failures on platforms without AVX2 support.
Adding `-UHAVE_AVX2` to `LIBREDIS_FLAGS_SUPPRESS` prevents this.

**release.h generation:**

Redis 8 requires `src/release.h` to be generated by `mkreleasehdr.sh` before compilation.
A `UK_PREPARE` rule was added to `Makefile.uk` to run this script automatically.

Relevant pull request:

- [lib-redis#17](https://github.com/unikraft/lib-redis/pull/17): full upgrade

Tested on Unikraft stable (RELEASE-`0.21.0` Ijiraq) with `qemu/x86_64`.
The unikernel boots, loads the configuration file, and reaches `Ready to accept connections`.
The basic `redis-cli` commands respond as expected (connectivity check, write, and read-back).

## Core Bug Fixes

While working on the Redis upgrade, two bugs in the Unikraft core were identified and fixed.

### Missing `extern "C"` guard in platform PAL headers

When adding the `fast_float` C++ dependency to Redis 8, building `libcxxabi` (required for C++ runtime support) failed with:

```text
ukpal/include/uk/pal/ectx.h:63: error: conflicting declaration of
'void uk_pal_ectx_sanitize(uk_pal_ectx*)' with 'C' linkage
plat/native/pal/include/uk/plat/pal/ectx.h:28: note: previous
declaration with 'C++' linkage
```

The root cause is that `plat/native/pal/include/uk/plat/pal/ectx.h` and `plat/xen/pal/include/uk/plat/pal/ectx.h` define `uk_pal_ectx_*` functions as `static inline` without an `extern "C"` guard.
When these headers are included from C++ translation units (via `libcxxabi/cxa_guard.cpp` → `uk/syscall.h` → `uk/arch/ctx.h` → `uk/lcpu/ectx.h`), the functions receive C++ linkage, conflicting with the `extern "C"` declarations in `ukpal/include/uk/pal/ectx.h`.

The issue reproduces on a clean `helloworld-cpp` build on both stable and staging, confirming it is not specific to the Redis port.

The fix adds an `#ifdef __cplusplus` / `extern "C"` guard to both platform headers, consistent with `ukpal/ectx.h`.

Relevant pull request:

- [unikraft/unikraft#1832](https://github.com/unikraft/unikraft/pull/1832)

## Next Steps

- **Nginx**: upgrade the lib-nginx port to the latest stable version.
- **Python3**: upgrade the lib-python3 port.
- **libgo**: upgrade the libgo port (most complex, due to Go toolchain dependencies).

## Acknowledgements

Special thanks to Razvan Deaconescu, Stefan Jumarea, and Sriprad Potukuchi for their guidance, quick feedback, and for identifying the correct direction when issues arose.
Loading