syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

What follows is a re-hash of a question I asked on the makemaker mailing list a couple of weeks ago (and received no reply):

I use the one build of dmake for a variety of perls (both 32-bit and 64-bit) that have been built with different mingw compilers.

For some of those perls, $(CC) needs to be set to 'gcc', for others it needs to be set to 'x86_64-w64-mingw32-gcc'.
Similarly $(AR) can be either 'ar' or 'x86_64-w64-mingw32-ar' ... and $(AS) either 'as' or 'x86_64-w64-mingw32-as'.

Both $(CC) and $(AR) always get set correctly for the particular perl/compiler. I think this is owing to the influence of ExtUtils::MakeMaker .... right ?

But $(AS) always gets set to 'as'. Could EU::MM be modified to influence this setting ?
Which particular EU::MM module(s) should I be looking at in order to come up with a patch ?

dmake's startup.mk contains the following 2 lines:
AS *:= as
AR *:= ar

Basically, I just want to extend the process that sets $(AR) correctly to apply also to $(AS).

Cheers,
Rob

Replies are listed 'Best First'.
Re: [Win32] Overriding dmake's $(AS)
by VinsWorldcom (Prior) on Jul 10, 2014 at 17:27 UTC

    Maybe not exactly what you want, but it sounds to me like you have different versions of Perl, potentially different bit-tedness and want to be able to install / compile modules correctly for each one.

    I do this in Windows with a batch script. See Re: Multiple Strawberry Perl Versions under Windows for details.

    Essentially, I'm pointing the C:\Strawberry directory to the root installation directory of any version of Perl on my system. That way, no changes to PATH are needed and from the command prompt, 'perl' will always run and be whatever version, and with all the proper associations (gcc, as, ar, etc.) for that specific version.

    My default:

    VinsWorldcom@C:\Users\VinsWorldcom> perl -v This is perl 5, version 18, subversion 1 (v5.18.1) built for MSWin32-x +64-multi-thread [....] VinsWorldcom@C:\Users\VinsWorldcom> as --version GNU assembler (GNU Binutils) 2.23.2 Copyright 2012 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms + of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-w64-mingw32'.

    Now let's switch to Perl 5.8 32-bit:

    VinsWorldcom@C:\Users\VinsWorldcom> perlreloc.bat 5.8.8-MSWin32-x86-mu +lti-thread Junction v1.06 - Windows junction creator and reparse point viewer Copyright (C) 2000-2010 Mark Russinovich Sysinternals - www.sysinternals.com Deleted c:\strawberry. Junction v1.06 - Windows junction creator and reparse point viewer Copyright (C) 2000-2010 Mark Russinovich Sysinternals - www.sysinternals.com Created: c:\strawberry Targetted at: c:\strawberry_5.8.8-MSWin32-x86-multi-thread 5.008008 @ C:\strawberry\perl\bin\perl.exe

    ...and verify

    VinsWorldcom@C:\Users\VinsWorldcom> perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread [...] VinsWorldcom@C:\Users\VinsWorldcom> as --version GNU assembler 2.17.50 20060824 Copyright 2005 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms + of the GNU General Public License. This program has absolutely no warran +ty. This assembler was configured for a target of `mingw32'.
      I think I'm on a different page :-)

      I have a number of perls (some 32-bit, some 64-bit) all of which use the same (32-bit) dmake.
      I have no problems with that, except for when it comes to building Win32::API.

      For all other modules, it works fine.
      With the 32-bit perls, running perl Makefile.PL generates a Makefile that specifies:
      AR = ar.exe
      CC = gcc.exe
      That is correct, and as it should be.

      With the 64-bit perls (which, obviously, use a different compiler), running perl Makefile.PL generates a Makefile that specifies:
      AR = x86_64-w64-mingw32-ar.exe
      CC = x86_64-w64-mingw32-gcc.exe
      That is correct, and as it should be.

      However, when building Win32::API, the assembler (as.exe) gets invoked.
      No problem on the 32-bit perls - the assembler gets correctly invoked as 'as.exe'.
      But on the 64-bit perls, it also gets invoked as 'as.exe' - which is incorrect as it ought to be invoked as 'x86_64-w64-mingw32-as.exe'.

      Obviously there's some process somewhere that handles the correct setting of AR.
      I would like to apply that same process to AS so that it, too, gets set correctly for the 64-bit perls.
      But I don't know what/where that "process" actually is.
      Any ideas ?

      UPDATE: Seems that "ar", like "cc", is set in %Config.
      But there is no %Config setting for "as" ... so I think I'm probably faced with hacking the dmake files (or copying 'x86_64-w64-mingw32-as.exe' to 'as.exe').
      Ought there be a %Config setting for the assembler ?

      Cheers,
      Rob
        Ought there be a %Config setting for the assembler ?

        You decide.

        You've described an excellent case for it being so.

        And you are the only one who comes around here that has: the vaguest inclining of how this stuff works; and the tuits to make it happen.

        Decide, and go tuit. Or not as you see fit. You have as much expertise and far more tuits on this subject than anyone else who still visits this place on a regular basis.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        Ought there be a %Config setting for the assembler ?

        Hmm, perl doesn't use it, so I guess not :/ maybe :)

        If you look at Win32-API-0.77\Makefile.PL you'll see it uses $(AS) but it doesn't define it , which probably means it simply defaults to 'as'

        You can always arrange for  perl Makefile.PL AS=x86_64-w64-mingw32-as.exe

        dmake should also pick it up from %ENV via set AS=x86_64-w64-mingw32-as.exe or via sitecustomize $ENV{AS}='x86_64-w64-mingw32-as.exe';

        Or give it to Makefile.PL via $ENV{PERL_MM_OPT} https://metacpan.org/pod/ExtUtils::MakeMaker#PERL_MM_OPT

        So no Makefile hacking required, set some %ENV vars as usual :)

        I guess whomever built your toolchain chose x86_64-w64-mingw32-as.exe so they can dump all the .exe in the same directory :) choices complicate choices :)

Re: [Win32] Overriding dmake's $(AS)
by bulk88 (Priest) on Jul 13, 2014 at 04:10 UTC
    http://perl5.git.perl.org/perl.git/blob/HEAD:/win32/makefile.mk has a variable called ARCHPREFIX but it is never saved in Config/Config_heavy. EU::MM would actually be getting the "as" value from Config_heavy.pl if "as" would exist in the future. So its a p5p change which means "as" would become available in the next major release. It isn't really a EUMM change unless EUMM will test perl versions, and if that perl doesn't have "as" in %Config then special case if (/gcc$/ && /^(.+)gcc$/), and add that prefix to the future $(AS).
      EU::MM would actually be getting the "as" value from Config_heavy.pl if "as" would exist in the future

      Would EU::MM pick that up automatically ?
      It's easy enough to set 'as' to the correct value ('x86_64-w64-mingw32-as') in Config_heavy.pl, and doing so means that $Config{as} is set to that correct value. However, $(AS) in the Win32::API Makefile is still set to the incorrect value of 'as'.
      Perhaps it just needs 'as' to have been available (in config.gc) when perl was being built ... I haven't tested that out yet.

      In any case, you're correct that the first thing to do is to get 'as' into the next release. I'll request that of p5p soon.

      Cheers,
      Rob