Trap invalid opcode

A new install of Asterisk core dumps at startup with “trap invalid opcode” in /var/log/messages.

CentOS 6.4 x86_64
Asterisk 11.6.0
Dahdi 2.7
Libpri 1.4.14
iksemel 1.4

All in a VM on XenServer 6.2

Any ideas?


I would look in the core dump file with gdb:

gdb -c /tmp/core.whatever /usr/sbin/asterisk

then in gdb I would do:

gdb>bt full
gdb>frame 0

And then I would try to see if there is something obvious there.


Here is the crash, timezone issue?

Program terminated with signal 4, Illegal instruction.
#0 tzload (name=, sp=0x258f0a0, doextend=1) at stdtime/localtime.c:866
866 u.buf[i] = p[i];

Ran make menuselect and chose Dont Optimize, different error now:

Program received signal SIGILL, Illegal instruction.
0x000000000057e287 in timesub (timep=0x7fffffff9e50, offset=-18000, sp=0x85a0a0, tmp=0x7fffffffa090) at stdtime/localtime.c:1823
1823 seconds = tdays * SECSPERDAY + 0.5;

The most common cause of illegal instruction errors is compiling on a VM that doesn’t correctly describe its processor capabilities. The fix is roughly to replace the specification of best fit architecture with a conservative one. You will need to search the forum or for the fine details.

./configure CC=“gcc -O3” CFLAGS=-O3, the make, make install.

Working now.


nice, using gdb was possibly overkill, I have an automatic reflex to do that since I support an “altered” version of asterisk where, when theres a core dump, its usually not in the asterisk code but in ours, that being said im pretty sure I’ve seen the same segfault(the timezone thing) somewhere else.