Ronald Oussoren <ronaldousso...@mac.com> added the comment: 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. ---------- keywords: +patch nosy: +tarek Added file: http://bugs.python.org/file18181/setup.py.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9047> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com