Operating System - HP-UX
1834508 Members
2538 Online
110068 Solutions
New Discussion

Re: Can't get a Python extension to work (Boost.Python, g++)

 
Clerfayts
New Member

Can't get a Python extension to work (Boost.Python, g++)

Configuration:
- HPUX 11
- GCC 3.2
- STLport 4.5.3
- Boost 1.30.2
- Python 2.2.1 from HP

I successfully built a python extension in C++
using Boost.python (compile, link OK).
But when I import the module from python,
I get the following message (and python exits):

% python
...
> import MyModule
...
Fatal python error: Interpreter not initialized
(version mismatch?)
...

Suspecting a bad python installation, I rebuilt
it myself, but ... same result.

Note: This extension module works well on Windows XP / Visual C++ 6 and Linux Red Hat 7 /
Intel Compiler 7.0 and 7.1.

Any idea of what could cause such crash ?

Yours.

Jean-Philippe.
8 REPLIES 8
Harri Pasanen_1
Advisor

Re: Can't get a Python extension to work (Boost.Python, g++)

gcc 3.2.x does not support static initializers (such as global and static constructors) on HP-UX 11.x. I suggest you use gcc 3.3.x, and compile your own python with it. Then boost and boost-python work fine. PS. how do you format messages in this forum?
Clerfayts
New Member

Re: Can't get a Python extension to work (Boost.Python, g++)

Thanks Harri for your answer.

My last (before suicide ;-) idea was about
these initializer (but it was with very little hope !); so I was just in the process of trying GCC 3.3.2 !
You answer gives me real hope !
See you soon for the results ...

Jean-Philippe.

PS: As for the format of my messages on this forum, I don't know exactly; I use Mozilla 1.4
and write my messages right in the web user interface of the forum; I'm french too, so may be there is a language issue ?
Harri Pasanen
Occasional Advisor

Re: Can't get a Python extension to work (Boost.Python, g++)

Just a small precision:

gcc 3.2.x does not support static initializers *in shared libraries* (such as global and static constructors) on HP-UX 11.x.

Harri

PS. The formatting seemed to be a browser issue, using Konqueror 3.1.0 it stripped away all the newlines from my replies...
Clerfayts
New Member

Re: Can't get a Python extension to work (Boost.Python, g++)

OK, tried all with gcc 3.3.2,
but I does not work really better :

at python import, I get the same
"Fatal python error: Interpreter not initialized", but it seems that things go a little better, as some static varaiables get initialized (some messages in my code for that).

Don't know if it THE pb, but :
When I "ldd" my libs, I find that my stlport
shared lib miss the "_U_Qfneg" symbol.
For some of my executables using the stlport,
this is not a pb, for others, it is !?!?!?

This symbol is not defined anywhere in my gcc 3.3.2 distribution (gcclib.a particularly),
whereas it is in the gcc 3.2 one.
Is there any pb with the gcc 3.3.2 build on HP-UX 11 ?
Uwe Zessin
Honored Contributor

Re: Can't get a Python extension to work (Boost.Python, g++)

Harri,
I don't think you can format messages in the entry box. If that is necessary (e.g. for source code) I suggest you put the data in a small .TXT file and post it as an attachment.
.
Clerfayts
New Member

Re: Can't get a Python extension to work (Boost.Python, g++)

Hi, all.

I've solved my "undefined _U_Qfneg" symbol
(debugging stlport code ...).

But ... it steel doesn't work.

Now, I'm trying to understand what happens in python itself ...

See you soon.

Jean-Philippe.

Harri Pasanen_1
Advisor

Re: Can't get a Python extension to work (Boost.Python, g++)

I wonder why are you using stlport?And did you build your own Python?
Clerfayts
New Member

Re: Can't get a Python extension to work (Boost.Python, g++)

STLport : We wanted a portable STL ... 'cause our project targets Windows XP, Linux and HP-UX.

And all works perfectly under Wondows and Linux

Boost.Python is built with STLport.

Yes, I've built my own python with GCC 3.3.2
(as of STLport and Boost.python) :
./configure --enable-shared --with-gcc --with-threads --with-cxx=/usr/local/bin/g++ --with-libc=-lstdc++ -prefix=$HOME --exec-prefix=$HOME

To go further, I put some printf in python,
and it seems some memory overflow occurs,
'cause the initialization flag of the interpreter is reset to 0 during "import MyModule", whereas the code that do this reset is never called ...