Skip to content

Fix build with latest Swift toolchain snapshot#157

Merged
finnvoor merged 1 commit intomainfrom
push-ylknvokwwlwu
Jan 31, 2026
Merged

Fix build with latest Swift toolchain snapshot#157
finnvoor merged 1 commit intomainfrom
push-ylknvokwwlwu

Conversation

@finnvoor
Copy link
Owner

@finnvoor finnvoor commented Jan 31, 2026

Summary

  • Update .swift-version to main-snapshot-2026-01-09
  • Move ARM toolchain/sysroot include paths from Package.swift into the PDC plugin's device build, so they only apply during ARM cross-compilation and don't conflict with _DarwinFoundation modules on macOS 16+
  • Add pd_rand/pd_srand C wrappers — macOS 16 marks rand()/srand() as __swift_unavailable in Swift, but they're still callable from C
  • Move posix_memalign from Swift to C in setup.c — the new toolchain's swift_allocObject calls it, but the Swift @_cdecl version was being dead-stripped by the whole-module optimizer
  • Add swift_coroFrameAlloc stub required by the new runtime
  • Add bare-metal newlib syscall stubs (_getentropy, _kill, _getpid, _close, _lseek, _read, _write, _fstat, _isatty) required by the linker
  • Add -DTARGET_PLAYDATE=1 to the device toolset to match the SDK's common.mk
  • Fix Xkpd CLodePNG setup.c to use malloc/realloc/free instead of directly referencing pdrealloc function pointer (undefined behavior — pdrealloc is a function pointer, not a function)
  • Add function declarations to Xkpd CLodePNG string.h (shadows system header, needs the declarations)
  • Remove armSysrootPath and import Foundation from Xkpd Package.swift
  • Add macos-26 to CI matrix, fix Xkpd artifact name collision across matrix entries

Test plan

  • FlappySwift builds on macOS 16
  • Pong builds on macOS 16
  • Xkpd builds on macOS 16
  • CI passes on macOS 15, macOS 26, and Ubuntu

@finnvoor finnvoor marked this pull request as draft January 31, 2026 11:48
@finnvoor finnvoor force-pushed the push-ylknvokwwlwu branch 7 times, most recently from 32f3ef9 to 49ffc86 Compare January 31, 2026 13:27
@finnvoor finnvoor changed the title Fix linker errors with latest Swift toolchain snapshot Fix build with latest Swift toolchain snapshot Jan 31, 2026
@finnvoor finnvoor force-pushed the push-ylknvokwwlwu branch 7 times, most recently from 6c67b59 to 1c9ee19 Compare January 31, 2026 14:47
- Update .swift-version to main-snapshot-2026-01-09
- Add C standard library shim headers to CPlaydate to avoid ARM newlib
  module conflicts with _DarwinFoundation on macOS 16+
- Remove ARM toolchain/sysroot include paths from Package.swift since
  shims now provide the required declarations
- Add newlib syscall stubs and posix_memalign to setup.c for the new
  toolchain's linker requirements
- Move posix_memalign from Swift to C for proper linking
- Add TARGET_PLAYDATE=1 to toolset_device.json for conditional compilation
- Fix Xkpd CLodePNG/CQRCode build with minimal shim headers
- Fix qrcode_getModule Bool return type usage in Comic.swift
@finnvoor finnvoor marked this pull request as ready for review January 31, 2026 15:12
@finnvoor finnvoor enabled auto-merge (squash) January 31, 2026 15:17
@finnvoor finnvoor merged commit 08e4e65 into main Jan 31, 2026
12 checks passed
@finnvoor finnvoor deleted the push-ylknvokwwlwu branch January 31, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant