|No such thing as a small change|
Re^3: Strawberry CPAN.pm wrongly overrides INC in Makefile.PLby Intrepid (Deacon)
|on Sep 29, 2008 at 12:19 UTC||Need Help??|
Appreciated a lot that you, nobull, posted this since it could not have come at a better time for me: I just set up Strawberry on a new box and hadn’t started using it yet.
It might not be smart to take for granted that the user’s PATH is set up correctly. Mine or yours always would be; but a lot of experience answering questions on realtime chat has demonstrated that many users do not even know what PATH is, or understand PATH and other environmental vars at all. This applies to people right here on Perlmonks everyday; I am not talking at all about some hypothetical breed far outside the possible user base of Strawberry. So a superior approach might be to set cc in the Perl Config-heavy.pl file to the fully-qualified pathname where the mingw gcc that’s shipped with Strawberry is installed. That way the right gcc is always called:
Config_heavy.pl: cc='gcc' becomes cc='C:/strawberry/c/bin/gcc'
Strawberry’s setup program alters the MSWindows system PATH (%Path%) env var but that’s inherently fragile when something later (like a brain-damaged user or other software setup program) could come along and clobber that.
The idea of adding these parameters to CPAN’s makepl_arg so that, eventually down the pipeline, the C compiler will have the right flags to find its own standard headers is addressed in your writeup, nobull: it simply isn’t necessary. It’s something only folks mostly ignorant of how gcc works would think they need to do. However, ExtUtils does check for libs. I don’t believe that it does any checking for headers (MakeMaker's INC) at all. If LIBS needs to be set, it is up to the module author and the user installing the module to work out how to tell ExtUtils what libs and where.
On another note, the manual page for ExtUtils::MakeMaker says:
I note that one sees no anonymous array being created when Strawberry doesmakepl_arg => q[LIBS=-LC:\\strawberry\\c\\lib INC=-IC:\\strawberry\\c\\include],
Right there one suspects cargo-cult coding is going on, where Adam Kennedy does not, as I have found is usual, really understand what is going on. (Yes, I can read, and yes, I know that what ExtUtils does with that plain scalar string is to create a single-entry anonymous array. It’s still dumb and wrong for the commandline (via CPAN.pm) to be used for this in any case, and it’s worse because the approach used is less self-documenting by employing an obscure feature of ExtUtils.)
Adam is great at faking understanding and announcing ambitious projects, then shoving the burden of fixing the fruits of his half-assed guesses off onto other parties (in this case, suggesting that other CPAN authors are the ones doing things wrong). He’s really good at defensively closing himself down to feedback and really really bad at self-motivated learning and asking questions of people who actually know stuff.
In summation, yeah, this is not being done the right way by the current release of Strawberry 5.10. This needs to be fixed.