Subject: | install issue with strawberry perl: No rule to make target '..\blib\arch\Tk\pTk\.exists' |
This issue is for documentation purposes.
Found on https://www.perlmonks.org/?node_id=1195707 (2020-10-17):
When trying to install:
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.24)
Checking if you have Tk 800.022 ... Yes (804.033)
Building and testing Tk-TableMatrix-1.23
cp TableMatrix.pm blib\lib\Tk\TableMatrix.pm
AutoSplitting blib\lib\Tk\TableMatrix.pm (blib\lib\auto\Tk\TableMatrix)
cp TableMatrix/Spreadsheet.pm blib\lib\Tk\TableMatrix\Spreadsheet.pm
cp TableMatrix/SpreadsheetHideRows.pm blib\lib\Tk\TableMatrix\SpreadsheetHideRows.pm
cd pTk && gmake
gmake[1]: Entering directory 'C:/Users/gan/.cpanm/work/1500635987.10348/Tk-TableMatrix-1.23/pTk'
gmake[1]: *** No rule to make target '..\blib\arch\Tk\pTk\.exists', needed by 'config'. Stop.
gmake[1]: Leaving directory 'C:/Users/gan/.cpanm/work/1500635987.10348/Tk-TableMatrix-1.23/pTk'
gmake: *** [Makefile:1171: pTk/libpTk.a] Error 2
-> FAIL Installing Tk::TableMatrix failed. See C:\Users\gan\.cpanm\work\1500635987.10348\build.log for details. Retry with --force to force install it.
Reason:
In Makefile.PL in the pTk dir, MY::postamble adds some targets manually.
The syntax uses the directory separator defined by File::Spec->catfile. However, in the Makefile, it should be $(DFSEP), because that is what the generated targets use, too.
"Debug" code:
sub MY::postamble {
my $self = shift;
my $dep = $self->Tk::MMutil::mTk_postamble;
$dep .= $self->dir_target(@{$self->{'dir_targets'}});
use Data::Dumper qw/Dumper/;
print "dir targets:\n";
print Dumper $self->{'dir_targets'};
print "\n";
my @result = map($_.'$(DFSEP).exists',@{$self->{'dir_targets'}});
print "result after map:\n";
print Dumper \@result;
#die;
# XXX: issue because of backslash instead of forward slash. catfile generates backslash (\), $(DFSEP) in Makefile generates forward slash (/)
#$dep .= "config :: " . join(" \\\n\t",map($self->catfile($_,".exists"),@{$self->{'dir_targets'}})) .
# add some additional dir targets - reason currently unknown. Use $(DFSEP) as dir separatir or makefile will not find target (target uses $(DFSEP) too).
$dep .= "config :: " . join(" \\\n\t",map($_.'$(DFSEP).exists',@{$self->{'dir_targets'}})) .
"\n\t".$self->{NOECHO}."\$(NOOP)\n";
$dep . '
'.$self->{NOECHO}.'$(NOOP)
';
}