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

"Martin v. Löwis" martin at v.loewis.de
Sun Jul 10 23:09:49 CEST 2005


David Abrahams wrote:
>   - we add a configure test that runs after the existing test
>     determines that --with-cxx is needed (but not when --with-cxx is
>     explicitly specified on the command line)
> 
>   - This test runs a 'C' executable that tries to load a C++ dynamic
>     library with dlopen.  
> 
>   - The test returns an error code if the the dynamic library's static
>     and dynamic initializers have not been run properly
> 
>   - If the test fails we disable --with-cxx
> 
> ??

What would be the purpose of such a test? The test may fail for many
reasons, for example, dlopen might not be available.

OTOH, on current Linux systems the test would succeed, so configure
would conclude to link with g++.

> I'm trying to intrude on the existing behavior as little as possible,
> yet get the semantics we want for ELF/Linux in a way that stands a
> good chance of generalizing to other platforms.

I now think that the code should be made more simple, not more complex.
Aspects of a solution I could accept:

- ccpython.cc and linking with g++ is removed entirely. or,
- the logic is fixed so that linking with g++ is only done if
  main is in ccpython.o
- the configure test is extended to better match current g++
  behaviour.

> Well, that would certainly be an easy "solution," but it would break
> HP/UX, and it would break anyone that needs to statically link C++
> modules on some platforms.  It's a much more drastic change than it
> would be to only have the system use --with-cxx when the person
> running configure asks for it explicitly.

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.

Regards,
Martin




More information about the Python-Dev mailing list