Illegal instruction or undefined symbol from import
Mathias Waack
M.Waack at gmx.de
Wed Jul 5 05:48:38 EDT 2006
Continuing my monologe;)
Mathias Waack wrote:
> 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.
The error occurred in calls to math.log(). I've patched mathmodule.c and
call log1p(x-1) instead of log. It works as a first workaround.
BTW, does anybody know why the c-lib offers both log and log1p?
Mathias
More information about the Python-list
mailing list