I have an app bundle containing a cli tool and a dylib. For testing I am calling the cli tool in Terminal (iTerm2):
DYLD_INSERT_LIBRARIES=./libwebsockets.14.dylib THNUCLNT_SVC="private" ./thnuclnt -v
dyld: Library not loaded: @rpath/libwebsockets.14.dylib Referenced from: /Users/rwelz/Downloads/ezeep Connector.app/Contents/Resources/thnuclnt/thnuclnt/x86_64-darwin/./thnuclnt Reason: image not found Abort trap: 6
When I remove the signature from cli tool, everything works fine:
codesign --remove-signature thnuclnt
DYLD_INSERT_LIBRARIES=./libwebsockets.14.dylib THNUCLNT_SVC="private" ./thnuclnt -v
ThinPrint Client Mac Version 7.6.10.1, (c) 2007-2019 ThinPrint GmbH
removing signature from libwebsockets.14.dylib has no effect at all.
I know that the cli tool is using dlopen to load the dylib. But I have no code for the cli tool nor for the libwebsockets.dylib since these are programmed by a colleague of mine. I am only responsible for putting everything together in the app bundle. But everything is build on our build server - so everything uses the same certificate for code signing.
I expect my cli tool to load libwebsockets.dylib and execute and output the same as if it had no signature.
What is changing on the cli tool when codesign is applied? What is going on here?
Many thanks for your valuable help
regards,
Robert
PS.:
libwebsockets.14.dylib and tnuclnt reside in the same directory inside the resource folder of the app:
~/Downloads/my_supersecret.app/Contents/Resources/thnuclnt/thnuclnt/x86_64-darwin/] $ ls -l
total 3368
-rwxr-xr-x 1 rwelz staff 268K Sep 25 11:35 libwebsockets.14.dylib
-rwxr-xr-x 1 rwelz staff 321K Sep 25 11:35 thnuclnt