Page 1 of 1

Unable to load custom plugin on DVDpedia 6

Posted: Mon May 31, 2021 1:12 pm
by nixiebob
Is there a trick to compiling plugins to work with DVDpedia 6?

I recently got into collecting Laserdiscs and decided I'd try using DVDpedia to catalog them. I took the sample plugin source and modified it to query lddb.com (currently just retrieves the title based on the UPC, but I plan to add all other fields later), and I spent a fair amount of time trying to figure out why isn't it working at all in DVDpedia 6 (tried both in 6.1.0 release and 6.1.0beta190) - the plugin doesn't appear in the Sites prefpane at all (and there's nothing logged in /var/log/system.log). I almost gave up, but then I tried it in DVDpedia 5.7 and it works fine (appears in the Sites prefpane and successfully retrieves the disc data).

To make sure I'm not messing anything with my code, I reproduced this on a clean copy of the sample plugin - it too compiles and works (well, appears in the Sites prefpane) on 5.7 but not on 6.

I'm using Xcode Version 12.5 (12E262) on OSX 11.4, running on a M1 Mac. The only change I had to make to the sample project to get it to compile is to change the target arch from $(ARCHS_STANDARD_32_64_BIT) to x86_64.

Any hints of what could be wrong, or how can I debug this further? (I know approximately nothing about Objective C, but happy to learn more if needed.)

Bob

Re: Unable to load custom plugin on DVDpedia 6

Posted: Mon May 31, 2021 2:02 pm
by Conor
Hi Bob,

Thank you for the clear description and for trying version 5. Let me take a look and get back to you with what might be stopping the plugin from loading in version 6. As I have yet not pushed the M1 code into the current version so there should be no incompatibility.

Re: Unable to load custom plugin on DVDpedia 6

Posted: Mon May 31, 2021 4:40 pm
by nixiebob
Just to make sure it's got nothing to do with M1, I recompiled and reproduced the same issue on another Mac, Intel running 10.14.6 and Xcode 10.3 (10G8).

Re: Unable to load custom plugin on DVDpedia 6

Posted: Tue Jun 08, 2021 8:53 pm
by nixiebob
I had another look at this, and found an interesting message [1]:

Error loading /var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/29B32DEA-D7BC-4940-ADC8-BA824DE79F0D/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb: dlopen(/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/29B32DEA-D7BC-4940-ADC8-BA824DE79F0D/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb, 265): no suitable image found. Did find:
/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/29B32DEA-D7BC-4940-ADC8-BA824DE79F0D/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb: code signature in (/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/29B32DEA-D7BC-4940-ADC8-BA824DE79F0D/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation<…>

Running codesign -v on the plugin binary shows it's indeed missing a valid signature:

$ codesign -v DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/LDDB
DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/LDDB: invalid Info.plist (plist or signature have been modified)
In architecture: x86_64

I tried re-signing it with an ad-hoc key:
$ codesign -f -s - DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/LDDB
DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/LDDB: replacing existing signature

... which seems to pass codesign verification:

$ codesign -v DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/LDDB
$

But the plugin still fails the same way:

Error loading /var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/2706A02D-D497-447F-8C2B-A1C62FD23101/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb: dlopen(/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/2706A02D-D497-447F-8C2B-A1C62FD23101/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb, 265): no suitable image found. Did find:
/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/2706A02D-D497-447F-8C2B-A1C62FD23101/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb: code signature in (/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation/2706A02D-D497-447F-8C2B-A1C62FD23101/d/DVDpedia6.1.0beta190.app/Contents/Plug-ins/LDDB.plugin/Contents/MacOS/lddb) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
/var/folders/gq/m7hywqz55kvgthhp5274tqz40000gp/T/AppTranslocation<…>

Googling for the "not valid for use in process using Library Validation" error led me to https://developer.apple.com/forums/thread/128380 which then led to https://developer.apple.com/library/arc ... es/tn2206/, which has a *lot* of detail that I haven't gotten fully through yet, but my initial impression is that Apple isn't very receptive to the scenario of an application using third-party plugins added after build time and not signed by the app developer (see the section on "Nested Code").

The doc does offer a workaround, but it's somewhat clunky: I did a 'codesign --deep -f -s - DVDpedia.app', replacing all signatures with the ad-hoc one, which got the plugin to work on DVDpedia 6. Obviously, that's not a great solution, since it negates all the security benefit of Gatekeeper and it'll need re-signing after an update, but at least I can keep working on the plugin using DVDpedia 6, not relying on 5.7.

Bob

[1] ...which was probably there all along in Console.app, but I'd thought that grepping /var/log/system.log would also show it, which clearly isn't the case. Did I mention I don't know the first thing about Mac development :) ?

Re: Unable to load custom plugin on DVDpedia 6

Posted: Thu Jun 10, 2021 4:16 am
by FineWine
Thanks for that. Could you please send all of that direct to: support@bruji.com