Skip to content

build: Windows-ARM64 via FPC cross-build — updater suffix + Makefile CROSS_TARGET - #115

Merged
FMXExpress merged 2 commits into
mainfrom
claude/win-arm64-support
Jun 1, 2026
Merged

FMXExpress merged 2 commits into
mainfrom
claude/win-arm64-support

Conversation

@FMXExpress

@FMXExpress FMXExpress commented Jun 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two changes preparing PasClaw for Windows-on-ARM64 — scoped down from the original draft after Codex review + the user noting they're on Delphi 12 (which doesn't ship either ARM Windows target).

Two commits on the branch:

  1. 30c9e6e — original draft (updater + dproj + Makefile)
  2. b8dba83 — review fixes: drop dproj changes, correct Delphi conditional symbols

What's in the final state

1. PasClaw.Updater.HostPlatformSuffix — canonical Delphi/FPC ARM symbols

update --repo owner/name from an ARM Windows binary now looks for the right asset suffix on the release page. Uses Embarcadero's canonical conditional defines (not the made-up CPU_ARM64 / CPU64 symbols from the draft):

{$IF DEFINED(CPUARM64) OR DEFINED(CPUAARCH64)}
  Result := 'windows_arm64.exe';                   // Delphi 13 ARM / FPC aarch64
{$ELSEIF DEFINED(CPUX86_64) OR DEFINED(CPU64BITS)}
  Result := 'windows_amd64.exe';                   // FPC x86_64 / Delphi 64-bit
{$ELSE}
  Result := 'windows_386.exe';
{$ENDIF}

2. Makefile — CROSS_TARGET override

Host autodetection unchanged. New override sits in front for cross-builds:

make CROSS_TARGET=aarch64-win64 \
     FPC_UNITS_DIR=/opt/fpc/units/aarch64-win64 \
     FPC='fpc -Twin64 -Paarch64' \
     BIN=build/pasclaw-arm64.exe

Errors loudly if FPC_UNITS_DIR isn't provided when CROSS_TARGET is set — different FPC packagings (Debian's fpc-aarch64-win64, FPC source build, vendored tree) lay out unit dirs differently.

What was reverted

The original draft added Win64x to the dproj's TargetedPlatforms fan-out, but:

  • Win64x is the C++Builder x64 toolchain (BCC64X), NOT the Delphi ARM Windows target. (Codex P1.)
  • Delphi 13's actual Windows-on-ARM target is WinArm64EC.
  • The user is on Delphi 12, which ships neither.

Exposing a platform identifier the IDE doesn't recognise could confuse the Project Manager on dproj reload. Cleanest fix: revert all three dproj edits (Base_Win64x PropertyGroup, Base_Win64x DCC_UsePackage block, <Platform value="Win64x">). The dproj is back to Win32 / Win64 / Linux64 — exactly what Delphi 12 ships.

When the user upgrades to Delphi 13 and wants ARM Windows, they can add WinArm64EC via the Project Manager (the IDE writes the right XML automatically). README's cross-platform line notes this explicitly.

Verification

make clean && make smoke 11/11 green on host Linux x86_64. The new CROSS_TARGET path is a no-op when unset.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon


Generated by Claude Code

Three small changes prepare the build for Delphi 13's Win64x
(ARM Windows) and FPC's aarch64-win64 cross-target. None of the
runtime code paths need touching — PasClaw is pure Pascal end to
end, no inline asm, no x86-only WinAPI calls — so this is metadata
+ release-binary naming + cross-compile invocation, ~50 LOC total.

1. PasClaw.Updater.HostPlatformSuffix

   The release-binary naming convention has always had
   darwin_arm64 / darwin_amd64 / linux_arm64 / linux_amd64
   branches but Windows only emitted windows_amd64.exe regardless
   of CPU. Added:

     {$IF DEFINED(CPUAARCH64) OR DEFINED(CPU_ARM64)}
       Result := 'windows_arm64.exe';
     {$ELSEIF DEFINED(CPUX86_64) OR DEFINED(CPU_X64) OR DEFINED(CPU64)}
       Result := 'windows_amd64.exe';

   So an `update --repo owner/name` from an ARM Windows binary
   now looks for the right asset suffix on the release page.

