3 Jul 04:54
Scipy weave errors: undefined symbols when importing compiled extension
Craig Finch <oanjao <at> yahoo.com>
2009-07-03 02:54:09 GMT
2009-07-03 02:54:09 GMT
I have two computers that have almost identical Python installations,
but one of them has problems with inline Weave code. Here is a simple
test script that I am using:
#!/usr/bin/env python
from scipy import weave
input_val = 10
code=r"""return_val = 10*input_val;"""
print weave.inline(code, ['input_val'], headers=[], compiler='gcc')
It runs successfully on one computer with the following configuration:
Python 2.5.2 (r252:60911, Apr 17 2009, 18:42:17)
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Scipy 0.7.0
Numpy 1.3.0
On the other computer, it fails with the following message:
Traceback (most recent call last):
File "test.py", line 12, in <module>
print weave.inline(code, ['input_val'], headers=[], compiler='gcc')
File "/home/cfinch/lib/python2.5/site-packages/scipy/weave/inline_tools.py", line 335, in inline
**kw)
File "/home/cfinch/lib/python2.5/site-packages/scipy/weave/inline_tools.py", line 468, in compile_function
exec 'import ' + module_name
File "<string>", line 1, in <module>
ImportError: /home/cfinch/.python25_compiled/sc_71b2502f9a0b0ca9f89b0cdc7ad3819e0.so:
undefined symbol: _ZNSt8ios_base4InitD1Ev
I used nm to check, and that symbol is indeed present in the compiled .so file.
The configuration of this computer is:
Python 2.5.4 (r254:67916, Apr 22 2009, 15:52:10)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Scipy 0.7.0
Numpy 1.3.0
One
complication is that the default compiler on this system is icc, and
numpy distutils doesn't offer a way to force it to use gcc for
everything.
I have tried everything I can think of--deleting the
files in .python25_compiled, rebuilding Scipy to ensure it was built
with gcc, even hacking Numpy's distutils to force it to compile the
extension with gcc.
I also ran the unit tests that come with
weave. Running weave.test() produces no errors, but running
weave.test("full") produces lots of errors:
Ran 390 tests in 145.246s
FAILED (KNOWNFAIL=6, errors=196)
<nose.result.TextTestResult run=390 errors=196 failures=0>
There are no errors on the other system.
Can anyone suggest a way to fix this?
Craig
RSS Feed