This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients lemburg, ronaldoussoren, tarek
Date 2010-07-24.12:10:52
SpamBayes Score 1.772029e-05
Marked as misclassified No
Message-id <1279973455.25.0.0957515289538.issue9047@psf.upfronthosting.co.za>
In-reply-to
Content
The root cause of having the flags twice is that the Makefile explicitly sets LDFLAGS in the environment before when running setup.py, and that distutils appens the value of $(LDFLAGS) to $(LDSHARED) when LDFLAGS is set in the environment.

Line from the makefile:
    $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;

And in Lib/distutils/ccompiler.py (in customize_compiler):

        if 'LDFLAGS' in os.environ:
            ldshared = ldshared + ' ' + os.environ['LDFLAGS']

A quick workaround to remove the duplicate flags is to explictly remove the related values from os.environ before calling main in setup.py:


# --install-platlib
if __name__ == '__main__':
    import os
    del os.environ['LDFLAGS']
    main()

I've attached a patch that implements this behavior. I'm not 100% sure this is the right solution because sysconfig._parse_makefile also looks at the environment and it may be better to remove the code from ccompiler.customize_compiler instead.
History
Date User Action Args
2010-07-24 12:10:55ronaldoussorensetrecipients: + ronaldoussoren, lemburg, tarek
2010-07-24 12:10:55ronaldoussorensetmessageid: <1279973455.25.0.0957515289538.issue9047@psf.upfronthosting.co.za>
2010-07-24 12:10:53ronaldoussorenlinkissue9047 messages
2010-07-24 12:10:53ronaldoussorencreate