2. PasClaw.dproj — Win64x platform fan-out

   Delphi 13 ships Win64x as the ARM Windows target identifier.
   The dproj gets:

     <PropertyGroup Condition="('$(Platform)'=='Win64x' and ...)
                                or '$(Base_Win64x)'!=''">
       ... CfgParent=Base, Base=true ...
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win64x)'!=''">
       <DCC_UsePackage>vcl;rtl;$(DCC_UsePackage)</DCC_UsePackage>
       <BT_BuildType>Debug</BT_BuildType>
     </PropertyGroup>

   Plus `<Platform value="Win64x">True</Platform>` in the
   ProjectExtensions Platforms list so the IDE shows it in the
   project's platform picker. DCC_UnitSearchPath + DCC_Namespace
   + DCC_UnitAlias are picked up from the existing Base
   PropertyGroup so the search-path / RTL-namespace work
   already-validated for Win64 carries over.

   TargetedPlatforms bit not bumped — Delphi adds it automatically
   when the IDE first enables a platform via the Project
   Manager, and the conditional groups above work regardless.

3. Makefile — CROSS_TARGET override

   The host-target uname autodetection stays the same; new
   CROSS_TARGET block sits in front of it:

     ifneq ($(CROSS_TARGET),)
       FPC_ARCH ?= $(CROSS_TARGET)
       ifndef FPC_UNITS_DIR
         $(error CROSS_TARGET=$(CROSS_TARGET) requires FPC_UNITS_DIR ...)
       endif
     else ifeq ($(UNAME_S),Darwin)
       ...
     endif

   Usage:

     make CROSS_TARGET=aarch64-win64 \
          FPC_UNITS_DIR=/opt/fpc/units/aarch64-win64 \
          FPC='fpc -Twin64 -Paarch64' \
          BIN=build/pasclaw-arm64.exe

   No assumption about where the cross-build's unit tree lives
   (varies per packaging — Debian's fpc-aarch64-win64, FPC source
   build with CPU_TARGET=aarch64 OS_TARGET=win64, or a vendored
   tree) so the Makefile errors if FPC_UNITS_DIR isn't provided
   when CROSS_TARGET is set.

Runtime caveats stay the same as the other Windows targets:

  * OpenSSL ARM64 DLLs (libcrypto-3-arm64.dll / libssl-3-arm64.dll)
    must be on PATH for HTTPS provider + MCP traffic. OpenSSL.org
    ships them. Without them Indy reports "TLS support requires
    OpenSSL but the libraries could not be loaded."
  * sqlite3.dll ARM64 build required for the memory FTS5 index.

These are deployment-time concerns, not code changes.

Verified `make clean && make smoke` 11/11 green on the host
Linux x86_64 build — the new CROSS_TARGET path is a no-op on the
host path. README's Cross-platform feature line updated to call
out Win64x + the CROSS_TARGET invocation pattern.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30c9e6ed5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pasclaw/PasClaw.dproj Outdated
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64x' and '$(Base)'=='true') or '$(Base_Win64x)'!=''">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use WinArm64EC for the Delphi ARM platform

For Delphi 13.1 Windows-on-ARM builds, this platform fan-out never matches: RAD Studio names the Delphi target WinArm64EC, while Win64x is the separate modern x64 C++Builder toolchain. The same incorrect value is added to the <Platforms> list below, so this .dproj still does not expose or configure the Delphi ARM target advertised by the change. Embarcadero documents the Delphi target as WinArm64EC in the Arm64EC guide and documents Win64x as the modern Windows x64 C++ toolchain in the BCC64X guide.

