# Can't locate ExtUtils/MakeMaker.pm in @INC

10 messages from 2017-03-29 to 2017-03-29. Participants: Jeffrey Walton, Jeff King, Ævar Arnfjörð Bjarmason, stefan.naewe@atlas-elektronik.com, Junio C Hamano.
Thread: https://gitlist.dev/t/45533

## Jeffrey Walton, 2017-03-29 01:03

Subject: Can't locate ExtUtils/MakeMaker.pm in @INC
Message-ID: <CAH8yC8kpKii+FNZEUqDqLcuEWBsTTnrqMHq_3VLdAzcpDSKFww@mail.gmail.com>
URL: https://gitlist.dev/e/CAH8yC8kpKii%2BFNZEUqDqLcuEWBsTTnrqMHq_3VLdAzcpDSKFww%40mail.gmail.com

```
This looks like the last issue with Git 2.12.2. This time the machine
is Fedora 25.

I configured with PERL_PATH=/usr/local/bin/perl. The local Perl was
built specifically for this error, and it includes
ExtUtils/MakeMaker.pm:

$ find /usr/local -name MakeMaker.pm
/usr/local/lib/perl5/5.24.1/ExtUtils/MakeMaker.pm

$ make all
...

    GEN git-bisect
    GEN git-difftool--helper
    GEN git-filter-branch
    GEN git-merge-octopus
    GEN git-merge-one-file
    GEN git-merge-resolve
    GEN git-mergetool
    GEN git-quiltimport
    GEN git-rebase
    GEN git-request-pull
    GEN git-stash
    GEN git-submodule
    GEN git-web--browse
    SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/usr/local' INSTALL_BASE=''
--localedir='/usr/local/share/locale'
    GEN git-p4
Can't locate ExtUtils/MakeMaker.pm in @INC (you may need to install
the ExtUtils::MakeMaker module) (@INC contains: /usr/local/lib64/perl5
/usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at
Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
Makefile:83: recipe for target 'perl.mak' failed
make[1]: *** [perl.mak] Error 2
Makefile:1843: recipe for target 'perl/perl.mak' failed
make: *** [perl/perl.mak] Error 2
make: *** Waiting for unfinished jobs....
Failed to build Git

/usr/local/bin/perl is on path but Git is using the old one in /usr/bin:

    $ which perl
    /usr/local/bin/perl

It appears Git is not honoring the request for the updated Perl.

Thanks,

```

## Jeff King, 2017-03-29 02:18

Subject: Re: Can't locate ExtUtils/MakeMaker.pm in @INC
Message-ID: <20170329021807.voys2r65knn6tdwg@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20170329021807.voys2r65knn6tdwg%40sigill.intra.peff.net
In-Reply-To: <CAH8yC8kpKii+FNZEUqDqLcuEWBsTTnrqMHq_3VLdAzcpDSKFww@mail.gmail.com>

```
On Tue, Mar 28, 2017 at 09:03:43PM -0400, Jeffrey Walton wrote:

> This looks like the last issue with Git 2.12.2. This time the machine
> is Fedora 25.
> 
> I configured with PERL_PATH=/usr/local/bin/perl. The local Perl was
> built specifically for this error, and it includes
> ExtUtils/MakeMaker.pm:

I'm not sure what "configured with PERL_PATH" means exactly. If you did:

  PERL_PATH=/usr/local/bin/perl ./configure

then I don't think that works. The way to tell configure that you want
to use a specific version of perl is with a command-line option:

  ./configure --with-perl=/usr/local/bin/perl

When you're running make itself, you can override the default (or what
was specified during configure) with:

  make PERL_PATH=/usr/local/bin/perl

Both of the latter two work for me:

  $ ./configure --with-perl=/perl/from/configure
  [...]
  $ make
  [...]
  /perl/from/configure Makefile.PL PREFIX='/home/peff/local/git/master' INSTALL_BASE='' --localedir='/home/peff/local/git/master/share/locale'
  make[1]: /perl/from/configure: Command not found

  $ make PERL_PATH=/perl/from/make
  [...]
  /perl/from/make Makefile.PL PREFIX='/home/peff/local/git/master' INSTALL_BASE='' --localedir='/home/peff/local/git/master/share/locale'
  make[1]: /perl/from/make: Command not found

Obviously those are nonsense, but they quickly show that we're using the
requested version of perl.

-Peff

```

## Ævar Arnfjörð Bjarmason, 2017-03-29 13:29

