opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
76.54k stars 55.64k forks source link

Xcode fails to install app which uses OpenCV XCframework #25609

Closed pa-akiya-ozawa closed 4 days ago

pa-akiya-ozawa commented 4 weeks ago

System Information

macOS: 14.5 Xcode: 15.3 ~ OpenCV: 4.9.0 Python 3.12.2 Cmake: 3.28.3

Detailed description

I have an XCode project which uses an OpenCV XCframework. When I try to run the project, Xcode can't install app as the error says below:

Domain: IXUserPresentableErrorDomain
Code: 1
Recovery Suggestion: Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist: No such file or directory
User Info: {
    DVTErrorCreationDateKey = "2024-05-17 05:41:15 +0000";
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
}
--
“Unable to install "my project"
Domain: IXUserPresentableErrorDomain
Code: 1
Recovery Suggestion: Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist: No such file or directory
User Info: {
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
}
--
Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    NSURL = "file:///Users/my.name/Library/Developer/Xcode/DerivedData/myProject-dlueqnybzsjgyjetnnxnfkpiswra/Build/Products/Debug-iphoneos/myProject.app/";
}
--
“Unable to install "my project"
Domain: IXUserPresentableErrorDomain
Code: 1
Failure Reason: Please try again later.
Recovery Suggestion: Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist: No such file or directory
--
Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.lsMXJF/extracted/Payload/myProject.app/Frameworks/opencv2.framework/Info.plist: No such file or directory
Domain: MIInstallerErrorDomain
Code: 35
User Info: {
    FunctionName = "-[MIBundle _validateWithError:]";
    LegacyErrorString = PackageInspectionFailed;
    SourceFileLine = 64;
}
--

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_isCoreDevice" = 1;
    "device_isWireless" = 1;
    "device_model" = "iPhone12,1";
    "device_osBuild" = "17.4.1 (21E236)";
    "device_platform" = "com.apple.platform.iphoneos";
    "dvt_coredevice_version" = "355.28";
    "dvt_mobiledevice_version" = "1643.120.2";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 10626;
    "operation_errorCode" = 1;
    "operation_errorDomain" = 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.5";
    "sdk_osVersion" = "17.5";
    "sdk_variant" = iphoneos;
}
--

System Information

macOS Version 14.5 (Build 23F79)
Xcode 15.4 (22622) (Build 15F31d)
Timestamp: 2024-05-17T14:41:15+09:00

However, there is an info.plist in the right directory so I suppose it's not the issue of referencing. This error has occurred since Xcode 15.3 (It works fine in Xcode 15.2). Will this issue be resolved in upcoming update (probably 4.10.0)?

Steps to reproduce

  1. Create OpenCV XCFramework by following this link
  2. Upload the binary on Github repository
  3. Load the binary via SPM
  4. Run it on Xcode

Issue submission checklist

yeatse commented 1 week ago

I encountered the same problem and resolved it by applying this patch.

pa-g-shu commented 4 days ago

It seems the requirement of bundle directory of the framework is changed from Xcode 15.3 and we solved the issue by creating the framework as dynamic(adding --dynamic parameter to the build script).

pa-akiya-ozawa commented 4 days ago

@pa-g-shu solved this issue so I close this.

It seems the requirement of bundle directory of the framework is changed from Xcode 15.3 and we solved the issue by creating the framework as dynamic(adding --dynamic parameter to the build script).