If it is executing an illegal instruction that is either a fault in the VM or the the compiler. It is very unlikely to be the compiler, so I would say the problem was that the VM is announcing CPU capabilities that it is not prepared to honour. I also believe the workaround for this is to force the architecture used for the compilation to be something sufficiently generic.
In that case, you need to positively identify the failure mode, rather than just guess that it is an illegal instruction. E.g. run Asterisk manually under gdb. (First run it manually with -cvvv to see if you get any logging output either explaining the abort or giving a clue as to where it is aborting.
Well, I don’t know CentOS, but I got similar errors when trying to compile Asterisk 13.0.1 on debian. In my case, it was sufficient to just install the libjansson packages (development and binary).
I am aware of that you wrote that compiling went without errors. Perhaps you have installed only the development package for libjansson, but not the binary package? That would explain why compiling went fine but asterisk actually does not find the library. Please double check by means of your package management system.