Skip to content

iOS release: fix erl_errno shim newline + preflight the driver table#14

Merged
GenericJam merged 1 commit into
masterfrom
ios-release-fixes
Jun 2, 2026
Merged

iOS release: fix erl_errno shim newline + preflight the driver table#14
GenericJam merged 1 commit into
masterfrom
ios-release-fixes

Conversation

@GenericJam
Copy link
Copy Markdown
Owner

Two issues that break mix mob.release --ios against the Elixir 1.20-rc.5 / OTP 29 runtime (OTP hash 7d46fdd4). Both only affect the App Store release path — the dev build is unaffected — which is why they hadn't surfaced before (AirCartMax / Code to Cloud shipped on an older OTP). Found while shipping a Livebook-on-mob app.

1. erl_errno_id_unknown shim written with a literal \n

The weak-stub line was printf '%s\\n' '…' > erl_errno_id_compat.c inside the ~S""" (raw, no-escape) release-script heredoc. The two backslashes reach bash verbatim, so printf '%s\\n' emits a literal backslash-n into the C file and clang rejects the trailing }\n:

erl_errno_id_compat.c:1:101: error: expected identifier or '('
    1 | …return "unknown"; }\n

Fix: printf '%s\n' (one backslash) so a real newline is emitted. This matches the working SLIM-log printf elsewhere in the same heredoc. Added a regression guard to release_script_test (assert sh =~ ~S|printf '%s\n'…|, refute sh =~ ~S|printf '%s\\n'|).

2. Cryptic failure when priv/generated/driver_tab_ios.c is missing

The iOS release links a per-app static-NIF driver table from priv/generated/driver_tab_ios.c, but the dev build uses Mob's built-in Zig table and mix mob.regen_driver_tab defaults to Zig. A project that only ever did dev builds (or ran regen without --format c) dies deep in release_device.sh with cc: no such file or directory: 'priv/generated/driver_tab_ios.c'.

Fix: a build_ipa preflight (check_driver_table/0) that fails early via the existing {:error, _} path with the exact command to run (mix mob.regen_driver_tab --format c). Chosen over auto-regen because --format c tables are meant to be hand-editable, so silently regenerating could clobber edits.

Verification

  • mix test test/mob_dev/release_script_test.exs → 35 passed (incl. new guard).
  • Both fixes verified end-to-end producing a signed, App-Store-accepted IPA.

Not included

A third issue — the OTP 29 iOS libbeam.a (hash 7d46fdd4) shipping both erl_posix_str.o and erl_errno_str.o, each defining _erl_errno_id (ld64 duplicate-symbol; zig/LLD tolerates it) — lives in the OTP cross-build / published tarball, not here. Tracked separately.

🤖 Generated with Claude Code

Two issues that break `mix mob.release --ios` (the dev build is unaffected;
both only bite the App Store release path, surfaced shipping a 1.20/OTP29 app):

1. The erl_errno_id_unknown weak-stub line used `printf '%s\\n'` inside the
   ~S (raw) release-script heredoc, so bash received the two backslashes
   verbatim and printf wrote a literal backslash-n into erl_errno_id_compat.c —
   clang then rejects the trailing `}\n`. Use `printf '%s\n'` (one backslash)
   so a real newline is emitted. Added a regression guard to
   release_script_test.

2. The release links a per-app priv/generated/driver_tab_ios.c, but the dev
   build uses the built-in Zig table and `mix mob.regen_driver_tab` defaults to
   Zig, so a project that never ran it with `--format c` dies deep in
   release_device.sh with a cryptic `cc: no such file`. Add a build_ipa
   preflight that fails early with the exact command to run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@GenericJam GenericJam merged commit 306950d into master Jun 2, 2026
3 checks passed
@GenericJam GenericJam deleted the ios-release-fixes branch June 2, 2026 05:42
GenericJam added a commit that referenced this pull request Jun 2, 2026
…reflight)

Ships PR #14: printf '%s\n' (real newline in the erl_errno_id_unknown shim)
and a build_ipa preflight that fails early with the regen command when
priv/generated/driver_tab_ios.c is missing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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