[SciPy-user] Scipy weave errors: undefined symbols when importing compiled extension

Craig Finch oanjao@yahoo....
Mon Jul 6 18:16:42 CDT 2009


I've been dealing with issues like this, on this one system, for a year now.  At one point, I had a working combination of python, numpy, and scipy.  I tried so many things that I can't really remember how I got to that point.  I think I used gcc to build scipy 0.6 because I couldn't get it to work with icc, and I linked it with the Intel MKL successfully.  However, when I upgraded to scipy-0.7.0 I am again facing this problem.

The latest thing I tried was to build both Numpy and Scipy with the Intel C and Fortran compilers (icc and ifort).  Numpy builds fine and passes all its unit tests.  Scipy builds without errors or warnings, but I still have problems when trying to import any Scipy module that depends on "sparse."  

Build command:

python setup.py config --compiler=intel --fcompiler=intelem install --prefix=/home/cfinch 2>&1 > scipy_build_log.txt

Results:
>>> from scipy import sparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cfinch/lib/python2.5/site-packages/scipy/sparse/__init__.py", line 6, in <module>
    from csr import *
  File "/home/cfinch/lib/python2.5/site-packages/scipy/sparse/csr.py", line 12, in <module>
    from sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
  File "/home/cfinch/lib/python2.5/site-packages/scipy/sparse/sparsetools/__init__.py", line 4, in <module>
    from csr import *
  File "/home/cfinch/lib/python2.5/site-packages/scipy/sparse/sparsetools/csr.py", line 7, in <module>
    import _csr
ImportError: /home/cfinch/lib/python2.5/site-packages/scipy/sparse/sparsetools/_csr.so: undefined symbol: _ZNSt8ios_base4InitD1Ev

When I use nm to look at the symbols in _csr.so, I see that these are undefined, along with several dozen other Python-related symbols:
...
00000000000d2810 W _ZNSt6vectorIxSaIxEE6resizeEmx
00000000000d2fdc W _ZNSt6vectorIySaIyEE6resizeEmy
                 U _ZNSt8ios_base4InitC1Ev
                 U _ZNSt8ios_base4InitD1Ev

I have no idea what this symbol is, or where it's supposed to come from.  Has anyone seen an error like this before?  I am going to see what kind of support I can get from Intel.

   Craig


----- Original Message ----
From: Craig Finch <oanjao@yahoo.com>
To: David Cournapeau <cournape@gmail.com>; SciPy Users List <scipy-user@scipy.org>
Sent: Sunday, July 5, 2009 2:30:18 PM
Subject: Re: [SciPy-user] Scipy weave errors: undefined symbols when importing  compiled extension

By "build log" I assume you mean the output to stderr and stdout when when building Scipy.  It's a huge amount of output, and I'm not sure exactly what to look for.  Do you want me to post a particular section?  Below is the output from sections where g++ is called.  It seems to be linked with g++ everywhere.

One more potential problem area: I'm linking with the Intel Math Kernel Library (MKL) which was almost certainly built with Intel compilers.  Could that be causing this problem?

   Craig
  
-----------------------
building 'scipy.interpolate._interpolate' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

compile options: '-Iscipy/interpolate/src -I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/interpolate/src/_interpolate.cpp
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/interpolate/src/_interpolate.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/interpolate/_interpolate.so
-----------------------
building 'scipy.sparse.sparsetools._csr' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

creating build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools
compile options: '-I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/sparse/sparsetools/csr_wrap.cxx
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools/csr_wrap.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/sparse/sparsetools/_csr.so
building 'scipy.sparse.sparsetools._csc' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

compile options: '-I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/sparse/sparsetools/csc_wrap.cxx
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools/csc_wrap.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/sparse/sparsetools/_csc.so
building 'scipy.sparse.sparsetools._coo' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

compile options: '-I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/sparse/sparsetools/coo_wrap.cxx
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools/coo_wrap.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/sparse/sparsetools/_coo.so
building 'scipy.sparse.sparsetools._bsr' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

compile options: '-I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/sparse/sparsetools/bsr_wrap.cxx
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools/bsr_wrap.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/sparse/sparsetools/_bsr.so
building 'scipy.sparse.sparsetools._dia' extension
compiling C++ sources
C compiler: g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

compile options: '-I/home/cfinch/lib/python2.5/site-packages/numpy/core/include -I/home/cfinch/include/python2.5 -c'
g++: scipy/sparse/sparsetools/dia_wrap.cxx
g++ -pthread -shared build/temp.linux-x86_64-2.5/scipy/sparse/sparsetools/dia_wrap.o -Lbuild/temp.linux-x86_64-2.5 -o build/lib.linux-x86_64-2.5/scipy/sparse/sparsetools/_dia.so

-----------------------




----- Original Message ----
From: David Cournapeau <cournape@gmail.com>
To: Craig Finch <cfinch@ieee.org>; SciPy Users List <scipy-user@scipy.org>
Sent: Friday, July 3, 2009 10:21:28 PM
Subject: Re: [SciPy-user] Scipy weave errors: undefined symbols when importing  compiled extension

On Sat, Jul 4, 2009 at 3:38 AM, Craig Finch<oanjao@yahoo.com> wrote:

> ImportError: /home/cfinch/lib/python2.5/site-packages/scipy/sparse/sparsetools/_csr.so: undefined symbol: __gxx_personality_v0
>
> As far as I know, everything Python-related on this machine has now been built with GNU tools, but something is still broken.  One more thing--Python, Numpy, and Scipy are all locally installed in my /home/cfinch directory because the system Python is frozen at 2.4.

This is still a C++ problem, I have sometimes noticed this problem on
some machines. Normally this is caused by a C++ object file being
linked with gcc (instead of g++). Can you post the build log of scipy
?

David


      


More information about the SciPy-user mailing list