473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Illegal instruction or undefined symbol from import

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/pyt...y/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

Jul 4 '06 #1
4 3997
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
Jul 5 '06 #2

"Mathias Waack" <M.*****@gmx.dewrote in message
news:WV*****************@se2-cb104-9.zrh1.ch.colt.net...
BTW, does anybody know why the c-lib offers both log and log1p?
So you can get a sensible answer computing log(1 + 10 ^ -30). There's
a lot of somewhat obscure mathematical stuff that got into the standard
C lib. How often do you need Bessel functions?
Jul 5 '06 #3
Richard Brodie wrote:
"Mathias Waack" <M.*****@gmx.dewrote in message
news:WV*****************@se2-cb104-9.zrh1.ch.colt.net...
>BTW, does anybody know why the c-lib offers both log and log1p?

So you can get a sensible answer computing log(1 + 10 ^ -30).
Ok, that make sense to me.
There's
a lot of somewhat obscure mathematical stuff that got into the standard
C lib. How often do you need Bessel functions?
Maybe each day. What is a Bessel function?;)

Mathias
Jul 5 '06 #4

In article <ll*****************@se2-cb104-9.zrh1.ch.colt.net>,
Mathias Waack <M.*****@gmx.dewrites:
|>
| There's
| a lot of somewhat obscure mathematical stuff that got into the standard
| C lib. How often do you need Bessel functions?
|>
|Maybe each day. What is a Bessel function?;)

Some people use them all the time; there are specific physical problems
where they are fundamental. I have never used them, in 40 years of
wide-ranging experience in the scientific computing arena!
Regards,
Nick Maclaren.
Jul 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ajay Bakhshi | last post by:
Hi, I am getting the following problem on AIX. I create a small shared library. And tried to load it in python. It core dumps with the following message: Segmentation fault (core dumped) ...
1
by: Andreas Jung | last post by:
I am trying to embed Python within a C++ application (Linux, Python2.3.4). I am using the example from the example from the "Embeding and Extending" docs. This works fine importing a simple module...
4
by: Bill Hodges | last post by:
I just build PyQt from sources on Mandrake 10 and tried to run a le gacy application from a University that runs in several environments. I detectedno errors on the configuration or build and the...
3
by: ch424 | last post by:
Hi there, I'm using Python 2.4.1 on Ubuntu Linux, and I'm having problems extending python in C: The C code is below: #include <Python.h> #include "ni488.h"
0
by: çÌÏÔÏ× áÒÔÅÍ | last post by:
Hello! I'm trying to install the web application written with Python, and have the trouble with module math.so: # lwp-request http://localhost/site/code/edit.py Mod_python error:...
4
by: antonyliu2002 | last post by:
I downloaded MySQL-python-1.2.1 from SourceForge and installed it on a Mandrake system (Mandrake Linux 9.2 3.3.1-2mdk on linux2). The installation was successful. The gcc version is 3.3. My...
1
by: Justin Johnson | last post by:
Hello, I'm trying to build Python 2.5.0 on AIX 5.3 using IBM's compiler (VisualAge C++ Professional / C for AIX Compiler, Version 6). I run configure and make, but makes fails with undefined...
1
by: grbgooglefan | last post by:
I am importing cStringIO module in my PythonC++ embedded program. The import is failing with the following error: ImportError: /usr/lib/python2.3/lib-dynload/cStringIO.so: undefined symbol:...
1
by: Borse, Ganesh | last post by:
Hi, Can you please guide me for the following problem? The call to "PyImport_ImportModule("cStringIO");" is failing with an error of "undefined symbol: PyObject_SelfIter". Before importing this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.