RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
226 stars 28 forks source link

Apple M1: "AVProVideo.bundle" is damaged and can't be opened. #641

Closed TheloTheGreat closed 3 years ago

TheloTheGreat commented 3 years ago

https://thelo.ca/AVProVideo-bundle-damaged-mac.png

On an "Apple M1" (Apple Silicon, ARM64) machine, the 2.0.7 and 2.0.6 versions of AVProVideo.bundle show an error on load: "AVProVideo.bundle" is damaged and can't be opened. You should move it to the trash.

On three other, Intel-based Mac machines, AVProVideo.bundle loads just fine.

(M1 machines should normally load Intel-based bundles fine, through the x86-64 translation layer. Maybe this is a code-sign issue?)

TheloTheGreat commented 3 years ago

Yeah it looks like a code-sign issue due to Unity's meta files. Here's what I see immediately after importing the latest 2.0.7 AVPro package:

Discipline:~ thelo$ codesign --verify --verbose=4 "/Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle"
/Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle: a sealed resource is missing or invalid
file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/MacOS.meta
file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/MacOS/AVProVideo.meta
file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/_CodeSignature.meta
file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/Info.plist.meta
file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/CodeResources.meta
MorrisRH commented 3 years ago

Not sure it's code signing. The plugin works fine with Unity even with all the unsigned meta files present and should be stripping them out when a standalone build is made.

Did versions of the plugin previous to 2.0.6 work with the M1 then? What version of Unity are you using?

MorrisRH commented 3 years ago

From your png it looks like you downloaded the bundle directly and not as part of the unity package? If so then it's likely got the quarantine flag set, you can check using: xattr AVProVideo.bundle from the terminal. If it has then you can remove the flag using xattr.

TheloTheGreat commented 3 years ago

We have not tried versions prior to 2.0.6, we bought AVPro just recently. We're on Unity 2020.2.1 at the moment.

It's pretty obviously about code signing. The bundle doesn't validate because it was signed without the 5 meta files in there. Apple requires valid signed code on the M1: https://eclecticlight.co/2020/08/22/apple-silicon-macs-will-require-signed-code/

Surely the solution is for you guys to codesign the bundle including those 5 meta files.

That screenshot was taken as I zipped the bundle to send it to my colleague with the M1, but the exact same thing happens when he fetches the bundle from our source control.

Edit: This isn't really about build stripping either, we need it to work within the editor first.

MorrisRH commented 3 years ago

Trouble being those meta files prevent code signing from working, so there is no way to sign it with those meta files present. Bit of a catch-22.

I'll do some investigating but I think this is an issue that will need to be taken up with Unity.

MorrisRH commented 3 years ago

I cannot reproduce this.

Using Unity 2020.2.6f1, creating a new project, installing the trial version of the plugin from here and running the Demo_MediaPlayer scene on an Apple M1 based machine worked perfectly with no issues in the editor.

Unity does add those meta files to the bundle and code sign does report them, but this does not prevent it from working within the editor.

TheloTheGreat commented 3 years ago

Thanks for trying this. As an update: my colleague with the M1 did discover that his bundle file got quarantine-flagged by macOS, and manually removing that quarantine flag did fix the problem. So you were right the first time.

I'm still kind of baffled as to why the AVProVideo bundle ever got quarantine-flagged when getting the bundle via our source control though (SVN, via the Cornerstone client).

abhishekm-altoura commented 1 year ago

we are also facing code-sign issue due to Unity's meta files. Here's what I see immediately after importing the latest 2.5.7 AVPro package:

Discipline:~ thelo$ codesign --verify --verbose=4 "/Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle" /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle: a sealed resource is missing or invalid file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/MacOS.meta file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/MacOS/AVProVideo.meta file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/_CodeSignature.meta file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/Info.plist.meta file added: /Users/thelo/Proj/AVPro2/Assets/AVProVideo/Runtime/Plugins/macOS/AVProVideo.bundle/Contents/CodeResources.meta

Facing the same issue and removed the quarantine flag also but still not able to sign the above files. Its working fine in the editor but in the M1 executable video is not being played.

MorrisRH commented 1 year ago

Hey @abhishekm-altoura

Unity should be stripping the meta files from the built application. I made a quick build here to check and I can confirm that in the built product there are no meta files within the plugin.

There's nothing we can do about the meta files being present in the plugin in the Unity project but this has no impact on being able to run things in the editor.