Skip to content

[Build] Minimal build with the Core ML EP fails #29386

Description

@hnsyprst

Describe the issue

Minimal or extended minimal builds with the Core ML Execution Provider fail because getting the model metadata in coreml_execution_provider.cc on L63 requires Graph::GetModel(), which is only available in full (non-minimal) builds.

This can be fixed by falling back to the existing default behaviour of using model_hash as the user_provided_key in minimal builds rather than reading it from the model metadata. This removes the dependency on Graph::GetModel() in the minimal path.

Urgency

No response

Target platform

iOS

Build script

python tools/ci_build/build.py \
    --build_dir build/repro \
    --config MinSizeRel \
    --ios --use_xcode \
    --apple_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 14.0 \
    --use_coreml \
    --minimal_build extended \
    --skip_tests --parallel \
    --cmake_extra_defines CMAKE_POLICY_VERSION_MINIMUM=3.5

Error / output

coreml_execution_provider.cc:63:38: error: 
      no member named 'GetModel' in 'onnxruntime::Graph'
   63 |   const auto& metadata = main_graph->GetModel().MetaData();
      |                          ~~~~~~~~~~  ^
coreml_execution_provider.cc:115:12: error: 
      no matching function for call to 'CreateSupportedPartitions'
  115 |   result = utils::CreateSupportedPartitions(graph_viewer, is_node_supported, on_group_closed,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Visual Studio Version

No response

GCC / Compiler Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildbuild issues; typically submitted using templateep:CoreMLissues related to CoreML execution providerplatform:mobileissues related to ONNX Runtime mobile; typically submitted using template

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions