arm64 executable runs on first compile&link but failed with security errors on all subsequent builds

I built a Makefile-based set of command-line sound-synthesis tools in native arm64 for the first time on my new M1 Mac Studio running Ventura 13.4 (I've been building them x86-64 for the past month and running via Rosetta). The primary executable plus its private dylib built and linked without error, and ran blazingly fast on the machine. THEN I needed to modify and recompile 2 source files, and when I did, the program stopped working, getting killed immediately. I reverted the source files and rebuilt, but it still died, with the crash log showing:

Exception Type: EXC_CRASH (SIGKILL (Code Signature Invalid)) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: CODESIGNING 1 Taskgated Invalid Signature

and the log showing:

default 15:23:35.989553-0700 kernel proc 70090: load code signature error 2 for file "CMIX" default 15:23:35.990396-0700 kernel ASP: Security policy would not allow process: 70090, /opt/local/src/RTcmix.git/bin/CMIX

This program has never been signed in any fashion, and was not when its first version worked. There were NO config changes between the first working build and the remaining failures. A friend runs the same build on an M1 laptop running MacOS 12.6. and does not have this issue.

Did the rebuild trigger some new security system? A reboot "fixes" the problem until I need to recompile again, when the problem repeats.

Thanks for any help!

This program has never been signed in any fashion

Yes it has! Apple silicon Macs will not run unsigned code. When you build using command-line tools, the linker sign your code. If it didn’t do that, your program wouldn’t start at all.

A reboot "fixes" the problem until I need to recompile again

OK, that’s a strong indication that you’re being hit by the problems discussed in Updating Mac Software. Something in your build system is rewriting a signed file. The fix is to avoid that, either by changing the way you copy the file (ditto instead of cp) or by deleting the file before you try to rewrite it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you very much - this was exactly the issue. I hope this helps some other poor developer in the future as well.

-DS

arm64 executable runs on first compile&link but failed with security errors on all subsequent builds
 
 
Q