Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL

by Intrepid (Deacon)
on Sep 29, 2008 at 12:19 UTC ( #714335=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL
in thread Strawberry CPAN.pm wrongly overrides INC in Makefile.PL

 ...

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.

There is no need to pass these setting. The Makefile invokes GCC as simply “gcc” thus assuming that the environment (at least PATH) is configured correctly to find the correct GCC installation. If you are using the GCC.EXE that’s found by traversing the PATH environment variable then you should be using the (standard) headers and libraries that are found by traversing the LIB and INCLUDE environment variables.

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:

LIBS – An anonymous array of alternative library specifications to be searched for (in order) until at least one library is found.

I note that one sees no anonymous array being created when Strawberry does

makepl_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.


Comment on Re^3: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL
Download Code
Re^4: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL
by Anonymous Monk on Sep 30, 2008 at 07:52 UTC
    Config_heavy.pl: cc='gcc' becomes cc='C:/strawberry/c/bin/gcc'
    I already do something similar in the Portable Perl interface. Since Strawberry is still locked into using a fixed path, this is probably an excellent idea.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://714335]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-10-02 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls