Skip to content

[Build]Linker error when building for macCatalyst: Object file built for macOS #24153

@jchen351

Description

@jchen351

Describe the issue

When building the Apple framework with macCatalyst support, the linker fails due to an object file being built for macOS rather than macCatalyst. The error message is:

ld: building for 'macCatalyst', but linking in object file (_deps/kleidiai-build/libkleidiai.a[28](kai_matmul_clamp_f32_qai8dxp1x4_qsi4c32p4x4_1x4_neon_dotprod_asm.S.o)) built for 'macOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Additional Notes

  • The issue appears to be related to the kleidiai dependency, which is providing an object file compiled for macOS.
  • It may be necessary to adjust the build settings or the way kleidiai is compiled to ensure compatibility with macCatalyst.

Target platform

macOS-14

Build script

From onnxruntime project root:

mkdir build && python3 tools/ci_build/github/apple/build_apple_framework.py --build_dir build settings.json

The build is configured using settings.json with the following content:

{
    "build_osx_archs": {
        "iphoneos": [
            "arm64"
        ],
        "iphonesimulator": [
            "arm64",
            "x86_64"
        ],
        "macabi": [
            "arm64",
            "x86_64"
        ]
    },
    "build_params": {
        "base": [
            "--parallel",
            "--build_apple_framework",
            "--use_coreml",
            "--skip_tests",
            "--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF"
        ],
        "iphoneos": [
            "--ios",
            "--use_xcode",
            "--use_xnnpack",
            "--apple_deploy_target=15.1"
        ],
        "iphonesimulator": [
            "--ios",
            "--use_xcode",
            "--use_xnnpack",
            "--apple_deploy_target=15.1"
        ],
        "macabi": [
            "--macos=Catalyst",
            "--apple_deploy_target=14.0"
        ]
    }
}

Error / output

ld: building for 'macCatalyst', but linking in object file (_deps/kleidiai-build/libkleidiai.a[28](kai_matmul_clamp_f32_qai8dxp1x4_qsi4c32p4x4_1x4_neon_dotprod_asm.S.o)) built for 'macOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

For more infomation, see log here.

GCC / Compiler Version

Xcode 15.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildbuild issues; typically submitted using templateplatform:mobileissues related to ONNX Runtime mobile; typically submitted using templatestaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions