We have a rather complex network of dependencies for our application stack and, from it, we create multiple unique executables that are placed into the Contents/MacOS directory of our bundle.
MyApp.app `- Contents/ `- Frameworks/... `- MacOS/ `- exec_a `- exec_b `- Resources/...
Both executables require the same dependencies (and use the same shared .dylib files built as targets in the same project) so it makes sense for them to be in the same place rather than in their own .app folder as I understand it.
Qt Libs -> core_lib.dylib -> gui_lib.dylib -> exec_a `-> exec_b
etc.
We've confirmed build artifacts are correct and the rpath/dependencies are all clean. When in development, all executables run as expected and we can command exec_a
(the executable we're listing in the primary Info.plist
) to launch exec_b
at any time.
Once the bundle is signed, however, we cannot get exec_b
to launch in any capacity. Even lldb
dies right away because it can't attach to anything. We assume this is something in the gatekeeper area of blocking these additional executables.
We get the following when trying to run those additional exes in any way:
Trace/BPT trap: 5
We're using macdeployqt
to finalize the bundle and bring in the correct packages - perhaps something it's doing is causing the additional executables to fail or we're missing an entitlement.
We've submitted the app to TestFlights successfully even with these invalid executables to see if there was something the processing of the app would find but so far nothing.
We've seen other example of applications with multiple executables in the same MacOS directory and are wondering what the difference is. Any hints or guidance would be great. Thank you!
It should be possible to get this setup working.
You mentioned TestFlight, which suggests you’re targeting the Mac App Store. If so, all your executables must be sandboxed. If you plan to spawn exec_a
as a child process of exec_b
then exec_b
has to use sandbox inheritance. See Resolving App Sandbox Inheritance Problems.
The other potential gotcha is entitlements. If exec_a
uses restricted entitlements [1] then those entitlements get authorised by the provisioning profile embedded in the app bundle. If exec_b
also needs restricted entitlements then things get trickier. So, does exec_b
need any restricted entitlements?
A restricted entitlement is one that must be authorised by a profile, as explained in TN3125 Inside Code Signing: Provisioning Profiles.
Finally, I have a bunch of hints and tips on this topic in Resolving Trusted Execution Problems.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Which it’ll need for a TestFlight deployment, as explained in •.