Illegal instruction or undefined symbol from import
Mathias Waack
M.Waack at gmx.de
Tue Jul 4 06:15:51 EDT 2006
Hi,
I've embedded python into a legacy application. It works - most of the time.
In some special situations the app crashes executing the "import random".
There are two different situations:
1. the sources compiled with gcc 4.1.2 crash with illegal instruction error:
(running my application)
Python 2.3.5 (#1, Jun 9 2006, 11:49:02)
[GCC 4.1.2 20060604 (prerelease) (Debian 4.1.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/usr/lib/python2.3/lib-dynload/readline.so", 2);
import readline # dynamically loaded
from /usr/lib/python2.3/lib-dynload/readline.so
>>> import random
import random # from /usr/lib/python2.3/random.py
# can't create /usr/lib/python2.3/random.pyc
dlopen("/usr/lib/python2.3/lib-dynload/math.so", 2);
import math # dynamically loaded from /usr/lib/python2.3/lib-dynload/math.so
Illegal instruction
Running python itself works.
2. the sources compiled with 4.0.3 give me an undefined symbol error:
>>> import random
# /usr/lib/python2.3/random.pyc matches /usr/lib/python2.3/random.py
import random # precompiled from /usr/lib/python2.3/random.pyc
dlopen("/usr/lib/python2.3/lib-dynload/math.so", 2);
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/random.py", line 42, in ?
from math import log as _log, exp as _exp, pi as _pi, e as _e
ImportError: /usr/lib/python2.3/lib-dynload/math.so: undefined symbol:
PyFPE_jbuf
>>>
It gives the same traceback in both python itself and the embedded version.
My main problem is the first error. I've found some older postings
describing this behaviour and pointing at a compiler error
(http://mail.python.org/pipermail/python-dev/2003-May/035386.html). But I'm
not able to verify this error with gcc 4.1.2.
Google finds some postings describing the same error - but it looks like
nobody ever got an answer:( Would be nice to have more success...
Regards
Mathias
More information about the Python-list
mailing list