I finally found a solution to obtain a notarised application which is functional.
The bundle is organised as follows
TestApp.app
Contents
MacOS
testAppp <-- a launcher (C binary)
myAlert <-- an alert dialogue (Cocoa binary)
Resources
winteracter <-- an X11 (Xquartz) window and dialogue (Fortran binary)
The binary "winteracter" is based on the Winteracter library <http://www.winteracter.com> which uses OpenMotif and Xquartz
winteracter binary
This binary is hardened manually (i.e. from outside Xcode) prior to the others
codesign -d --force --options runtime --verbose=4 -s "$DEV_CERTIFICATE" --entitlements "winteracter.entitlements" "winteracter"
winteracter.entitlements should only contain the following:
com.apple.security.cs.disable-library-validation
testApp and myAlert binaries
These are signed and hardened either manually
codesign -d --force --options runtime --verbose=4 -s "$DEV_CERTIFICATE" "$MYBINARY"
or using Xcode
In that case be sure to manually erase the field "Code Signing Entitlements" en Build Settings.
It may remained filled in even if you delete "Sandboxing" from the the Capabilities interface.
Once notarized the application is functional.
I tried sandboxing it but the infamous error "mapping process and mapped file (non-platform) have different Team IDs" went back !
But what were my mistakes?
1- Apple says that sandboxing keys must appear only once in entitlement file of the main binary, with other having only the "inherit" key. I wrongly assumed that com.apple.security.cs.disable-library-validation was inherited too.
2- I thought the key com.apple.security.app-sandbox was compulsory in entitlement files. Not at all!
3- I wrongly assumed that setting com.apple.security.app-sandbox to false is equivalent as no entitlement file. Wrong again!
4- I wrongly assumed that the Xcode interface "Signing & Capabilities" correctly manages the Build Settings
5- I performed so many trial an errors that I do not remember all by all dead ends where I got lost.