yeatse / opencv-spm

Integrate OpenCV into your project using Swift Package Manager.
Apache License 2.0
75 stars 23 forks source link

Install to device fails on Xcode 15.3 (beta 2) #15

Closed max-christian closed 7 months ago

max-christian commented 9 months ago

Builds okay but install to device fails due to missing Info.plist:

Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    DVTErrorCreationDateKey = "2024-02-13 12:57:34 +0000";
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
    NSURL = "file:///Users/.....app/";
}
--
Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
    IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
    NSURL = "file:///....app/";
}
--
Unable to Install “.....”
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.AXpULF/extracted/Payload/....../Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.AXpULF/extracted/Payload/...../Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.AXpULF/extracted/Payload/...../Frameworks/opencv2.framework/Info.plist: No such file or directory

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_isCoreDevice" = 1;
    "device_model" = "iPad8,9";
    "device_osBuild" = "17.3 (21D50)";
    "device_platform" = "com.apple.platform.iphoneos";
    "dvt_coredevice_version" = "355.21";
    "dvt_mobiledevice_version" = "1643.60.2";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 14194;
    "operation_errorCode" = 35;
    "operation_errorDomain" = "com.apple.dt.CoreDeviceError.3002.IXUserPresentableErrorDomain.1.MIInstallerErrorDomain";
    "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" = 3;
    "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" = 1;
    "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.4";
    "sdk_osVersion" = "17.4";
    "sdk_variant" = iphoneos;
}
--

System Information

macOS Version 14.3.1 (Build 23D60)
Xcode 15.3 (22617) (Build 15E5188j)
Timestamp: 2024-02-13T12:57:34Z
yeatse commented 8 months ago

It's difficult for me to diagnose the specific issue you're facing, but I can confirm that I haven't encountered this problem on my setup. Have you attempted to clean your project or tested it with a release version of Xcode to see if the issue persists? FYI there is a demo project which can help you eliminate any potential confounding factors.

max-christian commented 8 months ago

Have you tried it on Xcode 15.3 (beta 2)? It works fine for me in Xcode 15.2.

yeatse commented 8 months ago

Have you tried it on Xcode 15.3 (beta 2)? It works fine for me in Xcode 15.2.

No. I also noticed that the newest beta release is actually Xcode 15.3 beta 3. Anyway let's wait for the stable version to see if the problem persists.

Hans92 commented 8 months ago

I'm having exactly the same issue while installing an app on a device or simulator with Xcode 15.3 RC:

Failed to load Info.plist from bundle at path /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.vtF54A/extracted/XXX.app/Frameworks/opencv2.framework; Extra info about "/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.vtF54A/extracted/XXX.app/Frameworks/opencv2.framework/Info.plist": Couldn't stat /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.vtF54A/extracted/XXX.app/Frameworks/opencv2.framework/Info.plist: No such file or directory
max-christian commented 8 months ago

I'm no expert on frameworks but from what I've read the fix might be to add an Info.plist to the framework with just CFBundleShortVersionString & CFBundleVersion specified.

yeatse commented 8 months ago

I'm no expert on frameworks but from what I've read the fix might be to add an Info.plist to the framework with just CFBundleShortVersionString & CFBundleVersion specified.

Thank you for pointing this out. It appears that Apple is not adhering to its own documentation in Xcode version 15.3. I will look into this later.

yeatse commented 8 months ago

Found similar issues on Github: https://github.com/ProtonMail/gopenpgp/issues/271 https://github.com/golang/go/issues/66018 https://github.com/googleads/swift-package-manager-google-user-messaging-platform/issues/8

I'll keep an eye on these to find an appropriate workaround.

max-christian commented 8 months ago

Thanks for looking at this, @yeatse . I'm getting additional problems with the released build of Xcode 15.3, and also some more specific error messages which may be helpful.

The info.plist error now makes more sense, says "Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle my.app/Frameworks/opencv2.framework is required" so hopefully that's easy to fix.

Any idea what this "The “my.app/Frameworks/opencv2.framework/Versions/A/opencv2” binary file is not permitted. Your app cannot contain standalone executables or libraries" error means?

2024-03-08 12:45:22.385 ERROR: [ContentDelivery.Uploader] Asset validation failed (90035) Invalid Signature. Code failed to satisfy specified code requirement(s). The file at path “my.app/Frameworks/opencv2.framework/Versions/A/opencv2” is not properly signed. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose “Clean All” in Xcode, delete the “build” directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/support/code-signing. (ID: f4a6a7ee-450a-401a-becd-22ae8c1a872b)

2024-03-08 12:45:22.386 ERROR: [ContentDelivery.Uploader] Asset validation failed (90171) Invalid bundle structure. The “my.app/Frameworks/opencv2.framework/Versions/A/opencv2” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: 939d18c1-4047-4d4f-b0a1-59821b351f5e)

