Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of 'required reason' iOS API from protobuf #20529

Conversation

skottmckay
Copy link
Contributor

@skottmckay skottmckay commented May 1, 2024

Description

Using certain APIs is about to require a privacy manifest to be added to a package.

Our version of protobuf uses mach_absolute_time. Patch as per protocolbuffers/protobuf#15662 to remove usage.

Motivation and Context

Usage of API will require a privacy manifest for an iOS app to be accepted as of 5/1/2024
#20519

@skottmckay
Copy link
Contributor Author

xcframework from nuget package in 1.18 branch. randomly selected build artifact with xcframework to show the issue with existing code

Output to show the multiple onnxruntime builds in the xcframework

find ort1.18_dev_nuget_xcframework -name onnxruntime
ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime
ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/onnxruntime
ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/onnxruntime

Binaries reference mach_absolute_time

find ort1.18_dev_nuget_xcframework -name onnxruntime | xargs grep -n -e mach_absolute_time
Binary file ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime matches
Binary file ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/onnxruntime matches
Binary file ort1.18_dev_nuget_xcframework/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/onnxruntime matches

xcframework from PR

  1. built with main pipeline which uses the build_host_protoc.sh script
    - stage: iOS_Full_xcframework
    dependsOn: []
    jobs:
    - job:
    workspace:
    clean: all
    pool:
    vmImage: 'macOS-latest'
    timeoutInMinutes: 300
    steps:
    - template: set-version-number-variables-step.yml
    - template: use-xcode-version.yml
    parameters:
    xcodeVersion: 14.2
    - script: |
    /bin/bash $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_host_protoc.sh \
    $(Build.SourcesDirectory) \
    $(Build.BinariesDirectory)/protobuf \
    $(Build.BinariesDirectory)/protobuf_install
    displayName: Build Host Protoc
    - template: download-deps.yml
    - task: PythonScript@0
    displayName: 'Update deps.txt'
    inputs:
    scriptPath: $(Build.SourcesDirectory)/tools/ci_build/replace_urls_in_deps.py
    arguments: --new_dir $(Build.BinariesDirectory)/deps
    workingDirectory: $(Build.BinariesDirectory)
    - script: |
    set -e -x
    python3 tools/ci_build/github/apple/build_apple_framework.py \
    --build_dir "$(Build.BinariesDirectory)/ios_framework" \
    --path_to_protoc_exe $(Build.BinariesDirectory)/protobuf_install/bin/protoc \
    tools/ci_build/github/apple/default_full_ios_framework_build_settings.json

~/onnxruntime_xcframework_testCI_protobuf_patch/ find -name onnxruntime
onnxruntime-ios-xcframework-1.19.0/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime
onnxruntime-ios-xcframework-1.19.0/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/onnxruntime
onnxruntime-ios-xcframework-1.19.0/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/onnxruntime

Binaries do not reference mach_absolute_time

~/onnxruntime_xcframework_testCI_protobuf_patch/ find -name onnxruntime | xargs grep -n -e mach_absolute_time
-- no matches --

  1. built with onnxruntime-ios-packaging pipeline which does protobuf build via build.py
    python tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
    --build-dir "$(Build.BinariesDirectory)/apple_framework" \
    --staging-dir "$(Build.BinariesDirectory)/staging" \
    --pod-version "$(ortPodVersion)" \
    --test \
    --variant ${{ parameters.packageVariant }} \
    --build-settings-file "${{ variables.buildSettingsFile }}" \
    ${{ variables.optionalIncludeOpsByConfigOption }}
    displayName: "Build macOS/iOS framework and assemble pod package files"

~/ios_packaging_artifacts_full/ find . -name onnxruntime
./pod-archive-onnxruntime-c/onnxruntime.xcframework/macos-arm64_x86_64/onnxruntime.framework/onnxruntime
./pod-archive-onnxruntime-c/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime
./pod-archive-onnxruntime-c/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/onnxruntime

Binaries do not reference mach_absolute_time

~/ios_packaging_artifacts_full/ find . -name onnxruntime | xargs grep -n -e mach_absolute_time
-- no matches --

@skottmckay skottmckay merged commit f9febc4 into main May 1, 2024
106 of 109 checks passed
@skottmckay skottmckay deleted the skottmckay/remove_usage_of_restricted_ios_func_from_protobuf branch May 1, 2024 22:21
@sophies927 sophies927 added the triage:approved Approved for cherrypicks for release label May 1, 2024
@yihonglyu yihonglyu added the cherry-picked Cherry-picked for a cherrypicks branch label May 4, 2024
yihonglyu pushed a commit that referenced this pull request May 4, 2024
### Description
<!-- Describe your changes. -->

Using certain APIs is about to require a [privacy
manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api)
to be added to a package.

Our version of protobuf uses `mach_absolute_time`. Patch as per
protocolbuffers/protobuf#15662 to remove usage.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Usage of API will require a privacy manifest for an iOS app to be
accepted as of 5/1/2024
#20519
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request May 7, 2024
)

### Description
<!-- Describe your changes. -->

Using certain APIs is about to require a [privacy
manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api)
to be added to a package.

Our version of protobuf uses `mach_absolute_time`. Patch as per
protocolbuffers/protobuf#15662 to remove usage.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Usage of API will require a privacy manifest for an iOS app to be
accepted as of 5/1/2024
microsoft#20519
@yihonglyu yihonglyu added the rel-merged Cherrypicks merged into release label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked Cherry-picked for a cherrypicks branch rel-merged Cherrypicks merged into release release:1.18.0 triage:approved Approved for cherrypicks for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants