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

David Abrahams dave at boost-consulting.com
Mon Jul 11 14:37:04 CEST 2005


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

>>>- the logic is fixed so that linking with g++ is only done if
>>>  main is in ccpython.o
>> 
>> 
>> I don't see how that works.  Somehow we need to decide whether to put
>> main in ccpython.o in the first place, don't we?
>
> Yes, that is done through --with-cxx (alone). However, the decision
> to use CXX for linking is independent on whether --with-cxx was
> given.

Is the above a description of existing behavior or a behavior you're
proposing?

>
>>>- the configure test is extended to better match current g++
>>>  behaviour.
>> 
>> 
>> What do you have in mind?
>
> Somebody reported that the test works better for g++ if the
> function is marked extern "C". 

Which function?
What does "works better" mean?

> This should be done for 2.4 regardless of any other change.
>
>>>I just checked, and it seems that the logic in use is still somewhat
>>>different. If the configure test determines that a C++ main()
>>>must be linked with CXX, it unconditionally changes the linker to CXX.
>>>The test, in turn, is run always if a C++ compiler was found,
>>>i.e. independently of whether --with-cxx was provided.
>> 
>> 
>> That doesn't match up with reports from my testers who say they can
>> run with C++ extension modules from many different GCC versions if
>> they just configure their Python --without-cxx.  If what you were
>> saying were true, wouldn't --without-cxx be ignored on ELF/Linux?
>
> Ok, it's still different. I see three cases now:
> 1. --without-cxx or --with-cxx=no specified. configure does not look
>    for a C++ compiler, and does not check whether linking needs
>    to be done with a C++ compiler, and decides to use Modules/python.c.
> 2. --with-cxx not given. configure does look for a C++ compiler,
>    and does check whether linking with the C++ compiler is necessary,
>    and still uses Modules/python.c
> 3. --with-cxx is given. configure requires it to point to a C++
>    compiler, performs the linking check, and uses Modules/ccpython.cc.

Is the above a description of existing behavior or is it a behavior
you're proposing?

> It would help discussion if you would use the actual code, too,
> instead of just using reports from your testers.

I don't know what you mean by "use the actual code."  Do you mean,
refer to the actual code in the discussion, or do you mean actually
building and running Python --without-cxx myself?  If the latter, I
don't see a reason to repeat what people I trust have already done.

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


More information about the Python-Dev mailing list