Subject: [PATCH] perl: regenerate perl.mak if perl -V changes
Message-ID: <20170329132924.31321-1-avarab@gmail.com>
URL: https://gitlist.dev/e/20170329132924.31321-1-avarab%40gmail.com
In-Reply-To: <20170329021807.voys2r65knn6tdwg@sigill.intra.peff.net>

```
Change the perl/perl.mak build process so that the file is re-made if
the output of "perl -V" changes.

Before this change updating e.g. /usr/bin/perl to a new major version
would cause the next "make" command to fail, since perl.mak has
hardcoded paths to perl library paths retrieved from its first run.

Now the logic added in commit ee9be06770 ("perl: detect new files in
MakeMaker builds", 2012-07-27) is extended to regeneratio
perl/perl.mak if there's any change to "perl -V".

This will in some cases redundantly trigger perl/perl.mak to be
re-made, e.g. if @INC is modified in ways the build process doesn't
care about through sitecustomize.pl, but the common case is that we
just do the right thing and re-generate perl/perl.mak when needed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Wed, Mar 29, 2017 at 4:18 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Mar 28, 2017 at 09:03:43PM -0400, Jeffrey Walton wrote:
>[...]

At first I thought Jeffrey was running into this longstanding issue
with the perl Makefile. Looks like not, and he just wasn't passing
PERL_PATH correctly, but fix this related issue while it's fresh in my
mind.

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index c80fec2920..c0c5510238 100644
--- a/Makefile
+++ b/Makefile
@@ -1850,6 +1850,7 @@ perl/perl.mak: perl/PM.stamp
 
 perl/PM.stamp: FORCE
 	@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
+	$(PERL_PATH) -V >$@+ && \
 	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
 	$(RM) $@+
 
-- 
2.11.0


```

## Ævar Arnfjörð Bjarmason, 2017-03-29 13:33

Subject: [PATCH v2] perl: regenerate perl.mak if perl -V changes
Message-ID: <20170329133359.5992-1-avarab@gmail.com>
URL: https://gitlist.dev/e/20170329133359.5992-1-avarab%40gmail.com
In-Reply-To: <20170329132924.31321-1-avarab@gmail.com>

```
Change the perl/perl.mak build process so that the file is re-made if
the output of "perl -V" changes.

Before this change updating e.g. /usr/bin/perl to a new major version
would cause the next "make" command to fail, since perl.mak has
hardcoded paths to perl library paths retrieved from its first run.

Now the logic added in commit ee9be06770 ("perl: detect new files in
MakeMaker builds", 2012-07-27) is extended to regeneratio
perl/perl.mak if there's any change to "perl -V".

This will in some cases redundantly trigger perl/perl.mak to be
re-made, e.g. if @INC is modified in ways the build process doesn't
care about through sitecustomize.pl, but the common case is that we
just do the right thing and re-generate perl/perl.mak when needed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

Maybe this'll set some sort of record for a v2 submission, but anyway,
this should clearly be >> not >, we don't want to overwrite the list
of *.pm files we just added.

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 9f8b35ad41..485c453ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -1851,6 +1851,7 @@ perl/perl.mak: perl/PM.stamp
 
 perl/PM.stamp: FORCE
 	@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
+	$(PERL_PATH) -V >>$@+ && \
 	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
 	$(RM) $@+
 
-- 
2.11.0


```

## stefan.naewe@atlas-elektronik.com, 2017-03-29 13:36

Subject: Re: [PATCH v2] perl: regenerate perl.mak if perl -V changes
Message-ID: <39b203e9-c3a9-80c3-ec24-649e04ef5620@atlas-elektronik.com>
URL: https://gitlist.dev/e/39b203e9-c3a9-80c3-ec24-649e04ef5620%40atlas-elektronik.com
In-Reply-To: <20170329133359.5992-1-avarab@gmail.com>

```
Am 29.03.2017 um 15:33 schrieb Ævar Arnfjörð Bjarmason:
> Change the perl/perl.mak build process so that the file is re-made if
> the output of "perl -V" changes.
> 
> Before this change updating e.g. /usr/bin/perl to a new major version
> would cause the next "make" command to fail, since perl.mak has
> hardcoded paths to perl library paths retrieved from its first run.
> 
> Now the logic added in commit ee9be06770 ("perl: detect new files in
> MakeMaker builds", 2012-07-27) is extended to regeneratio

s/regeneratio/regenerate/

> [...]


/S
-- 
----------------------------------------------------------------
/dev/random says: HELP! I need a tagline. HELP! Not just any tagline.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF
```

