Skip to content

fix: raise macOS deployment target from 10.14 to 11.0#43

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/update-macosx-deployment-target
Closed

fix: raise macOS deployment target from 10.14 to 11.0#43
Copilot wants to merge 3 commits intomainfrom
copilot/update-macosx-deployment-target

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 5, 2026

Builds produced on macos-latest/macos-26 (Xcode 16+) while targeting macOS 10.14 generate binaries that fail at launch with dyld: symbol not found in flat namespace '_OBJC_CLASS_$__TtC5swift11Application'. Xcode 16's Swift codegen assumes Swift ABI stability (macOS 11.0+), making the 10.14 target incompatible with the updated CI runner.

Changes

  • macos/Runner.xcodeproj/project.pbxproj: Bumped MACOSX_DEPLOYMENT_TARGET from 10.1411.0 for both Debug and Release configurations, matching the existing Profile setting.
- MACOSX_DEPLOYMENT_TARGET = 10.14;  // Debug
+ MACOSX_DEPLOYMENT_TARGET = 11.0;

- MACOSX_DEPLOYMENT_TARGET = 10.14;  // Release
+ MACOSX_DEPLOYMENT_TARGET = 11.0;

All three build configurations now consistently target macOS 11.0.

Original prompt

Upgrade the MACOSX_DEPLOYMENT_TARGET for the macOS target in macos/Runner.xcodeproj/project.pbxproj from 10.14 to 11.0 for both Debug and Release build configurations. This is to resolve a dyld: symbol not found error (specifically _OBJC_CLASS_$__TtC5swift11Application) reported in issue #41, which occurs when building with newer macOS runners (like macos-latest or macos-26) while targeting an older macOS version.

Please search for all occurrences of MACOSX_DEPLOYMENT_TARGET = 10.14 in macos/Runner.xcodeproj/project.pbxproj and update them to 11.0.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: /Applications/PiliNara.app/Contents/MacOS/PiliNara
dyld[11674]: symbol not found in flat namespace 'OBJC_CLASS$__TtC5swift11Application'
[1] 11674 abort /Applications/PiliNara.app/Contents/MacOS/PiliNara

Assistant: The error dyld[11674]: symbol not found in flat namespace '_OBJC_CLASS_$__TtC5swift11Application' typically occurs in Flutter macOS applications when there is a mismatch between the Swift runtime expected by the binary and the one available on the host system, or when the Deployment Target is set too low for certain Swift features (like the @main attribute) to be properly resolved on older macOS versions.

Analysis of the Issue

  1. Symbol Meaning: The symbol _OBJC_CLASS_$__TtC5swift11Application refers to a Swift-defined class named Application in a module named swift. In a Flutter context, this often relates to how the AppDelegate or the main entry point is handled.
  2. Deployment Target: The project's project.pbxproj (lines 487 and 534) shows MACOSX_DEPLOYMENT_TARGET = 10.14. While 10.14 supports Swift, certain modern Swift features (like the @main entry point used in your AppDelegate.swift) can sometimes cause issues on older runtimes or if the app is built with a much newer Xcode but targeted at an older OS without proper backward compatibility libraries (Swift 5.0+ runtime is built into macOS 10.14.4+, but earlier versions required bundled libs).
  3. Xcode/Swift Version: The project is using SWIFT_VERSION = 5.0 (line 558). If the user is on macOS 14.7.1, they have a modern runtime, but if the binary was compiled on a different architecture or with a specific toolchain version that doesn't align with the x86_64 environment of macOS 14.7.1, this dynamic linking error occurs.

Suggested Solutions

1. Raise the Deployment Target

Raising the minimum supported macOS version often resolves linking issues with modern Swift features.

  • In Xcode, change the Minimum Deployments (MACOSX_DEPLOYMENT_TARGET) from 10.14 to 11.0 or higher.
  • Alternatively, edit macos/Runner.xcodeproj/project.pbxproj and change all instances of MACOSX_DEPLOYMENT_TARGET = 10.14 to 11.0.

2. Verify the Main Entry Point

Your AppDelegate.swift uses the @main attribute:

@main
class AppDelegate: FlutterAppDelegate { ... }

If the deployment target is low, sometimes the linker fails to find the synthesized main function.

  • Fix: Try replacing @main with a manual main.swift file or ensuring the NSPrincipalClass in Info.plist is correctly set to NSApplication.

3. Update CocoaPods and Build Environment

Since this is a Flutter project, the issue might be in how the native dependencies are linked.

  • Run the following in the project root:
    flutter clean
    flutter pub get
    cd macos
    rm -rf Pods Podfile.lock
    pod install --repo-update
    cd ..
    flutter build macos

4. Architecture Mismatch (Rosetta)

The issue reporter mentioned x86_64 macOS 14.7.1. If they are on an Intel Mac, ensure the build isn't accidentally stripping x86_64 symbols or targeting only arm64.

  • Check the "Architectures" setting in Xcode to ensure it is set to Standard Architectures (Apple Silicon, Intel).

Action for the Maintainer

I recommend updating the MACOSX_DEPLOYMENT_TARGET to 11.0 in the project.pbxproj file, as 10.14 is quite old and often triggers Swift runtime compatibility issues with modern Flutter versions (the pubspec.yaml indicates Flutter 3.41.6, which is very recent).

Would you like me to create a Pull Request to update the deployment target to 11.0?

User: 中文回复

Assistant: 针对您在 issue #41 中提到的 dyld: symbol not found in flat namespace '_OBJC_CLASS_$__TtC5swift11Application' 错误,这通常是由于 Swift 运行时版本不匹配macOS 部署目标(Deployment Target)设置过低 导致的。

在 Flutter 项目中,这类错误在 macOS 14.x 等较新系统上运行针对旧版本(如 10.14)编译的二进制文件时比较常见。

问题分析

  1. 部署目标过低:项目当前的 MACOSX_DEPLOYMENT_TARGET 设置为 10.14。对于使用 Flutter 3.41.6 等现代版本的项目,10.14 的运行时支持可能已出现碎片化,尤其是在处理 @main 属性或 Swift 5.0 动态链接时。
  2. 符号丢失:报错的符号 _OBJC_CLASS_$__TtC5swift11Application 指向 Swift 定义的 Application 类。如果系统动态链接器(dyld)找不到该符号,通常是因为构建时的 SDK 版本与运行环境不完全兼容。

建议解决方案

1. 提高部...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Update MACOSX_DEPLOYMENT_TARGET to 11.0 for macOS fix: raise macOS deployment target from 10.14 to 11.0 Apr 5, 2026
Copilot AI requested a review from Starfallan April 5, 2026 11:18
@Starfallan Starfallan closed this Apr 7, 2026
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