Skip to content

feat: add RTK (Rust Token Killer) to ralphex-fe image - #29

Closed
gatezh wants to merge 7 commits into
masterfrom
add-rtk-to-ralphex-fe
Closed

gatezh wants to merge 7 commits into
masterfrom
add-rtk-to-ralphex-fe

Conversation

@gatezh

@gatezh gatezh commented Mar 5, 2026

Copy link
Copy Markdown
Owner

Build RTK from source via multi-stage build (rust:alpine) to produce a native musl binary — the pre-built arm64 release is gnu-linked and incompatible with Alpine's musl libc.

gatezh and others added 7 commits March 5, 2026 13:52
Build RTK from source via multi-stage build (rust:alpine) to produce a
native musl binary — the pre-built arm64 release is gnu-linked and
incompatible with Alpine's musl libc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace QEMU-emulated arm64 Rust compilation (~23+ min) with native
amd64 cross-compilation (~3-4 min) using aarch64-linux-gnu-gcc linker.
Switch builder from rust:alpine to rust:slim-bookworm for cross-compilation
toolchain availability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The --platform=linux/amd64 on FROM is used deliberately to cross-compile
RTK natively instead of under QEMU emulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Install libc6-dev-arm64-cross and set --sysroot so the aarch64 cross-compiler
finds the correct C headers (fixes bits/libc-header-start.h not found).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The glibc cross-compiler (aarch64-linux-gnu-gcc) produces references to
glibc-specific symbols (open64, stat64, etc.) that don't exist in musl.
Switch to a proper musl cross-compiler from musl.cc that produces
musl-compatible binaries for Alpine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace musl.cc download (connection timeout in GitHub Actions) with zig,
which natively targets musl and downloads from a reliable CDN (ziglang.org).
A wrapper script invokes `zig cc -target aarch64-linux-musl` as the CC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace broken zig/musl.cc/gcc cross-compilation attempts with a proven
two-stage approach:
- amd64: native musl build on rust:alpine
- arm64: cross-compile using messense/rust-musl-cross:aarch64-musl
  (pre-built musl toolchain, runs natively on amd64, no QEMU)
- Dynamic FROM rtk-${TARGETARCH} selects the correct builder per platform

Both builds verified locally producing correct binaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gatezh

gatezh commented Mar 25, 2026

Copy link
Copy Markdown
Owner Author

Closing — superseded by #45 which rebuilt ralphex-fe from Alpine to Debian. The pre-built RTK binary works on Debian without the musl source build workaround this PR introduced.

@gatezh gatezh closed this Mar 25, 2026
@gatezh
gatezh deleted the add-rtk-to-ralphex-fe branch March 26, 2026 01:00
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