Setting Up A Debug Environment
I've been trying to set up a debugable version of fipy in virtualenv for debugging a trilinos issue. Here are the steps:
- Install the python-dbg package from the Debian repositories.
- Use mkvirtualenv -p python-dbg debug to make the debug environment.
- Install numpy with pip install, not debug.
- Install swig in the standard way.
- Here is the do-configure for trilinos
EXTRA_ARGS=$@ TRILINOS_HOME=/users/wd15/Documents/python/trilinos-10.8.3-Source CMAKE=cmake PYTHON_EXECUTABLE=${VIRTUAL_ENV}/bin/python ${CMAKE} \ -D CMAKE_BUILD_TYPE:STRING=DEBUG \ -D Trilinos_ENABLE_PyTrilinos:BOOL=ON \ -D BUILD_SHARED_LIBS:BOOL=ON \ -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \ -D TPL_ENABLE_MPI:BOOL=ON \ -D Trilinos_ENABLE_TESTS:BOOL=ON \ -D PYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE} \ -D DART_TESTING_TIMEOUT:STRING=600 \ -D CMAKE_INSTALL_PREFIX:PATH=${VIRTUAL_ENV} \ -D PyTrilinos_INSTALL_PREFIX:PATH=${VIRTUAL_ENV} \ ${EXTRA_ARGS} \ ${TRILINOS_HOME}
FiPy: A Finite Volume PDE Solver Using Python
rss
Comments
This doesn't currently compile. Get the following config error.
What is happening is that the debug version of python is not returning the numpy version in the correct format. See packages/PyTrilinos/cmake/FindNumPy.cmake line 55.
${PYTHON_EXECUTABLE} -c "import numpy; print numpy.__version__" OUTPUT_VARIABLE NumPy_VERSION ERROR_VARIABLE NumPy_VERSION_ERROR OUTPUT_STRIP_TRAILING_WHITESPACEThe problem is the debug version of numpy returns an extra line with the ref count.
I'm stuck at this point. Don't know what to do.
I hacked it to make it work.
$ diff packages/PyTrilinos/cmake/FindNumPy.cmake packages/PyTrilinos/cmake/FindNumPy.cmake.bkup 55c55 < /usr/bin/python -c "print '1.6.1'" --- > ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.__version__" 65c65 < /usr/bin/python -c "print '/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/numpy/core/include'" --- > ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"Nasty! I don't think there was a way round that without amending FindNumPy.cmake in some way.
So Trilinos installed fine. However I can't import pytrilinos
trunk-dbg)bunter[wd15]: python Python 2.6.6 (r266:84292, Dec 26 2010, 23:10:47) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PyTrilinos Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/__init__.py", line 120, in <module> import NOX File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/NOX/__init__.py", line 54, in <module> ___init__ = swig_import_helper() File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/NOX/__init__.py", line 50, in swig_import_helper _mod = imp.load_module('___init__', fp, pathname, description) ImportError: libpytrilinos.so: cannot open shared object file: No such file or directory [32015 refs] >>>Giving up.
The failure in comment 3 was because LD_LIBRARY_PATH wasn't set. After setting that, PyTrilinos? throws the following
>>> import PyTrilinos Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/__init__.py", line 120, in <module> import NOX File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/NOX/__init__.py", line 54, in <module> ___init__ = swig_import_helper() File "/users/wd15/.virtualenvs/trunk-dbg/lib/python2.6/site-packages/PyTrilinos/NOX/__init__.py", line 50, in swig_import_helper _mod = imp.load_module('___init__', fp, pathname, description) ImportError: /users/wd15/.virtualenvs/trunk-dbg/lib/libpytrilinos.so: undefined symbol: Py_InitModule4_64 [32021 refs]Not sure what the issue is, something is missing though.
Examinimg libpytrilinos.so with nm and ldd reveals the following unhelpful info. ldd does not seem to show a libpython dependecy where Py_InitModule4_64 is rumored to hide. nm confirms that Py_InitModule4_64 is undefined along with a whole array of other symbols.
trunk-dbg)bunter[wd15]: ldd /users/wd15/.virtualenvs/trunk-dbg/lib/libpytrilinos.so linux-vdso.so.1 => (0x00007fffc6bff000) liblocathyra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/liblocathyra.so (0x00007f020ffee000) liblocaepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/liblocaepetra.so (0x00007f020fbcd000) libloca.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libloca.so (0x00007f020f412000) libnoxthyra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libnoxthyra.so (0x00007f020f032000) libnoxepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libnoxepetra.so (0x00007f020eca2000) libnox.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libnox.so (0x00007f020e92e000) libanasazitpetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libanasazitpetra.so (0x00007f020e718000) libModeLaplace.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libModeLaplace.so (0x00007f020e4d8000) libanasaziepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libanasaziepetra.so (0x00007f020e2ab000) libanasazi.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libanasazi.so (0x00007f020e0a9000) libml.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libml.so (0x00007f020dafa000) libkomplex.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libkomplex.so (0x00007f020d8ca000) libifpack.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libifpack.so (0x00007f020d446000) libamesos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libamesos.so (0x00007f020d172000) libgaleri.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libgaleri.so (0x00007f020cf17000) libaztecoo.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libaztecoo.so (0x00007f020cc6b000) libdpliris.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libdpliris.so (0x00007f020ca60000) libisorropia.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libisorropia.so (0x00007f020c75b000) libepetraext.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libepetraext.so (0x00007f020c31f000) libtriutils.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libtriutils.so (0x00007f020c0c2000) libepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libepetra.so (0x00007f020bd66000) libteuchos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libteuchos.so (0x00007f020b203000) libstratimikos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikos.so (0x00007f020abc1000) libstratimikosbelos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikosbelos.so (0x00007f020a9aa000) libstratimikosaztecoo.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikosaztecoo.so (0x00007f020a67f000) libstratimikosamesos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikosamesos.so (0x00007f020a3c4000) libstratimikosml.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikosml.so (0x00007f020a0f4000) libstratimikosifpack.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libstratimikosifpack.so (0x00007f0209e24000) libbelostpetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libbelostpetra.so (0x00007f0209c0f000) libbelosepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libbelosepetra.so (0x00007f0209844000) libbelos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libbelos.so (0x00007f0209642000) libtpetraext.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libtpetraext.so (0x00007f020942c000) libtpetrainout.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libtpetrainout.so (0x00007f02091ef000) libtpetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libtpetra.so (0x00007f0208f27000) libkokkoslinalg.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libkokkoslinalg.so (0x00007f0208d26000) libkokkosnodeapi.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libkokkosnodeapi.so (0x00007f0208afa000) libkokkos.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libkokkos.so (0x00007f02088f9000) libtpi.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libtpi.so (0x00007f02086f2000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f02084b0000) libthyraepetraext.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libthyraepetraext.so (0x00007f0208058000) libzoltan.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libzoltan.so (0x00007f0207d34000) libthyraepetra.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libthyraepetra.so (0x00007f02076a6000) libthyracore.so => /users/wd15/.virtualenvs/trunk-dbg/lib/libthyracore.so (0x00007f020746f000) librtop.so => /users/wd15/.virtualenvs/trunk-dbg/lib/librtop.so (0x00007f020724e000) liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007f0206633000) libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007f0206113000) libmpi_cxx.so.0 => /usr/lib/libmpi_cxx.so.0 (0x00007f0205ef9000) libmpi.so.0 => /usr/lib/libmpi.so.0 (0x00007f0205c48000) libopen-rte.so.0 => /usr/lib/libopen-rte.so.0 (0x00007f02059fc000) libopen-pal.so.0 => /usr/lib/libopen-pal.so.0 (0x00007f02057a7000) libdl.so.2 => /lib/libdl.so.2 (0x00007f02055a2000) libnsl.so.1 => /lib/libnsl.so.1 (0x00007f020538a000) libutil.so.1 => /lib/libutil.so.1 (0x00007f0205187000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f0204e72000) libm.so.6 => /lib/libm.so.6 (0x00007f0204bf0000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f02049da000) libc.so.6 => /lib/libc.so.6 (0x00007f0204678000) libmpi_f90.so.0 => /usr/lib/libmpi_f90.so.0 (0x00007f0204473000) libmpi_f77.so.0 => /usr/lib/libmpi_f77.so.0 (0x00007f020423b000) libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f0203f4f000) /lib64/ld-linux-x86-64.so.2 (0x00007f02105b2000)(trunk-dbg)bunter[wd15]: nm --dynamic /users/wd15/.virtualenvs/trunk-dbg/lib/libpytrilinos.so | grep ' Py' U PyArg_UnpackTuple U PyBool_FromLong U PyBool_Type U PyCFunction_Type U PyCObject_AsVoidPtr U PyCObject_FromVoidPtr U PyCObject_Import U PyCObject_Type U PyClass_Type U PyDict_GetItem U PyDict_GetItemString U PyDict_New U PyDict_Next U PyDict_SetItem U PyDict_SetItemString U PyErr_Clear U PyErr_Fetch U PyErr_Format U PyErr_Occurred U PyErr_Print U PyErr_Restore U PyErr_SetObject U PyErr_SetString U PyExc_AttributeError U PyExc_IOError U PyExc_ImportError U PyExc_IndexError U PyExc_MemoryError U PyExc_OverflowError U PyExc_RuntimeError U PyExc_SyntaxError U PyExc_SystemError U PyExc_TypeError U PyExc_ValueError U PyExc_ZeroDivisionError U PyFloat_AsDouble U PyFloat_FromDouble U PyFloat_Type U PyImport_ImportModule U PyImport_ImportModuleLevel U PyInstance_NewRaw U PyInstance_Type U PyInt_AsLong U PyInt_FromLong U PyList_Append U PyList_New U PyList_SetItem U PyLong_FromVoidPtr U PyModule_AddObject U PyOS_snprintf U PyObject_Call U PyObject_CallFunctionObjArgs U PyObject_CallObject U PyObject_Free U PyObject_GenericGetAttr U PyObject_GetAttr U PyObject_GetAttrString U PyObject_Init U PyObject_IsInstance U PyObject_IsTrue U PyObject_Malloc U PyObject_RichCompareBool U PyObject_SetAttrString U PyObject_Str U PySequence_Concat U PySequence_GetItem U PySequence_Size U PyString_AsString U PyString_ConcatAndDel U PyString_Format U PyString_FromFormat U PyString_FromString U PyString_Size 0000000000310c90 B PyTrilinos_NumPy U PyTuple_GetItem U PyTuple_New U PyTuple_SetItem U PyType_IsSubtype U PyType_Ready U PyUnicodeUCS4_AsUTF8String U PyUnicodeUCS4_Decode U Py_BuildValue U Py_InitModule4_64Found this:
"We ran into this error on Debian this morning, with a system that had more than one Python.
Typically this means that an extension was compiled against the wrong Python.h.
This just means that the calling Python interpreter and the extension don't use the same version (one is Python 2.4, the other 2.5). They were both 64-bit but the name changed in http://www.python.org/dev/peps/pep-0353/
Some commands to help debug this are ldd (to show dymanic library linking) and nm (to list exports)."
It's certainly possible that the debug python version is using the regular python versions libraries.
Starting over with
instead.
Using
makes no difference.