kewlbear / TensorFlowLiteSwift

16 stars 19 forks source link

Using TensorFlowLiteSwift in SPM causes code signing issues #6

Open tomekfab opened 3 years ago

tomekfab commented 3 years ago

I tried adding TensorFlowLiteSwift via SPM to our project, beginning a slow transition from carthage, but each time I add this particular lib I'm getting code signing issues and we can't run app on device from Xcode. Xcode version in the report says Xcode 13 but it's the same with Xcode 12.5. Is there anything one can do with this?

Details

Unable to install
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
    IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}
--
The code signature version is no longer supported.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
    DVTRadarComponentKey = 261622;
    MobileDeviceErrorCode = "(0xE8008029)";
    "com.apple.dtdevicekit.stacktrace" = (
    0   DTDeviceKitBase                     0x000000013be7a316 DTDKCreateNSErrorFromAMDErrorCode + 220
    1   DTDeviceKitBase                     0x000000013beb884a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
    2   DVTFoundation                       0x00000001091e0ed4 DVTInvokeWithStrongOwnership + 71
    3   DTDeviceKitBase                     0x000000013beb8594 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1420
    4   IDEiOSSupportCore                   0x000000013bbe8b4e __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.292 + 3508
    5   DVTFoundation                       0x0000000109314c37 __DVT_CALLING_CLIENT_BLOCK__ + 7
    6   DVTFoundation                       0x00000001093163a3 __DVTDispatchAsync_block_invoke + 931
    7   libdispatch.dylib                   0x00007fff201c3623 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x00007fff201c4806 _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x00007fff201ca5ea _dispatch_lane_serial_drain + 606
    10  libdispatch.dylib                   0x00007fff201cb0ad _dispatch_lane_invoke + 366
    11  libdispatch.dylib                   0x00007fff201d4c0d _dispatch_workloop_worker_thread + 811
    12  libsystem_pthread.dylib             0x00007fff2036b45d _pthread_wqthread + 314
    13  libsystem_pthread.dylib             0x00007fff2036a42f start_wqthread + 15
);
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone10,6";
    "device_osBuild" = "15.0 (19A344)";
    "device_platform" = "com.apple.platform.iphoneos";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 34152;
    "operation_errorCode" = "-402620375";
    "operation_errorDomain" = "com.apple.dt.MobileDeviceErrorDomain";
    "operation_errorWorker" = IDEInstalliPhoneLauncher;
    "operation_name" = IDEiPhoneRunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 5;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphoneos";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 0;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 0;
    "param_launcher_substyle" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_runnable_swiftVersion" = "5.5";
    "param_runnable_type" = 2;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphoneos15.0";
    "sdk_osVersion" = "15.0";
    "sdk_variant" = iphoneos;
}
--

System Information

macOS Version 11.6 (Build 20G165)
Xcode 13.0 (19234) (Build 13A233)
Timestamp: 2021-09-30T09:01:48+02:00
kewlbear commented 3 years ago

Have you seen this? https://developer.apple.com/forums/thread/679182

tomekfab commented 3 years ago

Yup, I did. I've spent a good amount of time trying to research and resolve this before I created this issue. I've tried adding other dependencies to our project via SPM and none of the other caused this problem except this one, I'm not very fluent in SPM since this is the first time I use it, but I was looking into artifacts in Derived Data and saw that when adding TensorFlowLiteSwift to our project a TensorFlowLiteC.xcframework is created in artifacts, when I added it directly to our project it was automatically added with option Embed & Sign and I had the same issue, only when I changed it to Do Not Embed I was able to run our app on device. Not sure if there's anything to make out of this information but I thought it might be relevant somehow

kewlbear commented 3 years ago

So the issue seems related to https://developer.apple.com/documentation/xcode/using-the-latest-code-signature-format. I tried various workarounds but can not get CodeDirectory v=20400 for TensorFlowLiteC frameworks.

tabqwertz commented 2 years ago

Any updates on this? Thanks!

ardyanrizki commented 1 year ago

I got a similar issue. Any updates?

justbcuz commented 10 months ago

Same issue, building with Xcode 15.2 to iPhone 13 Pro Max running 17.1.2


Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    DVTErrorCreationDateKey = "2024-01-17 22:10:56 +0000";
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
    NSURL = "file:///Users/e132740/Library/Developer/Xcode/DerivedData/FaceDetector-bceouumziwzbfpayidvtgaoooytm/Build/Products/Debug-iphoneos/FaceDetector.app/";
}
--
“FaceDetector” Needs to Be Updated
Domain: IXUserPresentableErrorDomain
Code: 17
Failure Reason: The developer of this app needs to update it to work with this version of iOS.
Recovery Suggestion: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.bi1KAJ/extracted/FaceDetector.app/Frameworks/TensorFlowLiteCMetal.framework : 0xe8008029 (The code signature version is no longer supported.)
--
Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.bi1KAJ/extracted/FaceDetector.app/Frameworks/TensorFlowLiteCMetal.framework : 0xe8008029 (The code signature version is no longer supported.)
Domain: MIInstallerErrorDomain
Code: 13
User Info: {
    FunctionName = "+[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]";
    LegacyErrorString = ApplicationVerificationFailed;
    LibMISErrorNumber = "-402620375";
    SourceFileLine = 78;
}
--

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_isCoreDevice" = 1;
    "device_model" = "iPhone14,3";
    "device_osBuild" = "17.1.2 (21B101)";
    "device_platform" = "com.apple.platform.iphoneos";
    "dvt_coredevice_version" = "355.7.7";
    "dvt_mobiledevice_version" = "1643.40.14.100.2";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 3349;
    "operation_errorCode" = 17;
    "operation_errorDomain" = "com.apple.dt.CoreDeviceError.3002.IXUserPresentableErrorDomain";
    "operation_errorWorker" = IDEInstallCoreDeviceWorker;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphoneos";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_checker_tpc_enable" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 0;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 99;
    "param_launcher_substyle" = 8192;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_structuredConsoleMode" = 1;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphoneos17.2";
    "sdk_osVersion" = "17.2";
    "sdk_variant" = iphoneos;
}
--

System Information

macOS Version 13.6 (Build 22G120)
Xcode 15.2 (22503) (Build 15C500b)
Timestamp: 2024-01-17T16:10:56-06:00```
tareksabry1337 commented 7 months ago

@kewlbear I was able to fix the code-signing shenanigans in TensorFlowLiteC / TensorFlowLiteCCoreML, I have created a repository that has SPM support for TensorFlowLiteC / TensorFlowLiteCCoreML, here's the link for that I'm eventually going to create TensorFlowLiteSwift as well that mirrors the current releases on TensorFlowLiteC, but one step at time.

tareksabry1337 commented 7 months ago

I have TesnorFlowLiteSwift out, Check it out using this link, It shouldn't have any code signing issues