
Hello,
I need some help on http://bugs.python.org/issue5941
The bug is quite simple: the Distutils unixcompiler used to set the archiver command to "ar -rc".
For quite a while now, this behavior has changed in order to be able to customize the compiler behavior from the environment. That introduced a regression because the mechanism in Distutils that looks for the AR variable in the environment also looks into the Makefile of Python. (in the Makefile then is os.environ)
And as a matter of fact, AR is set to "ar" in there, so the -cr option is not set anymore.
So my question is : should I make a change into the Makefile by adding for example a variable called AR_OPTIONS then build the ar command with AR + AR_OPTIONS
*or*
that doesn't make sense and I just need to change the behavior so it doesn't look for AR into the Makefile. (just in os.environ)
Thanks Tarek

On Wed, May 6, 2009 at 6:01 PM, Tarek Ziadé ziade.tarek@gmail.com wrote:
Hello,
I need some help on http://bugs.python.org/issue5941
The bug is quite simple: the Distutils unixcompiler used to set the archiver command to "ar -rc".
For quite a while now, this behavior has changed in order to be able to customize the compiler behavior from the environment. That introduced a regression because the mechanism in Distutils that looks for the AR variable in the environment also looks into the Makefile of Python. (in the Makefile then is os.environ)
And as a matter of fact, AR is set to "ar" in there, so the -cr option is not set anymore.
So my question is : should I make a change into the Makefile by adding for example a variable called AR_OPTIONS then build the ar command with AR + AR_OPTIONS
I think for consistency, it could be named ARFLAGS (this is the name usually taken for configure scripts), and both should be overridable as the other variable in distutils.sysconfig.customize_compiler. Those flags should be used in Makefile.pre as well, instead of the harcoded cr as currently used.
Here is what I would try: - check for AR (already done in the configure script AFAICT) - if ARFLAGS is defined in the environment, use those, otherwise set ARFLAGS to cr - use ARFLAGS in the makefile
Then, in the customize_compiler function, set archiver to $AR + $ARFLAGS. IOW, just copying the logic used for e.g. ldshared,
I can prepare a patch if you want,
cheers,
David

On Thu, May 7, 2009 at 11:50 AM, David Cournapeau cournape@gmail.com wrote:
Then, in the customize_compiler function, set archiver to $AR + $ARFLAGS. IOW, just copying the logic used for e.g. ldshared,
I can prepare a patch if you want,
I am ok on Distutils side, but I wouldn't mind some help on the makefile/configure side Even if I could mimic what's in there, I am not confident enough yet.
Please do so, by attaching your patch in the issue,
Thanks
Tarek
participants (2)
-
David Cournapeau
-
Tarek Ziadé