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

David Abrahams dave at boost-consulting.com
Fri Jul 8 07:49:23 CEST 2005


"Martin v. Löwis" <martin at v.loewis.de> writes:

> David Abrahams wrote:
>>>configure thinks that using CXX for linking is necessary if compiling
>>>a program using CXX and linking it using CC fails.
>> 
>> 
>> That might be the right thing to do for some programs, but AFAICT
>> that's the wrong logic to use for Python.
>
> Why do you say that? Python compiles Modules/ccpython.cc as the main
> function, using the C++ compiler, and then tries to link it somehow.
> On some systems (including some Linux installations), linking will
> *fail* if linking is done using gcc (instead of g++). So we *must*
> link using g++, or else it won't link at all.

This is starting to feel tautological, or self-referential, or
something.  If by ccpython.cc you mean
http://cvs.sourceforge.net/viewcvs.py/*checkout*/python/python/dist/src/Modules/ccpython.cc
well of *course* linking will fail.  You have to compile that file as
C++ program since it uses

    extern "C"

which is only legal in C++ .  But AFAICT, in a normal build of the
Python executable, there's no reason at all for main to be a C++
function in the first place.

Unless, of course, I'm missing something.  So if I am missing
something, what is it?

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


More information about the Python-Dev mailing list