2024-03-08 12:45:22.387 DEBUG: [ContentDelivery.Uploader] Error Domain=ContentDelivery Code=90360 "Asset validation failed" UserInfo={NSLocalizedFailureReason=Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle my.app/Frameworks/opencv2.framework is required. (ID: 3211e493-e4c8-4ac3-89a0-5572753a78bc), NSUnderlyingError=0x6000039cec10 {Error Domain=IrisAPI Code=-19241 "Asset validation failed" UserInfo={status=409, detail=Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle my.app/Frameworks/opencv2.framework is required., id=3211e493-e4c8-4ac3-89a0-5572753a78bc, code=STATE_ERROR.VALIDATION_ERROR.90360, title=Asset validation failed, NSLocalizedFailureReason=Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle my.app/Frameworks/opencv2.framework is required., NSLocalizedDescription=Asset validation failed}}, iris-code=STATE_ERROR.VALIDATION_ERROR.90360, NSLocalizedDescription=Asset validation failed}
max-christian commented 8 months ago

Possibly the binary needs to be moved from /Versions/A/ to the root folder of the framework to work on iOS? Let me know if you're too busy to look at this and I'll try to find time next week.

yeatse commented 8 months ago

The point is that opencv2.framework should not be bundled into app at all as it's a static library. I have no idea what changed in Xcode. Tried to refactor the file structure but got no luck. Weird.

bigMOTOR commented 8 months ago

Same here with released version 15.3 (15E204a)

georgepadayatti commented 8 months ago

Same here with Version 15.2 (15C500b) when selecting Embed & Sign. It got fixed once I selected Do Not Embed, but not really sure how it got fixed and what it really means.

georgepadayatti commented 8 months ago

CFBundleShortVersionString & CFBundleVersion

Is it the info.plist file in the root of the framework ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AvailableLibraries</key>
    <array>
        <dict>
            <key>BinaryPath</key>
            <string>ABC.framework/Versions/A/ABC</string>
            <key>LibraryIdentifier</key>
            <string>ios-arm64_x86_64-simulator</string>
            <key>LibraryPath</key>
            <string>ABC.framework</string>
            <key>SupportedArchitectures</key>
            <array>
                <string>arm64</string>
                <string>x86_64</string>
            </array>
            <key>SupportedPlatform</key>
            <string>ios</string>
            <key>SupportedPlatformVariant</key>
            <string>simulator</string>
        </dict>
        <dict>
            <key>BinaryPath</key>
            <string>ABC.framework/Versions/A/ABC</string>
            <key>LibraryIdentifier</key>
            <string>ios-arm64</string>
            <key>LibraryPath</key>
            <string>ABC.framework</string>
            <key>SupportedArchitectures</key>
            <array>
                <string>arm64</string>
            </array>
            <key>SupportedPlatform</key>
            <string>ios</string>
        </dict>
    </array>
    <key>CFBundlePackageType</key>
    <string>XFWK</string>
    <key>XCFrameworkFormatVersion</key>
    <string>1.0</string>
</dict>
</plist>
yinhaosen commented 8 months ago

Same here with Xcode 15.3 release, i'm going to downgrade the Xcode version.

yeatse commented 7 months ago

Should be fixed in the latest release. Please update to the latest version using main branch.

SencyNetanel commented 7 months ago

I am using version 4.9.0+11 and I am still having issues uploading to the app store.

Asset validation failed
Invalid bundle structure. The “MyApp.app/Frameworks/opencv2.framework/opencv2” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: ead35781-db31-4807-8108-729da79c9bf0)

Asset validation failed
Invalid bundle structure. The “MyApp.app/Frameworks/opencv2.framework/Versions/A/opencv2” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: d9b16b4a-68e4-4c6e-a052-0743197d8360)

Asset validation failed
Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle MyApp.app/Frameworks/opencv2.framework is required. (ID: b955705f-e151-462e-a618-719e3a01a848)

Asset validation failed
This bundle is invalid. The bundle at path Payload/MyApp.app/Frameworks/opencv2.framework has an invalid CFBundleIdentifier '' CFBundleIdentifier must be present, must contain only alphanumerics, dots, hyphens and must not end with a dot. [see the Core Foundation Keys at https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102070-TPXREF105] (ID: b4dac887-c059-4659-a16c-ef1fa760a9d0)

Asset validation failed
The bundle 'Payload/MyApp.app/Frameworks/opencv2.framework' is missing plist key. The Info.plist file is missing the required key: CFBundleShortVersionString. Please find more information about CFBundleShortVersionString at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring (ID: ac1bd17f-a05b-4b67-989a-c5b639a07f71)

Asset validation failed
This bundle Payload/MyApp.app/Frameworks/opencv2.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion. Please find more information about CFBundleVersion at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion (ID: 85bf9bb7-8e2f-4271-8c00-e277a69408ad)