Sage startup crashes on some systems with a SignalError: Illegal instruction
embray opened this issue · 2 comments
Some users reported that Sage crashes at startup. The full traceback isn't very interesting, but the last frame is:
/opt/sagemath-7.4/src/sage/libs/ntl/ntl_ZZ.pyx in sage.libs.ntl.ntl_ZZ.ntl_ZZ.__init__ (build/cythonized/sage/libs/ntl/ntl_ZZ.cpp:3245)()
85 self.x = (<ntl_ZZ>v).x
86 elif isinstance(v, int):
87 ZZ_conv_from_int(self.x, PyInt_AS_LONG(v))
88 elif isinstance(v, long):
89 PyLong_to_ZZ(&self.x, v)
90 elif isinstance(v, Integer):
91 self.set_from_sage_int(v)
92 elif v is not None:
93 v = str(v)
94 if len(v) == 0:
95 v = '0'
96 if not ((v[0].isdigit() or v[0] == '-') and \
97 (v[1:-1].isdigit() or (len(v) <= 2)) and \
98 (v[-1].isdigit() or (v[-1].lower() in ['l','r']))):
99 raise ValueError("invalid integer: %s" % v)
--> 100 sig_on()
global sig_on = undefined
101 ZZ_from_str(&self.x, v)
102 sig_off()
103
104 def __repr__(self):
105 """
106 Return the string representation of self.
107
108 EXAMPLES:
109 sage: ntl.ZZ(5).__repr__()
110 '5'
111 """
112 return ZZ_to_PyString(&self.x)
113
114 def __reduce__(self):
115 """
src/cysignals/signals.pyx in cysignals.signals.sig_raise_exception (build/src/cysignals/signals.c:1225)()
SignalError: Illegal instruction
This shows that cysignals caught and raised an exception for a SIGILL
, as the CPU tried to execute an unknown instruction. I built NTL on my machine which probably has support for certain instructions that other machines may not. Building Sage with SAGE_FAT_BINARY
will, among other things that probably should be done for the default installer, will build an NTL without certain CPU-specific instructions, so will work on a broader range of machines (the question remains at what cost, and if architecture-specific builds should be made available).
SAGE_FAT_BINARY=yes
alone did not resolve the issue, as there are some packages in Sage 7.4 that do no respect that environment variable properly. I have backported the following fixes to my 7.4 branch and built a new binary:
https://trac.sagemath.org/ticket/21849
https://trac.sagemath.org/ticket/21772
Forgot to update this issue: With the backported fixes for supporting SAGE_FAT_BINARY
the issue was resolved for the users who reported it. Future releases will all be built, for now, with SAGE_FAT_BINARY
(perhaps in the future we can also cross-compile releases for specific architectures).