On Fri, Apr 1, 2011 at 3:46 PM, Burcin Erocal <bur...@erocal.org> wrote: > On Fri, 01 Apr 2011 17:20:57 +0100 > "Dr. David Kirkby" <david.kir...@onetel.net> wrote: > >> On 04/ 1/11 12:54 PM, Burcin Erocal wrote: >> > On Fri, 01 Apr 2011 00:37:46 +0100 >> > "Dr. David Kirkby"<david.kir...@onetel.net> wrote: >> > >> >> I've built Sage 64-bit on OpenSolaris but it crashes at startup. I've >> >> run gdb and find the bit of code that's causing the crash is this. >> >> >> >> ./devel/sage-main/sage/symbolic/function.cpp >> >> >> >> >> >> /* "sage/symbolic/function.pyx":109 >> >> * raise ValueError, real_fname + " parameter must >> >> be callable" * >> >> * if not self._is_registered(): #<<<<<<<<<<<<<< >> >> * self._register_function() >> >> * >> >> */ >> > <snip> >> >> allows Sage to run. It's not 100% stable, but much better than before. >> >> >> > <snip> >> >> Can anyone see if there might be something wrong with this code, >> >> which is causing Sage to segfault? >> > >> > It might be due to the linker initializing the library in a different >> > order. Can you post a backtrace so we can see which function it is >> > trying to construct? >> >> Here's a backtrace > <snip> >> >> Program received signal SIGSEGV, Segmentation fault. >> 0x00000000003eb0a5 in ?? () >> (gdb) bt >> #0 0x00000000003eb0a5 in ?? () >> #1 0xfffffd7fff2ac5d1 in _Unwind_RaiseException_Body () from >> /lib/64/libc.so.1 >> #2 0xfffffd7fff2ac855 in _Unwind_RaiseException () from /lib/64/libc.so.1 >> #3 0xfffffd7ff91d6729 in __cxa_throw (obj=<value optimized out>, >> tinfo=<value >> optimized out>, dest=<value optimized out>) >> at ../../../../../gcc-4.5.0/libstdc++-v3/libsupc++/eh_throw.cc:78 >> #4 0xfffffd7fcec6d5ff in GiNaC::function::find_function (name=@0x4a359b0, >> nparams=2) at function.cpp:1446 >> #5 0xfffffd7fce9454ad in >> __pyx_f_4sage_8symbolic_8function_15BuiltinFunction__is_registered >> (__pyx_v_self=0x4a142f0) at sage/symbolic/function.cpp:7301 >> #6 0xfffffd7fce950755 in >> __pyx_pf_4sage_8symbolic_8function_8Function___init__ >> (__pyx_v_self=0x4a142f0, __pyx_args=<value optimized out>, >> __pyx_kwds=<value optimized out>) at sage/symbolic/function.cpp:2374 >> #7 0xfffffd7fffde7a70 in ?? () > <the stack is corrupted so the rest is useless> > > David gave me an account on the machine. Here is the Python call stack: > > File "/export/home/burcin/sage-4.7.alpha3/local/bin/sage-ipython", line 21, > in <module> > ipy_sage = IPython.Shell.start() > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/IPython/Shell.py", > line 1233, in start > return shell(user_ns = user_ns) > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/IPython/Shell.py", > line 78, in __init__ > debug=debug,shell_class=shell_class) > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/IPython/ipmaker.py", > line 644, in make_IPython > force_import(profmodname) > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/IPython/ipmaker.py", > line 66, in force_import > __import__(modname) > File "ipy_profile_sage.py", line 7, in <module> > import sage.all_cmdline > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/all_cmdline.py", > line 14, in <module> > from sage.all import * > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/all.py", > line 75, in <module> > from sage.schemes.all import * > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/all.py", > line 25, in <module> > from hyperelliptic_curves.all import * > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/all.py", > line 1, in <module> > from constructor import HyperellipticCurve > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/constructor.py", > line 11, in <module> > from sage.schemes.generic.all import ProjectiveSpace > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/generic/all.py", > line 4, in <module> > from affine_space import AffineSpace, is_AffineSpace > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/generic/affine_space.py", > line 24, in <module> > import algebraic_scheme > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/generic/algebraic_scheme.py", > line 143, in <module> > import toric_variety > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/schemes/generic/toric_variety.py", > line 236, in <module> > from sage.geometry.cone import Cone, is_Cone > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/geometry/cone.py", > line 174, in <module> > from sage.combinat.posets.posets import FinitePoset > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/combinat/posets/posets.py", > line 24, in <module> > from sage.graphs.all import DiGraph > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/graphs/all.py", > line 16, in <module> > from graph_editor import graph_editor > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/graphs/graph_editor.py", > line 22, in <module> > from sagenb.misc.support import EMBEDDED_MODE > File > "/export/home/burcin/sage-4.7.alpha3/devel/sagenb/sagenb/misc/support.py", > line 563, in <module> > from sage.symbolic.all import Expression, SR > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/symbolic/all.py", > line 9, in <module> > from sage.symbolic.relation import solve, solve_mod, solve_ineq > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/symbolic/relation.py", > line 314, in <module> > from sage.calculus.calculus import maxima > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/calculus/calculus.py", > line 374, in <module> > from sage.symbolic.integration.integral import indefinite_integral, \ > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", > line 129, in <module> > indefinite_integral = IndefiniteIntegral() > File > "/export/home/burcin/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", > line 62, in __init__ > BuiltinFunction.__init__(self, "integrate", nargs=2) > > > It seems that cones.py looks for posets.py, which needs the graphs > module, which initializes the graph_editor. The graph editor tries to > see if it's in the notebook or the command line, but sagenb imports SR > and Expression from sage.symbolic.all (line 563 of > sagenb/misc/support.py). This tries to initialize the functions > (integrate in this case) before pynac is initialized...
Why doesn't importing from sage.symbolic.pynac initialize pynac? > We need a better solution for making sure modules are initialized > properly before anything is imported from them. I thought putting an > __init__.py file in sage/symbolic/ with "import pynac" would solve the > problem. However, it seems that python just ignores that file. > > Any suggestions on how to solve the general problem properly? > > > BTW, telling people to import from .all if they are outside the current > module is just asking for trouble. Isn't that better than specifying what modules to import in what order, and having them manually, or manually call initialization code? I'd rather make "import sage.foo.all" just work. Maybe there's something special with pynac... ideally not every party of Sage should have to know abou that though. > We can't put initialization code in > all.py, since it would just get imported to the main namespace. You can use the __all__ variable, but I don't think that's necessary. - Robert -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org