3

When trying to install Win32::API from CPAN using Active Perl, the installation isn't successful. The problems stem from the following error:

'dmake' is not recognized as an internal or external command,

How can I resolve this problem?


Full output of cpan Win32::API:

Loading internal logger. Log::Log4perl recommended for better logging
Reading 'C:\Perl64\cpan\Metadata'
  Database was generated on Sat, 21 Mar 2020 04:17:03 GMT
CPAN: LWP::UserAgent loaded ok (v6.31)
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
CPAN: YAML::XS loaded ok (v0.69)
Reading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'
CPAN: Compress::Zlib loaded ok (v2.092)
............................................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz
Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
  Database was generated on Sun, 22 Mar 2020 05:41:03 GMT
.............
  New CPAN.pm version (v2.27) available.
  [Currently running version is v2.20]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


...............................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/03modlist.data.gz
Reading 'C:\Perl64\cpan\sources\modules\03modlist.data.gz'
DONE
Writing C:\Perl64\cpan\Metadata
Running install for module 'Win32::API'
CPAN: Digest::SHA loaded ok (v6.01)
Checksum for C:\Perl64\cpan\sources\authors\id\B\BU\BULKDD\Win32\Win32-API-0.84.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.30)
Win32-API-0.84/
....
Win32-API-0.84/Type.pm
Win32-API-0.84/TYPEMAP
Win32-API-0.84/typemap56
Win32-API-0.84/W32ATest.pm
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20181129_28)
Configuring B/BU/BULKDD/Win32/Win32-API-0.84.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Encode::compat 0 not found.
Warning: prerequisite Math::Int64 0 not found.
Writing MYMETA.yml and MYMETA.json
Generating a dmake-style Makefile
Writing Makefile for Win32::API
Writing MYMETA.yml and MYMETA.json
  BULKDD/Win32/Win32-API-0.84.tar.gz
  C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK
Running make for B/BU/BULKDD/Win32/Win32-API-0.84.tar.gz
---- Unsatisfied dependencies detected during ----
----    BULKDD/Win32/Win32-API-0.84.tar.gz    ----
    Encode::compat [build_requires]
    Math::Int64 [build_requires]
Running install for module 'Encode::compat'
Checksum for C:\Perl64\cpan\sources\authors\id\A\AU\AUTRIJUS\Encode-compat-0.07.tar.gz ok
....
Encode-compat-0.07/META.yml
Encode-compat-0.07/Changes
Encode-compat-0.07/t/
Encode-compat-0.07/t/1-basic.t
Encode-compat-0.07/t/0-signature.t
Encode-compat-0.07/MANIFEST
Encode-compat-0.07/SIGNATURE
Encode-compat-0.07/Makefile.PL
Encode-compat-0.07/README
Configuring A/AU/AUTRIJUS/Encode-compat-0.07.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for Encode::compat
Writing MYMETA.yml and MYMETA.json
  AUTRIJUS/Encode-compat-0.07.tar.gz
  C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK
Running make for A/AU/AUTRIJUS/Encode-compat-0.07.tar.gz
'dmake' is not recognized as an internal or external command,
operable program or batch file.
  AUTRIJUS/Encode-compat-0.07.tar.gz
  dmake -- NOT OK
Running install for module 'Math::Int64'
Checksum for C:\Perl64\cpan\sources\authors\id\S\SA\SALVA\Math-Int64-0.54.tar.gz ok
Math-Int64-0.54/
Math-Int64-0.54/COPYING
Math-Int64-0.54/Changes
.....
Configuring S/SA/SALVA/Math-Int64-0.54.tar.gz with Makefile.PL
Using IV backend
fileparse(): need a valid pathname at C:/Perl64/site/lib/ExtUtils/CBuilder/Base.pm line 50.
Checking for stdlib.h... Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site]
  SALVA/Math-Int64-0.54.tar.gz
  C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK
  BULKDD/Win32/Win32-API-0.84.tar.gz
  Has already been unwrapped into directory C:\Perl64\cpan\build\Win32-API-0.84-2
  BULKDD/Win32/Win32-API-0.84.tar.gz
  Has already been prepared
Running make for B/BU/BULKDD/Win32/Win32-API-0.84.tar.gz
Warning: Prerequisite 'Encode::compat => 0' for 'BULKDD/Win32/Win32-API-0.84.tar.gz' failed when processing 'AUTRIJUS/Encode-compat-0.07.tar.gz' with 'make => NO'. Continuing, but chances to succeed are limited.
Warning: Prerequisite 'Math::Int64 => 0' for 'BULKDD/Win32/Win32-API-0.84.tar.gz' failed when processing 'SALVA/Math-Int64-0.54.tar.gz' with 'writemakefile => NO 'C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site' returned status 6400'. Continuing, but chances to succeed are limited.
'dmake' is not recognized as an internal or external command,
operable program or batch file.
  BULKDD/Win32/Win32-API-0.84.tar.gz
  dmake -- NOT OK
