fix: macOS xcframework build script bugs (single-arch linkage failure) - #196
Merged
Merged
Conversation
The Dart bindings switched to loading OuisyncService.framework on packaged apps, but the test path detection still tried to load the old dylib. Update the FLUTTER_TEST case to use the prebuilt framework in the Dart package directory (ouisync/bindings/dart/darwin/OuisyncService.framework) for macOS tests, matching the packaged app behavior. Fixes tests failing with: Failed to load dynamic library 'libouisync_service.dylib': dlopen(...) (no such file) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
build-xcframework.sh expanded empty target arrays (e.g. sim_libs when
iOS simulator targets are disabled in config.sh) with "${arr[@]}" under
set -u, which macOS's stock bash 3.2 treats as an unbound variable
instead of an empty expansion. Use the bash-3.2-safe
"${arr[@]+"${arr[@]}"}" idiom instead.
build-xcframework-macos.sh only built the host architecture, producing
a single-slice xcframework. Xcode links a universal (arm64 + x86_64)
binary by default, so this caused "Undefined symbols for architecture
x86_64" at link time. Build both macOS targets and lipo them into a
universal static lib instead.
Swift codegen emitted `return .{case}` for unit variants, which the
compiler silently resolves to Optional.none whenever the enum itself
has a case named `none` (e.g. Response.none), causing decode failures.
Use `return .some(.{case})` to disambiguate.
Also export MACOSX_DEPLOYMENT_TARGET=13.0 before building the Rust
static lib so its object files match the Xcode project's deployment
target instead of the host SDK's version, avoiding linker warnings.
madadam
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bash 3.2 whenever a target array (e.g. sim_libs) was empty, which
happens with the default config.sh (iOS simulator targets disabled).
"${arr[@]}" under set -u is treated as unbound in bash <4.4; switched
to the bash-3.2-safe "${arr[@]+"${arr[@]}"}" expansion.
a single-slice xcframework. Xcode links a universal (arm64 + x86_64)
binary by default, so this caused "Undefined symbols for architecture
x86_64" at link time for consumers of OuisyncLibFFI. Now builds both
macOS targets and lipos them into a universal static lib.