Does this work with XC8 which isn't gcc? I couldn't find the sha256 in the files I looked at. It is present in xc16 and xc32 recent releases.
No, You need the xclm.c file I alluded to earlier. It has a simple hardcoded challenge response and requires more than just an exit code. I found it with a bit of google-fu. It's not hard.
Ok, understood. I remember a couple of years back when they released a version of one of the compilers where they'd broken the licence check and each compiler invocation took several seconds making build times about four or five times longer. It is this kind of irritation that bone fide users have to put up with all too often from Microchip. I used to think the quality was primarily lacking in the software tools with the chips themselves being reasonably good, but I guess they took one of the software guys on to build the PIC32MZ series!
Actually the compilers XC16 and XC32 themselves are pretty good. XC8 much less so. It's the IDEs and now their Harmony framework that are bad in my experience. I still use the old MPLAB 8 IDE if I can get away with it, it's much faster for the edit-compile-debug cycle, and it is possible sometimes to hack it to use some of the newer chips (although not for simulator use). MPLAB X has improved functionally particularly in the debugger interface which was very buggy, not even the PICkit 3 worked for me at one time, and it's still slower than the old IDE.
Harmony, though, well that's a whole new level of pain. "Faster time to market" apparently, I'd love to see that marketing strapline proven