473,796 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

undefined symbol: PyObject_Generi cGetAttr when trying to embedPython

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):
File "/home/ajung/sandboxes/HR2/hr2_zope_wrappe r/hr2_wrapper.py" , line
16, in hr2_wrapper
import urllib
File "/opt/python-2.3.4/lib/python2.3/urllib.py", line 26, in ?
import socket
File "/opt/python-2.3.4/lib/python2.3/socket.py", line 44, in ?
import _socket
ImportError: /opt/python-2.3.4/lib/python2.3/lib-dynload/_socket.so:
undefined symbol: PyObject_Generi cGetAttr

Any ideas?

Andreas
Jul 18 '05 #1
1 3028
You may have to link your app with some additional flags. You can
use the distutils module to see which ones you need for loading shared
objects (like _socket.so) at runtime. Here is what my Python build for
Linux needs (from http://elmer.sourceforge.net/PyCon04 ):
import distutils.sysco nfig
distutils.sysco nfig.get_config _var("LINKFORSH ARED")
'-Xlinker -export-dynamic'

Then, simply add -Xlinker -export-dynamic to the link line for the
embedded Python app and the .so modules should have all the proper
symbols resolved. Hope that helps,

-Rick Ratzel

Andreas Jung wrote: 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):
File "/home/ajung/sandboxes/HR2/hr2_zope_wrappe r/hr2_wrapper.py" , line
16, in hr2_wrapper
import urllib
File "/opt/python-2.3.4/lib/python2.3/urllib.py", line 26, in ?
import socket
File "/opt/python-2.3.4/lib/python2.3/socket.py", line 44, in ?
import _socket
ImportError: /opt/python-2.3.4/lib/python2.3/lib-dynload/_socket.so:
undefined symbol: PyObject_Generi cGetAttr

Any ideas?

Andreas

Jul 18 '05 #2

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

Similar topics

1
11268
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of the g++ compiler /usr/local/bin/g++ -v Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/specs Configured with: ../gcc-3.3.1/configure --disable-nls Thread model: aix gcc version 3.3.1
2
4456
by: Manuel Maria Diaz Gomez | last post by:
Hi Everybody, maybe you can give me a hint about this. I implemented a simple singleton Factory that will (among other things) keep a registry of objects. Objects register themself in the factory in the following way: static MyObject myInstance;
0
1770
by: pervinder | last post by:
Hi, I have a c++ application which depends on some other libs which uses stlport When i build the application, it works fine on sun/linux/hp platform. (provided the .a for the dependency libs) But it errors out on AIX ( xlC va6) with below errors:- ld: 0711-317 ERROR: Undefined symbol: ._STL::ios_base::_Loc_init::_Loc_init() ld: 0711-317 ERROR: Undefined symbol: ._STL::ios_base::Init::Init() ld: 0711-317 ERROR: Undefined symbol:...
8
4595
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member: VarArray::funct were an extern, but it is declared in the same file (q.v.). What is the remedy for this? =================
4
5733
by: r.nikhilk | last post by:
Hi, We are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the -q64 option in xlC compiler. But, when we link all these libraries to one of the main applications, we are getting the following errors: ld: 0711-317 ERROR: Undefined symbol: .FxCharFile::good() const ld: 0711-317 ERROR: Undefined symbol:...
8
18055
by: pavan734 | last post by:
Hello, Please excuse me as Iam not posting this to correct group. I have a parser code obtained from flex command. I have many other files. When I compile them Iam getting a message like: undefined symbol yylex. What might have went wrong?
0
1075
by: edcdave | last post by:
My (gcc 2.95.2) build of Python 2.4.3 is failing with: gcc -Wl,-Bexport -o python \ Modules/ccpython.o \ libpython2.4.a -lnsl -ldl -lm Undefined first referenced symbol in file ldexpf /usr/ccs/lib/libm.so python: fatal error: Symbol referencing errors. No output written to python
1
5551
by: yamitmehta | last post by:
When I compile to code using g++arm of VxWorks 5.5 and put it on my board i get the follwing undefined symbols:- Cpool and Csingleton are template classes. CPool has the static member variables:-ms_uCapacity ,ms_uAllocatedCount , ms_uLockCapacity ,ms_pmutex -ld < yamit/apps1.out Undefined symbol: _Q23m5tt5CPool1ZQ23m5t10CMarshaler$ms_uCapacity (binding 1 type 0) Undefined symbol: _Q23m5tt5CPool1ZQ23m5t10CMarshaler$ms_uAllocatedCount
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
0
9685
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
9535
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
10465
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10242
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...
0
9061
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
7558
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
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.