## Ævar Arnfjörð Bjarmason, 2017-03-29 13:57

Subject: [PATCH v3] perl: regenerate perl.mak if perl -V changes
Message-ID: <20170329135703.18860-1-avarab@gmail.com>
URL: https://gitlist.dev/e/20170329135703.18860-1-avarab%40gmail.com
In-Reply-To: <39b203e9-c3a9-80c3-ec24-649e04ef5620@atlas-elektronik.com>

```
Change the perl/perl.mak build process so that the file is regenerated
if the output of "perl -V" changes.

Before this change updating e.g. /usr/bin/perl to a new major version
would cause the next "make" command to fail, since perl.mak has
hardcoded paths to perl library paths retrieved from its first run.

Now the logic added in commit ee9be06770 ("perl: detect new files in
MakeMaker builds", 2012-07-27) is extended to regenerate
perl/perl.mak if there's any change to "perl -V".

This will in some cases redundantly trigger perl/perl.mak to be
re-made, e.g. if @INC is modified in ways the build process doesn't
care about through sitecustomize.pl, but the common case is that we
just do the right thing and re-generate perl/perl.mak when needed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Wed, Mar 29, 2017 at 3:36 PM,  <stefan.naewe@atlas-elektronik.com> wrote:
> Am 29.03.2017 um 15:33 schrieb Ævar Arnfjörð Bjarmason:
> [...]
>> Now the logic added in commit ee9be06770 ("perl: detect new files in
>> MakeMaker builds", 2012-07-27) is extended to regeneratio
>
> s/regeneratio/regenerate/
>
>> [...]
>
>
> /S

Thanks!


 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 9f8b35ad41..485c453ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -1851,6 +1851,7 @@ perl/perl.mak: perl/PM.stamp
 
 perl/PM.stamp: FORCE
 	@$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
+	$(PERL_PATH) -V >>$@+ && \
 	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
 	$(RM) $@+
 
-- 
2.11.0


```

## Jeff King, 2017-03-29 18:12

Subject: Re: [PATCH v3] perl: regenerate perl.mak if perl -V changes
Message-ID: <20170329181228.n4t77pashdnirl3a@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20170329181228.n4t77pashdnirl3a%40sigill.intra.peff.net
In-Reply-To: <20170329135703.18860-1-avarab@gmail.com>

```
On Wed, Mar 29, 2017 at 01:57:03PM +0000, Ævar Arnfjörð Bjarmason wrote:

> Change the perl/perl.mak build process so that the file is regenerated
> if the output of "perl -V" changes.
> 
> Before this change updating e.g. /usr/bin/perl to a new major version
> would cause the next "make" command to fail, since perl.mak has
> hardcoded paths to perl library paths retrieved from its first run.

This is one of those things that has been bugging me for years, but it
comes up so rarely that I have never dug into it.

> Now the logic added in commit ee9be06770 ("perl: detect new files in
> MakeMaker builds", 2012-07-27) is extended to regenerate
> perl/perl.mak if there's any change to "perl -V".

Nice. This fix is way simpler than I feared.

> This will in some cases redundantly trigger perl/perl.mak to be
> re-made, e.g. if @INC is modified in ways the build process doesn't
> care about through sitecustomize.pl, but the common case is that we
> just do the right thing and re-generate perl/perl.mak when needed.

I think that's fine. There's a related bug that the generation of
perl/perl.mak via recursive-make is sometimes racy. So that _might_
trigger more often as a result of this, but I think the solution is to
fix that race, not try to pretend it won't happen. :)

-Peff

```

## Ævar Arnfjörð Bjarmason, 2017-03-29 21:09

Subject: Re: [PATCH v3] perl: regenerate perl.mak if perl -V changes
Message-ID: <CACBZZX70oXn7McjavzvK5S30EXjXQhLixhb=WYbKCKYXVo1KBA@mail.gmail.com>
URL: https://gitlist.dev/e/CACBZZX70oXn7McjavzvK5S30EXjXQhLixhb%3DWYbKCKYXVo1KBA%40mail.gmail.com
In-Reply-To: <20170329181228.n4t77pashdnirl3a@sigill.intra.peff.net>

