Mac, codesign make the packaged *.app close immediately after open it

Hi!
I was trying to codesign a packaged project to submit it to apple notarization system.
The packaging work correctly and the app opens fine, until i codesign the *.app and the *.dylib connected. Then when I try to open it with the terminal, it returns this message:

/Volumes/Data/mark.satt_A10816_Stream/Engine/Source/ThirdParty/rd_route/src/rd_route.c:334:
	error: mach_vm_protect() failed with error: 0x2

I tried to make every possible combination of codesign but the problem still remain. Said so, despite the current problem , the notarization system accepted this version anyway.
This is an example of one of the last codesign command that I used:

codesign --sign “DevID” --entitlements “./entitlements_base.xml” --options runtime --timestamp “MyApp-Mac-Shipping.app”

And this is the entitlements file that I’m using:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>com.apple.security.app-sandbox</key> <true/>
        </dict>
</plist>

Does anyone had already bumped is this problem? Any help/clues is appreciated.

Thanks, Luca

I was experiencing the same issue. I followed this post and was able to sign and run successfully.