Useful? React with 👍 / 👎.

Comment thread src/pkg/updater/PasClaw.Updater.pas Outdated
Comment on lines +64 to +65
{$IF DEFINED(CPUAARCH64) OR DEFINED(CPU_ARM64)}
Result := 'windows_arm64.exe';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check Delphi's CPUARM64 symbol for ARM updater assets

When this unit is compiled for Delphi's Windows-on-ARM target, the new branch is skipped because Delphi defines CPUARM64, not CPU_ARM64; it also defines CPU64BITS, not the CPU64 checked by the following branch. As a result, a Delphi Arm64EC binary falls through to windows_386.exe and update --repo cannot select a windows_arm64.exe release asset. FPC's CPUAARCH64 path is covered, but the Delphi spelling should also be included; Embarcadero lists the Arm64EC conditionals in the official guide.

Useful? React with 👍 / 👎.

…tform

Two Codex findings on PR #115, both legitimate, plus the
user's correction that they're on Delphi 12 (which doesn't ship
either ARM Windows target).

P1 — Wrong dproj platform identifier (and user is on Delphi 12
anyway). PR #115 added Win64x to the project's TargetedPlatforms
fan-out thinking that was the ARM Windows target. It isn't:
Win64x is the modern x64 C++Builder toolchain (BCC64X);
Delphi's actual Windows-on-ARM target is WinArm64EC, shipping
in Delphi 13.x. And the user's IDE is Delphi 12, which doesn't
have either — exposing a platform identifier the IDE doesn't
recognise could confuse the Project Manager on dproj reload.

Fix: reverted all three dproj changes from PR #115 — dropped
the Base_Win64x PropertyGroup, the corresponding Base_Win64x
DCC_UsePackage block, and the <Platform value="Win64x"> entry
in ProjectExtensions. The dproj is back to Win32 / Win64 /
Linux64 — exactly what Delphi 12 ships. When the user upgrades
to Delphi 13 and wants ARM Windows, they can add `WinArm64EC`
via the Project Manager (which writes the right XML automatically).

README's cross-platform feature line updated to drop the
Win64x reference and instead point at the Makefile's
CROSS_TARGET=aarch64-win64 path for FPC users, plus a note that
the Delphi 13 WinArm64EC target isn't wired into the dproj yet.

P2 — Wrong Delphi conditional symbols in HostPlatformSuffix.
PR #115 used CPU_ARM64 / CPU_X64 / CPU64, none of which Delphi
or FPC actually define as canonical symbols on Windows targets.
Per Embarcadero's documented conditional defines:

  Delphi Windows ARM64: CPUARM64
  FPC    Windows ARM64: CPUAARCH64
  Delphi Windows x64:   CPU64BITS
  FPC    Windows x64:   CPUX86_64

Fix: replaced the {$IF DEFINED(...)} chain with the canonical
symbols above. The Delphi ARM branch now picks the
windows_arm64.exe suffix when the binary is actually built for
it; previously Delphi binaries fell through to windows_386.exe.

Verified `make clean && make smoke` 11/11 green. Delphi build
behaviour can't be CI-verified from this Linux container, but
the symbol swap is a one-for-one map against Embarcadero's
canonical list and the dproj is back to its pre-#115 state
modulo the (correct) Makefile + Updater changes that don't
need ARM dproj support to function.

The Makefile's CROSS_TARGET=aarch64-win64 path (the third change
in PR #115) is unchanged and still useful — it lets FPC users
cross-build for Windows-ARM regardless of what Delphi supports.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
@FMXExpress FMXExpress changed the title build: Windows-on-ARM64 — updater suffix + dproj Win64x + Makefile CROSS_TARGET build: Windows-ARM64 via FPC cross-build — updater suffix + Makefile CROSS_TARGET Jun 1, 2026
@FMXExpress
FMXExpress merged commit 1bce819 into main Jun 1, 2026
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.

2 participants