```
On Wed, Mar 29, 2017 at 8:12 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Mar 29, 2017 at 01:57:03PM +0000, Ævar Arnfjörð Bjarmason wrote:
>
>> Change the perl/perl.mak build process so that the file is regenerated
>> if the output of "perl -V" changes.
>>
>> Before this change updating e.g. /usr/bin/perl to a new major version
>> would cause the next "make" command to fail, since perl.mak has
>> hardcoded paths to perl library paths retrieved from its first run.
>
> This is one of those things that has been bugging me for years, but it
> comes up so rarely that I have never dug into it.

Glad to help. I've only run into this once a couple of days ago, made
a mental note to fix it, and then I saw that thread...

>> Now the logic added in commit ee9be06770 ("perl: detect new files in
>> MakeMaker builds", 2012-07-27) is extended to regenerate
>> perl/perl.mak if there's any change to "perl -V".
>
> Nice. This fix is way simpler than I feared.
>
>> This will in some cases redundantly trigger perl/perl.mak to be
>> re-made, e.g. if @INC is modified in ways the build process doesn't
>> care about through sitecustomize.pl, but the common case is that we
>> just do the right thing and re-generate perl/perl.mak when needed.
>
> I think that's fine. There's a related bug that the generation of
> perl/perl.mak via recursive-make is sometimes racy. So that _might_
> trigger more often as a result of this, but I think the solution is to
> fix that race, not try to pretend it won't happen. :)

We'll also redundantly trigger if you upgrade to a minor new perl
version, but I think that's squarely in "who cares" territory. This'll
only impact people working on git, and *occasionally* they might get a
100 ms hit when running make, as opposed to a cryptic error where
they'll likely stare at it for a bit before running "make clean".

If we were being more pedantic we could only bust the cache on major
perl version upgrades:

    perl -e 'print substr($], 0, 5), "\n"' >>PM.stamp+

Or use Config.pm:

    perl -MConfig -e 'print @Config{qw(api_revision api_version)},
"\n"' >>PM.stamp+

But I think overall leaning on the side of busting the cache more
often to avoid cryptic errors is the right choice, and we should use
"perl -V".

```

## Junio C Hamano, 2017-03-29 21:13

Subject: Re: [PATCH v3] perl: regenerate perl.mak if perl -V changes
Message-ID: <xmqq7f37airn.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq7f37airn.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CACBZZX70oXn7McjavzvK5S30EXjXQhLixhb=WYbKCKYXVo1KBA@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> We'll also redundantly trigger if you upgrade to a minor new perl
> version, but I think that's squarely in "who cares" territory.
> ...
> But I think overall leaning on the side of busting the cache more
> often to avoid cryptic errors is the right choice, and we should use
> "perl -V".

I'd throw it into "better safe than sorry" category.  I think we all
like the approach this patch takes.  Let's queue it and merge it
down soonish.

Thanks.


```

## Jeffrey Walton, 2017-03-29 22:22

Subject: Re: [PATCH v3] perl: regenerate perl.mak if perl -V changes
Message-ID: <CAH8yC8mkndAWP46M2L7TX8HF_y4xa5X29-Q--bA6Prurpya48Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAH8yC8mkndAWP46M2L7TX8HF_y4xa5X29-Q--bA6Prurpya48Q%40mail.gmail.com
In-Reply-To: <CACBZZX70oXn7McjavzvK5S30EXjXQhLixhb=WYbKCKYXVo1KBA@mail.gmail.com>

```
>>> Now the logic added in commit ee9be06770 ("perl: detect new files in
>>> MakeMaker builds", 2012-07-27) is extended to regenerate
>>> perl/perl.mak if there's any change to "perl -V".
>>
>> Nice. This fix is way simpler than I feared.
>>
>>> This will in some cases redundantly trigger perl/perl.mak to be
>>> re-made, e.g. if @INC is modified in ways the build process doesn't
>>> care about through sitecustomize.pl, but the common case is that we
>>> just do the right thing and re-generate perl/perl.mak when needed.
>>
>> I think that's fine. There's a related bug that the generation of
>> perl/perl.mak via recursive-make is sometimes racy. So that _might_
>> trigger more often as a result of this, but I think the solution is to
>> fix that race, not try to pretend it won't happen. :)
>
> We'll also redundantly trigger if you upgrade to a minor new perl
> version, but I think that's squarely in "who cares" territory. This'll
> only impact people working on git, and *occasionally* they might get a
> 100 ms hit when running make, as opposed to a cryptic error where
> they'll likely stare at it for a bit before running "make clean".

+1, I don't mind extra config or build times as long as things "just
work" for the common case.

I was trying to figure out the use case that I was seeing. I was
envisioning someone with Perl 4 in /usr/local who complained it would
break some one-off setup. In the common case, the guy running Perl 4
should do the extra work, not the majority of users operating under
the common case.

Jeff

```
