strace: SIGFPE before anything happens
I'm having trouble executing a C++ program on a particular machine. Here is the entire strace output:
26936 execve("/data1/xfm/bin/xfm", ["/data1/xfm/bin/xfm", "-d", "-s", "/data1/smail/", "-p", "/data1/xfm", "-m", "Mailing.176"], [/* 21 vars */]) = 0
26936 uname({sys="Linux", node="smail2.<removed>.com", ...}) = 0
26936 brk(0) = 0x开发者_如何学Go98f7000
26936 --- SIGFPE (Floating point exception) @ 0 (0) ---
26936 +++ killed by SIGFPE +++
I'v installed and run this executable on several other machines with no problem (and with thousands of lines of strace output). Any idea what could be causing my problem? Thanks.
My guess would be that the problem machine is running an older Linux distribution that the others: the usual cause of this, as far as I'm aware, is a mismatch between the symbol hash table in the binary, and the dynamic linker.
A dynamically linked binary (or library for that matter) may have either a classic ELF symbol hash table in a section called .hash
, or a new GNU symbol hash table in a section called .gnu.hash
, or both.
Some more recent distributions have gcc
set up to pass a flag to the linker (--hash-style=gnu
) by default, which causes it to emit only a .gnu.hash
section in the binary.
If such a binary is run on an older system with an old dynamic linker that does not understand .gnu.hash
, it will fail in exactly this way. The failure occurs at a very early point, during dynamic linking (before the binary actually does anything itself), which is why you get virtually no output from strace
.
It's hard to give an answer having only this information. You should try to run your program in gdb or insert sigfpe signal handler to determine the exact position of error and its reason.
精彩评论