|
From: Sanjoy M. <sa...@ol...> - 2010-12-20 03:10:51
|
I compiled visual 5.4 from source for my laptop, a Thinkpad T60 that
runs a Debian testing/unstable mix. The following short program gives a
segfault:
from visual import *
b=box()
scene.autoscale=0
b.rotate(pi/4)
It's using the boost 1.42.0 libraries and python 2.6.6.
Here's the backtrace when it is run under gdb. Any other debugging
steps to do?
$ LIBGL_ALWAYS_SOFTWARE=1 PYTHONPATH="/usr/local/lib/python2.6/site-packages" gdb --args python "/home/sanjoy/admin/bug/vpython/test.py"
(gdb) run
Starting program: /usr/bin/python /home/sanjoy/admin/bug/vpython/test.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb533cb70 (LWP 32322)]
Program received signal SIGSEGV, Segmentation fault.
0xb676cbb7 in __cxa_allocate_exception () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0xb676cbb7 in __cxa_allocate_exception () from /usr/lib/libstdc++.so.6
#1 0xb7a269f7 in cvisual::py_rotate<cvisual::primitive> (args=..., kwargs=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
)
at ../../visual-5.4_release/src/python/wrap_primitive.cpp:48
#2 0xb7a2665d in operator() (this=0x83067a8, args=0x84a7dac, kw=0x0)
at /usr/include/boost/python/raw_function.hpp:36
#3 boost::python::objects::full_py_function_impl<boost::python::detail::raw_dispatcher<boost::python::api::object (*)(boost::python::tuple, boost::python::dict)>, boost::mpl::vector1<PyObject*> >::operator() (this=0x83067a8,
args=0x84a7dac, kw=0x0)
at /usr/include/boost/python/object/py_function.hpp:94
#4 0xb67f701f in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib/libboost_python-py26.so.1.42.0
#5 0xb67f7257 in ?? () from /usr/lib/libboost_python-py26.so.1.42.0
#6 0xb67fe532 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /usr/lib/libboost_python-py26.so.1.42.0
#7 0xb79dbd82 in operator() (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#8 operator()<bool, boost::python::detail::translate_exception<std::runtime_error, void (*)(std::runtime_error)>, boost::_bi::list2<const boost::python::detail::exception_handler&, const boost::function0<void>&> > (
function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/bind/bind.hpp:382
#9 operator()<boost::python::detail::exception_handler, boost::function0<void> > (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/bind/bind_template.hpp:102
#10 boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<std::runtime_error, void (*)(std::runtime_error)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(std::runtime_error)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke (function_obj_ptr=...,
a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#11 0xb67fe511 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /usr/lib/libboost_python-py26.so.1.42.0
#12 0xb79dbb22 in operator() (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#13 operator()<bool, boost::python::detail::translate_exception<std::invalid_argument, void (*)(std::invalid_argument)>, boost::_bi::list2<const boost::python::detail::exception_handler&, const boost::function0<void>&> > (
function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/bind/bind.hpp:382
#14 operator()<boost::python::detail::exception_handler, boost::function0<void> > (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/bind/bind_template.hpp:102
#15 boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<std::invalid_argument, void (*)(std::invalid_argument)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(std::invalid_argument)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke (
function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/function/function_template.hpp:132
#16 0xb67fe511 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /usr/lib/libboost_python-py26.so.1.42.0
#17 0xb79dba72 in operator() (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#18 operator()<bool, boost::python::detail::translate_exception<std::out_of_range, void (*)(std::out_of_range)>, boost::_bi::list2<const boost::python::detail::exception_handler&, const boost::function0<void>&> > (function_obj_ptr=...,
a0=..., a1=...) at /usr/include/boost/bind/bind.hpp:382
#19 operator()<boost::python::detail::exception_handler, boost::function0<void> > (function_obj_ptr=..., a0=..., a1=...)
at /usr/include/boost/bind/bind_template.hpp:102
#20 boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<std::out_of_range, void (*)(std::out_of_range)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(std::out_of_range)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke (function_obj_ptr=..., a0=...,
a1=...) at /usr/include/boost/function/function_template.hpp:132
#21 0xb67fe303 in boost::python::handle_exception_impl(boost::function0<void>)
() from /usr/lib/libboost_python-py26.so.1.42.0
#22 0xb67f3da6 in ?? () from /usr/lib/libboost_python-py26.so.1.42.0
#23 0x0806232a in PyObject_Call ()
#24 0x080e016b in PyEval_EvalFrameEx ()
#25 0x080e2507 in PyEval_EvalCodeEx ()
#26 0x080e2607 in PyEval_EvalCode ()
#27 0x080ffcbd in PyRun_FileExFlags ()
#28 0x080fff22 in PyRun_SimpleFileExFlags ()
#29 0x0805dd81 in Py_Main ()
#30 0x0805cf6b in main ()
|
|
From: Bruce S. <bas...@nc...> - 2010-12-20 03:41:13
|
When I run your program on Windows I get this:
Traceback (most recent call last):
File "Untitled", line 4
b.rotate(pi/4)
ValueError: primitive.rotate(): angle of rotation must be specified.
The rotate statement should look like this b.rotate(angle=pi/4)
The C++ code at wrap_primitive.cpp, line 48, is this:
throw std::invalid_argument(
"primitive.rotate(): angle of rotation must be specified.");
I don't know why Debian would segfault rather than giving an error.
However, I note that translate_exception shows up in your error
report, and in INSTALL.txt there is the following comment (though if
this were the problem I would expect the compilation to fail):
If you get this error in compiling cvisualmodule.cpp:
In file included from /usr/include/boost/python/exception_translator.hpp:12,
from ../../vpython-core2/src/python/cvisualmodule.cpp:12:
/usr/include/boost/python/detail/translate_exception.hpp:34:
error: expected nested-name-specifier before "add_reference"
You need to make this change:
In /usr/include (probably), change /boost/python/detail/translate_exception.hpp
=========================================================
--- boost/python/detail/translate_exception.hpp (revision 50228)
+++ boost/python/detail/translate_exception.hpp (working copy)
@@ -9,6 +9,7 @@
# include <boost/call_traits.hpp>
# include <boost/type_traits/add_const.hpp>
+# include <boost/type_traits/add_reference.hpp>
# include <boost/function/function0.hpp>
--------------------------------------
(That is, add "# include <boost/type_traits/add_reference.hpp>" after the
statement "# include <boost/type_traits/add_const.hpp>".)
Bruce Sherwood
|