Re: [sage-devel] Debugging some cython code / Pynac
On 04/ 1/11 11:46 PM, Burcin Erocal wrote: On Fri, 01 Apr 2011 17:20:57 +0100 Dr. David Kirkbydavid.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 Kirkbydavid.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. 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... 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. We can't put initialization code in all.py, since it would just get imported to the main namespace. Cheers, Burcin This issue is now http://trac.sagemath.org/sage_trac/ticket/6 -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? Dave -- 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
Re: [sage-devel] Debugging some cython code / Pynac
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? Moving the lines # This must come before Calculus -- it initializes the Pynac library. import sage.symbolic.pynac in sage/all.py higher in the file might work around this problem. The correct solution would be to import the offending function lazily or locally. Cheers, Burcin -- 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
Re: [sage-devel] Debugging some cython code / Pynac
On 1 April 2011 12:54, Burcin Erocal bur...@erocal.org 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? Moving the lines # This must come before Calculus -- it initializes the Pynac library. import sage.symbolic.pynac in sage/all.py higher in the file might work around this problem. The correct solution would be to import the offending function lazily or locally. Cheers, Burcin I just started to download 4.7.alpha3. Once I have that downloaded and built it, I'll post a backtrace. If it helps, I'm willing to give you an account on the machine hawk which is used by the buildbot. Unlike t2.math, it is pretty quick (quad core 3.33 GHz Xeon). Dave -- 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
Re: [sage-devel] Debugging some cython code / Pynac
On 04/ 1/11 12:54 PM, Burcin Erocal wrote: On Fri, 01 Apr 2011 00:37:46 +0100 Dr. David Kirkbydavid.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 drkirkby@hawk:~/64/sage-4.7.alpha3$ ./sage -gdb Building Sage on Solaris in 64-bit mode Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist Detected SAGE64 flag Building Sage on Solaris in 64-bit mode -- | Sage Version 4.7.alpha3, Release Date: 2011-03-31 | | Type notebook() for the GUI, and license() for information.| -- ** ** * Warning: this is a prerelease version, and it may be unstable. * ** ** /export/home/drkirkby/64/sage-4.7.alpha3/local/bin/sage-ipython GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i386-pc-solaris2.11... warning: Lowest section in /lib/amd64/libdl.so.1 is .dynamic at 00b0 Python 2.6.4 (r264:75706, Apr 1 2011, 15:07:52) [GCC 4.5.0] on sunos5 Type help, copyright, credits or license for more information. warning: Lowest section in /lib/amd64/libintl.so.1 is .dynamic at 00b0 warning: Lowest section in /lib/amd64/libpthread.so.1 is .dynamic at 00b0 Program received signal SIGSEGV, Segmentation fault. 0x003eb0a5 in ?? () (gdb) bt #0 0x003eb0a5 in ?? () #1 0xfd7fff2ac5d1 in _Unwind_RaiseException_Body () from /lib/64/libc.so.1 #2 0xfd7fff2ac855 in _Unwind_RaiseException () from /lib/64/libc.so.1 #3 0xfd7ff91d6729 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 0xfd7fcec6d5ff in GiNaC::function::find_function (name=@0x4a359b0, nparams=2) at function.cpp:1446 #5 0xfd7fce9454ad in __pyx_f_4sage_8symbolic_8function_15BuiltinFunction__is_registered (__pyx_v_self=0x4a142f0) at sage/symbolic/function.cpp:7301 #6 0xfd7fce950755 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 0xfd7fffde7a70 in ?? () #8 0x0016745f5f63 in ?? () #9 0x04a0e5a8 in ?? () #10 0x04a142f0 in ?? () #11 0x000b in ?? () #12 0x04a0e5a8 in ?? () #13 0x02c913e8 in ?? () #14 0xfd7fd76c2b30 in module_members () from /export/home/drkirkby/64/sage-4.7.alpha3/local/lib//libpython2.6.so.1.0 #15 0x002752657572 in ?? () #16 0xfd7fd76d5c60 in ?? () from /export/home/drkirkby/64/sage-4.7.alpha3/local/lib//libpython2.6.so.1.0 #17 0x28004052 in ?? () #18 0xfd7fd76d5920 in ?? () from /export/home/drkirkby/64/sage-4.7.alpha3/local/lib//libpython2.6.so.1.0 #19 0x0005 in ?? () #20 0x049e4db8 in ?? () ---Type return to continue, or q return to quit--- #21 0x in ?? () The line starting: __pyx_t_2 = ((struct __pyx_vtabstruct_4sage_8symbolic_8function_Function *) below is sage/symbolic/function.cpp line 2374 /* sage/symbolic/function.pyx:109 * raise ValueError, real_fname + parameter must be callable * * if not self._is_registered(): # * self._register_function() * */ __pyx_t_2 = ((struct __pyx_vtabstruct_4sage_8symbolic_8function_Function *)((struct __pyx_obj_4sage_8symbolic_8function_Function *)__pyx_v_self)-__pyx_vtab)-_is_registered(((struct __pyx_obj_4sage_8symbolic_8function_Function *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109;
Re: [sage-devel] Debugging some cython code / Pynac
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 Kirkbydavid.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. 0x003eb0a5 in ?? () (gdb) bt #0 0x003eb0a5 in ?? () #1 0xfd7fff2ac5d1 in _Unwind_RaiseException_Body () from /lib/64/libc.so.1 #2 0xfd7fff2ac855 in _Unwind_RaiseException () from /lib/64/libc.so.1 #3 0xfd7ff91d6729 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 0xfd7fcec6d5ff in GiNaC::function::find_function (name=@0x4a359b0, nparams=2) at function.cpp:1446 #5 0xfd7fce9454ad in __pyx_f_4sage_8symbolic_8function_15BuiltinFunction__is_registered (__pyx_v_self=0x4a142f0) at sage/symbolic/function.cpp:7301 #6 0xfd7fce950755 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 0xfd7fffde7a70 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.allimport * 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
Re: [sage-devel] Debugging some cython code / Pynac
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 Kirkbydavid.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. 0x003eb0a5 in ?? () (gdb) bt #0 0x003eb0a5 in ?? () #1 0xfd7fff2ac5d1 in _Unwind_RaiseException_Body () from /lib/64/libc.so.1 #2 0xfd7fff2ac855 in _Unwind_RaiseException () from /lib/64/libc.so.1 #3 0xfd7ff91d6729 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 0xfd7fcec6d5ff in GiNaC::function::find_function (name=@0x4a359b0, nparams=2) at function.cpp:1446 #5 0xfd7fce9454ad in __pyx_f_4sage_8symbolic_8function_15BuiltinFunction__is_registered (__pyx_v_self=0x4a142f0) at sage/symbolic/function.cpp:7301 #6 0xfd7fce950755 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 0xfd7fffde7a70 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