ikegami
  • 367,544
  • 15
  • 269
  • 518
elliot
  • 39
  • 5
  • Your module is not installed properly. Why are you using double quotes around cpan. On cmd as administrator, Install like => cpan Win32::API . Check the cmd output for any error. If your module get installed properly you will be able to see it in 'C:/Perl64/site/lib/Win32/' – rai-gaurav Mar 22 '20 at 06:13
  • Are you using Strawberry Perl? – Håkon Hægland Mar 22 '20 at 08:24
  • Ok, The output you provided showed the default install location is being used. /// So now, I need the previously-requested output of `cpan Win32::API`. (This time, add it to your question. Feel free to add a comment that includes `@ikegami` letting me know you've added the information.) – ikegami Mar 23 '20 at 04:08
  • @ikegami I do not fully understand. Would you be a little more descriptive? – elliot Mar 23 '20 at 04:35
  • I came across such an output. @ikegami – elliot Mar 23 '20 at 04:39
  • Well, it used to be that ActivePerl's `cpan` would automatically install `dmake` and a C compiler if needed. That's all I know. – ikegami Mar 23 '20 at 04:40
  • @ikegami As if the problem cannot be solved ... – elliot Mar 23 '20 at 04:42
  • I hope you don't mind, but I just rewrote the Question to focus on the actual problem to increase your chances of getting help. Feel free to edit/revert. – ikegami Mar 23 '20 at 04:45
  • I care about my problem. I have been following for days. thank you @ikegami – elliot Mar 23 '20 at 04:47
  • 1
    Your question is technically a duplicate of [this one](https://stackoverflow.com/q/59477263/589924), but that was resolved as "just switch to Strawberry Perl". It does contain some interesting info, though. – ikegami Mar 23 '20 at 04:49
  • It looks like your installation is missing utility `dmake.exe` please see the following [page](https://code.activestate.com/ppm/dmake/), or this [page](https://dzone.com/articles/installing-cpan-modules-on-activeperl-518-and-late). – Polar Bear Mar 23 '20 at 07:18
  • @elliot Are you sure your download is not blocked over 'http'. Are you installing it at home or inside company firewall. I also faced the similar issue . Turns out in active state perl they download 'dmake' from http://ppm4.activestate.com/MSWin32-x64/5.26/2600/-/--/MINGW/dmake-4.11.20080107.tar.gz (for perl 5.26) which is hosted on 'http' and hence I am not able to install a single module. – rai-gaurav Mar 23 '20 at 14:29
  • Just check whether the above link is working or not in browser. If not, then maybe your firewall is blocking the dmake download and hence installation. – rai-gaurav Mar 23 '20 at 14:37

2 Answers2

1

I have ActivePerl and was able to install (some) modules. I am using MinGW, and all I had to do is to copy it's make and rename the copy dmake.exe. That did it for me.

Alternatively, there is a way to tell CPAN which make to use: in cpan, use the command

cpan> o conf make <your make path and executable>

I got this answer from this post. I did encounter a different problem with other modules.

Miguel
  • 31
  • 3
0

This worked fine for me with Strawberry Perl, Windows 10:

> perl --version
This is perl 5, version 30, subversion 1 (v5.30.1) built for MSWin32-x64-multi-thread

> cpan Win32::API
Loading internal logger. Log::Log4perl recommended for better logging
CPAN: CPAN::SQLite loaded ok (v0.217)
CPAN: LWP::UserAgent loaded ok (v6.42)
Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.txt.gz
CPAN: YAML::XS loaded ok (v0.80)
Fetching with LWP:
http://cpan.strawberryperl.com/modules/02packages.details.txt.gz
Fetching with LWP:
http://cpan.strawberryperl.com/modules/03modlist.data.gz
Creating database file ... Done!
CPAN: Module::CoreList loaded ok (v5.20191120)
Win32::API is up to date (0.84).

Then created script file p.pl:

use strict;
use warnings;
use Win32::API;

my $GetCommandLine = Win32::API->new('kernel32', 'LPTSTR GetCommandLine()');
my $val = $GetCommandLine->Call();
print "The command line of this program is: $val\n";

And run the test:

> perl p.pl
The command line of this program is: perl  p.pl
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
  • Sir, yes thank you for that. But I need to set up a strawberry perl. I have ActivePerl and I forgot to write it. Active Perl 5.28.1. I can't call the library in ActivePerl. – elliot Mar 22 '20 at 14:49
  • Saying it worked for you doesn't help debug the problem they are facing – ikegami Mar 22 '20 at 21:32