Skip to content

Fix iOS simulator linking and close iOS setup doc gaps#290

Open
gmarull wants to merge 5 commits into
coredevices:masterfrom
teslabs:ios-build-fixes
Open

Fix iOS simulator linking and close iOS setup doc gaps#290
gmarull wants to merge 5 commits into
coredevices:masterfrom
teslabs:ios-build-fixes

Conversation

@gmarull

@gmarull gmarull commented Jul 8, 2026

Copy link
Copy Markdown
Member

Went through the iOS setup on a fresh machine (macOS, Xcode 26.6) following the README, and hit a few issues along the way. This PR fixes what can be fixed in this repo and updates the docs for the rest.

Code fix

  • composeApp/build.gradle.kts hardcoded the device Swift toolchain library path (usr/lib/swift/iphoneos) in the framework linker options for all Apple targets, while the per-target osName computed right above is only used for the LibPebbleSwift directory. On simulator links (deployment target < iOS 15) the Swift driver autolinks libswiftCompatibility56.a, and the hardcoded path made ld pick the device build of it, hard-failing the link. Went unnoticed because CI only builds iosArm64.

Doc fixes

  • The "GitHub token for speex" prerequisite is stale: speex resolves from Maven Central now, and no build script reads GitHub credentials from local.properties. What a fresh setup actually needs there is sdk.dir — the Gradle build requires an Android SDK even for iOS-only builds ("SDK location not found" otherwise). Replaced the step with Android Studio + local.properties instructions.
  • Recent Xcode ships without the iOS platform — on a fresh install, any iOS build fails with "iOS X.Y is not installed". Documented xcodebuild -downloadPlatform iOS.
  • Firebase account shouldn't be required just to build: added GoogleService-Info-dummy.plist (iOS counterpart of google-services-dummy.json) and documented copying it into place. The app builds and runs fine with it.

Known issue (needs a fix outside this repo)

Even with the linker path fix, simulator builds still fail: every published version of io.github.coredevices.speex on Maven Central ships a device-built libspeex.a inside the iosSimulatorArm64 cinterop klib — all 31 objects are tagged LC_BUILD_VERSION platform 2 (iOS) instead of 7 (iOS-Simulator). The library needs to be rebuilt/republished with a proper simulator slice; I added a known-issue note to the README pointing at the failure signature. (I verified the rest of the chain works by patching the platform tags in the cached klib locally — with that plus the linker path fix, the app builds, installs and runs on the iOS 26.5 simulator.)

🤖 Generated with Claude Code

gmarull and others added 5 commits July 8, 2026 22:38
The framework linker options hardcoded the device Swift toolchain
library directory (usr/lib/swift/iphoneos) for all Apple targets,
instead of using the already-computed per-target osName (as done for
the LibPebbleSwift framework directory a few lines above).

When linking for the iOS simulator with a deployment target below
iOS 15, the Swift driver autolinks libswiftCompatibility56.a, and the
hardcoded search path made ld pick the device build of that archive,
failing the link with:

    ld: building for 'iOS-simulator', but linking in object file
    (.../usr/lib/swift/iphoneos/libswiftCompatibility56.a[arm64][6]
    (Overrides.cpp.o)) built for 'iOS'

This went unnoticed because CI only compiles/links device (iosArm64)
binaries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The iOS prerequisites told contributors to put GitHub credentials in
local.properties for the speex module, but speex now resolves from
Maven Central and no build script reads GitHub credentials from
local.properties anymore.

What a fresh iOS setup actually fails on is the missing Android SDK:
the Gradle build applies the Android Gradle plugin in several modules,
so even an iOS-only build aborts with "SDK location not found".
Document installing Android Studio (which provides the SDK) and
pointing sdk.dir at it, which is the real reason local.properties is
needed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Recent Xcode versions ship without the iOS platform; on a fresh
install, building for any iOS destination (device or simulator) fails
with "iOS X.Y is not installed. Please download and install the
platform". Document downloading it via xcodebuild -downloadPlatform
iOS, and renumber the following steps.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Building the iOS app currently requires creating a Firebase account
just to obtain a GoogleService-Info.plist, even for contributors who
don't use any Firebase-dependent feature. Provide a dummy config with
placeholder values — the iOS counterpart of the existing
google-services-dummy.json on Android — and document copying it into
place. The app builds and runs fine with it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The io.github.coredevices.speex simulator artifacts on Maven Central
embed a device-built libspeex.a in the iosSimulatorArm64 cinterop klib
(all published versions: the 31 objects are tagged LC_BUILD_VERSION
platform 2/iOS instead of 7/iOS-Simulator), so simulator links fail
even with the Swift library search path fixed. This needs a republish
of the speex library; document the failure signature and the physical
device workaround until then.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gmarull
gmarull requested a review from sjp4 July 8, 2026 21:35
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