Home > database >  <lib> not valid for use in process: mapped file has no Team ID and is not a platform binary (s
<lib> not valid for use in process: mapped file has no Team ID and is not a platform binary (s

Time:09-28

Trying to run an executable linking to a dynamic library, I get the following error:

Library not loaded:
[...]
Reason: tried:
    <lib> not valid for use in process: mapped file has no Team ID and is not a 
    platform binary (signed with custom identity or adhoc?))

How can I check the signature and fix it?

CodePudding user response:

Check the signature of your file with:

% codesign -d -v ./mavsdk

It may show, for instance (note in particular the Signature=adhoc):

Executable=<path/to/lib>
Identifier=some.package.name
Format=bundle with Mach-O thin (x86_64)
CodeDirectory v=20400 size=253962 flags=0x2(adhoc) hashes=7930 3 location=embedded
Signature=adhoc
Info.plist entries=11
TeamIdentifier=not set
Sealed Resources version=2 rules=13 files=13
Internal requirements count=0 size=12

In order to sign the library, first list your identities:

% security find-identity -v -p codesigning

It may show something like this:

  1) D3F12EDB89FF03FEBA39D1A45F8BD300BAC1C3F0 "Apple Development: Your Name (234MBK19TS)"
  2) CA4F82BC3C4BABE180CC8BC52A48CBF4DE0E2CAA "lldb_codesign"
  3) EB4AD59AE2BBD1C8A0F43C9B2AAA7FBDA1B0D3EE "gdb-cert"
     3 valid identities found

In which case you can sign the library with:

% codesign -s "Apple Development: Your Name (234MBK19TS)" <lib>
  • Related