PC パソコン

How to Fix Xcode “Undefined Symbol: _swift_coroFrameAlloc” for arm64

Linking a Swift static library or XCFramework can fail with “Undefined symbols for architecture arm64: _swift_coroFrameAlloc.”

A notable case occurs when a static library built with Xcode 26 is consumed by an application built with Xcode 16. The newer Swift compiler emits a reference to a runtime symbol that the older toolchain’s link environment cannot provide.

Typical error

Undefined symbols for architecture arm64:
  "_swift_coroFrameAlloc", referenced from:
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1

Although the message mentions arm64, this is not necessarily an Excluded Architectures problem. The references may come from Swift modify accessors, concurrency-related code, or a precompiled third-party library.

Cause: mismatched Swift compiler and runtime generations

_swift_coroFrameAlloc is a Swift runtime symbol referenced by code generated by newer Swift compilers. A binary produced by a newer Xcode can contain that reference, while an older Xcode may not have the compatible link-time runtime support.

A documented reproduction uses:

  • Static library built with Xcode 26
  • Application built with Xcode 16
  • iOS 13 deployment target on both projects

Matching deployment targets does not align the Swift toolchains. The deployment target defines the oldest operating system on which the product intends to run; it does not make a precompiled Swift binary from a newer compiler backward-compatible with an older Xcode linker.

Before changing deployment targets, signing, or architecture exclusions, compare the Xcode version used to build the library with the version used to build the app.

Fix 1: Build the app with Xcode 26 or later

The most direct fix is to build the application with the same or a newer Swift toolchain than the one used for the library.

xcodebuild -version
xcode-select -p

If multiple Xcode versions are installed, make sure Terminal and CI do not select an older copy.

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcodebuild -version

Align developer Macs, CI runners, and archive machines rather than fixing only the local GUI selection.

Fix 2: Rebuild the library with the older Xcode

If the application must remain on Xcode 16, rebuild the library with Xcode 16. Binary SDKs are generally most backward-compatible when built with the oldest toolchain that the vendor officially supports.

DEVELOPER_DIR=/Applications/Xcode16.app/Contents/Developer \
xcodebuild -project MyLibrary.xcodeproj \
  -scheme MyLibrary \
  -configuration Release \
  -sdk iphoneos   clean build

For a vendor-supplied binary, request an Xcode 16-compatible build or obtain source and build it using the same toolchain as the app.

Fix 3: Distribute toolchain-compatible XCFrameworks

Library vendors should clearly document supported Xcode versions and package device and simulator slices as an XCFramework.

xcodebuild -create-xcframework \
  -archive MyLibrary-iOS.xcarchive \
  -framework MyLibrary.framework \
  -archive MyLibrary-Simulator.xcarchive \
  -framework MyLibrary.framework \
  -output MyLibrary.xcframework

Changing a .a into an XCFramework does not by itself solve a Swift runtime mismatch. The compiler used to create the contents still matters.

Identify the binary that requests the symbol

Read the linker output for the object or library that references _swift_coroFrameAlloc. You can also inspect a static archive with nm.

nm -u path/to/libMyLibrary.a | grep swift_coroFrameAlloc

find path/to/Frameworks -type f -perm +111 -print

If the reference comes from an advertising, video, Flutter, or other binary SDK, check for a release built for Xcode 16 or update the consuming project to the vendor’s required Xcode version.

Will BUILD_LIBRARY_FOR_DISTRIBUTION fix it?

BUILD_LIBRARY_FOR_DISTRIBUTION=YES emits a Swift module interface that improves module compatibility across compiler versions. It does not add a runtime symbol that is missing from an older link environment.

Swift module stability and runtime backward compatibility are separate concerns. If _swift_coroFrameAlloc remains undefined, align the Xcode toolchains.

Avoid unsupported workarounds

  • Defining a custom function named _swift_coroFrameAlloc
  • Manually copying Swift runtime libraries out of Xcode 26
  • Adding broad linker flags without identifying the required library
  • Excluding arm64 to avoid device linking
  • Assuming a matching deployment target guarantees compiler compatibility

These changes may hide the immediate message while introducing ABI problems or runtime crashes.

Clean stale products after aligning toolchains

Once both sides use compatible Xcode versions, remove old build products if Xcode still links the previous binary.

xcodebuild clean
rm -rf ~/Library/Developer/Xcode/DerivedData/YourProject-*

For Swift Package dependencies, consider File > Packages > Reset Package Caches. Cache deletion alone cannot repair a toolchain mismatch.

How to verify the fix

  1. Record xcodebuild -version for the library producer and app consumer.
  2. Use nm -u to identify which binary requests the symbol.
  3. Clean-build the library and app with the same Xcode.
  4. Test both device arm64 and simulator products.
  5. Run an Archive build, not only Debug.

Status as of September 2026

Apple Developer Forums contains a reproducible report for an Xcode 26-built static library linked by Xcode 16, filed as Feedback FB21130604. As of September 16, 2026, no Apple-documented build setting has been identified that safely makes this newer precompiled library compatible with the older linker.

Summary

“Undefined symbol: _swift_coroFrameAlloc” can indicate that a Swift binary built with Xcode 26 is being linked by an older toolchain such as Xcode 16. Build the app with the newer Xcode, or rebuild the library with the same older Xcode used by the consumer. Deployment-target and architecture changes do not solve the underlying Swift runtime mismatch.

References: Apple Developer Forums: Compiler / Reproduction project