473,779 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4021
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.de wrote 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.de wrote 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.de writes:
|>
| 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
1765
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) At other time with another shared lib I got: Illegal instruction: core dump
1
3026
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 without any imports. However when I add an "import urllib" inside the Python script to be imported through my C++ application then the import fails: Traceback (most recent call last):
4
7770
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 qt.so is the same in the build directory as it is in the site-packages/qt.so. output is: psyco installed and used Traceback (most recent call last):
3
13503
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
4382
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: "PythonHandler edit::handler" Traceback (most recent call last):
4
2101
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 Python version is 2.4.2. When I import MySQLdb, I get an error which says that __pure_virtual is an undefined symbol. Look:
1
4914
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 symbols. See the output from configure and make below. svnadm /svn/build/python-2.5.0>env CC=cc CXX=xlC ./configure --prefix=$base_dir \ checking MACHDEP... aix5
1
2761
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: PyObject_SelfIter I have python-2.3.3-88.9.x86 installed on my machine. Why is this error coming? how can I resolve this undefined symbol? Do I need to import anything before this?
1
2787
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 module, I am importing only the sys module. Py_SetProgramName("/usr/bin/python"); Py_Initialize(); char* argv = { "python","-v",""}; PySys_SetArgv(2,argv);
0
9633
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10137
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8959
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7483
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.