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

"Martin v. Löwis" martin at v.loewis.de
Mon Jul 11 08:36:17 CEST 2005


David Abrahams wrote:
>>- ccpython.cc and linking with g++ is removed entirely. or,
> 
> 
> That would be bad for C++ users on HP/UX.  Is that acceptable?

I hadn't read that far in the threads when I wrote this - I
guess the answer is no, and we must continue to support ccpython.cc.

>>- 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.

>>- 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". 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.

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

Regards,
Martin



More information about the Python-Dev mailing list