Skip to content

PowerSyncKotlin XCFramework improvements#309

Merged
stevensJourney merged 5 commits intomainfrom
xcframework-improvements
Jan 15, 2026
Merged

PowerSyncKotlin XCFramework improvements#309
stevensJourney merged 5 commits intomainfrom
xcframework-improvements

Conversation

@stevensJourney
Copy link
Copy Markdown
Contributor

@stevensJourney stevensJourney commented Dec 31, 2025

The PowerSyncKotlin xcframework was being built with absolute paths embedded in the debug symbols and Clang module breadcrumbs. This caused issues when users integrated the framework into their projects.

The module cache warning

The built framework contained references to paths on the GitHub Actions runner like /Users/runner/work/powersync-kotlin/.../swift-module-cache/.../*.pcm. When users built their apps, they would see warnings like:

warning: /Users/runner/work/powersync-kotlin/powersync-kotlin/PowerSyncKotlin/build/skie/binaries/releaseFramework/RELEASE/iosSimulatorArm64/cache/swift-module-cache/293YMUHD5OD53/PowerSyncKotlin-33L2CQQA25AZM.pcm: No such file or directory

note: Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information.

This happens because the Swift compiler embeds DWARF skeleton compilation units for imported Clang modules when building with -gmodules. These reference .pcm files in the module cache which only exist on the build machine. SKIE's documentation recommends enabling the -no-clang-module-breadcrumbs flag when building redistributable static frameworks to prevent this.

The fix

This PR configures SKIE's produceDistributableFramework() which sets three flags: it removes the Clang module breadcrumbs from static frameworks via noClangModuleBreadcrumbsInStaticFrameworks, enables Swift library evolution for ABI stability, and uses relative paths in debug symbols instead of absolute ones via enableRelativeSourcePathsInDebugSymbols.

Verification

To verify the fix, I compared the old framework against the new build using the following commands.

Checking for .pcm references in the binary:

strings ~/Downloads/PowerSyncKotlin.xcframework/ios-arm64/PowerSyncKotlin.framework/PowerSyncKotlin | grep -i "\.pcm" | head -10

The old framework returned multiple .pcm paths pointing to the runner's machine. The new framework returns nothing.

Checking the debug symbol compilation directory:

cd ~/Downloads/PowerSyncKotlin.xcframework/ios-arm64/PowerSyncKotlin.framework
ar -x PowerSyncKotlin PowerSyncKotlin.o
dwarfdump --debug-info PowerSyncKotlin.o | head -50

The old framework showed DW_AT_comp_dir as /Users/runner/work/powersync-kotlin/.../iosArm64/swift. The new framework shows DW_AT_comp_dir as . (relative). Debug symbols are confirmed present in both builds via the .debug_info section in the dwarfdump output.

Verified when linking the PowerSyncKotlin framework locally to the PowerSync Swift SDK, the swift build command no longer warns about missing PCM files.

The PowerSyncExample Swift Demo application was also compiled and smoke tested with these local changes.

simolus3
simolus3 previously approved these changes Jan 5, 2026
Copy link
Copy Markdown
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

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

Enabling produceDistributableFramework() looks like a clear improvement to me, so I'm happy with that change 👍

Comment thread internal/PowerSyncKotlin/build.gradle.kts Outdated
Comment thread internal/PowerSyncKotlin/build.gradle.kts Outdated
@stevensJourney stevensJourney changed the title [wip]/[experiment]: XCFramework improvements PowerSyncKotlin XCFramework improvements Jan 15, 2026
@stevensJourney stevensJourney marked this pull request as ready for review January 15, 2026 08:58
@stevensJourney stevensJourney merged commit b195b34 into main Jan 15, 2026
10 checks passed
@stevensJourney stevensJourney deleted the xcframework-improvements branch January 15, 2026 09:26
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