[Python-Dev] Linux Python linking with G++?

David Abrahams dave at boost-consulting.com
Sun Jul 10 02:15:29 CEST 2005


Ulrich Berning <ulrich.berning at t-online.de> writes:

> David Abrahams schrieb:
>
>>Ulrich Berning <ulrich.berning at t-online.de> writes:
>>
>>  
>>
>>> If you build C++ extensions on HP-UX with aCC, Python must be
>>> compiled and linked as a C++ program. This is documented.
>>>    
>>>
>>
>>You mean dynamically loaded C++ extensions, or the kind that are
>>linked into the Python executable?
>>
>>  
>>
> Dynamically loaded extensions, especially SIP/PyQt 
> (http://www.riverbankcomputing.co.uk).

I see.

>>I'm willing to believe almost anything about HP-UX.  Until recently,
>>aCC was so broken as a C++ compiler that there was little point in
>>trying to get Boost.Python to work on it, and I don't have much data
>>for that system.
>>
>>  
>>
> I'm using the HP aC++ Compiler C.03.50 together with the patches 
> PHSS_29483 and PHSS_30967 on HP-UX B.11.00 and had no problems to build 
> Python (2.3.5), Qt, SIP and PyQt and all other extensions with it.

Yeah, but Boost tends to stress a C++ compiler's correctness much more
than Qt.

>>>It will not work if Python is compiled and linked as a normal C
>>>program (I have tried it).
>>
>>Even if you take out the use of C++ constructs in ccpython.cc?  I just
>>need to check all the obvious angles.
>  
> What do you mean? The only C++ construct in ccpython.cc is the extern 
> "C" declaration of Py_Main() 

That's what I mean.

> and this is necessary if a C++ program 
> references symbols from a C library. HP says, that a C++ shared library 
> or a C++ shared object can only be loaded by a C++ main program. 

Well, that's dumb, but I believe it.

> I can't remember the error message/symptoms, but I tried to build
> Python using python.c and couldn't load any C++ extensions. Because
> I'm going on vacation for the next three weeks, I can't try anything
> on HP-UX at the moment.

Okay, I'm convinced that on HP/UX, Python needs to be a C++ program.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


More information about the Python-Dev mailing list