2

I'm trying to install the perl module POSIX::strptime on a Windows 10 system, which is running Strawberry Perl 5.24.1.1 (64 bit), using cpan command but it fails to build and install. The command I'm using is:

cpan> install POSIX::strptime

and the output is:

Running install for module 'POSIX::strptime'
Checksum for C:\STRAWB~1\cpan\sources\authors\id\G\GO\GOZER\POSIX-strptime-0.13.tar.gz ok
Configuring G/GO/GOZER/POSIX-strptime-0.13.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for POSIX::strptime
Writing MYMETA.yml and MYMETA.json
  GOZER/POSIX-strptime-0.13.tar.gz
  C:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for G/GO/GOZER/POSIX-strptime-0.13.tar.gz
cp lib/POSIX/strptime.pm blib\lib\POSIX\strptime.pm
Running Mkbootstrap for strptime ()
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "strptime.bs"
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- strptime.bs blib\arch\auto\POSIX\strptime\strptime.bs 644
"C:\Strawberry\perl\bin\perl.exe" "C:\Strawberry\perl\lib\ExtUtils\xsubpp"  -typemap C:\STRAWB~1\perl\lib\ExtUtils\typemap  strptime.xs > strptime.xsc
Please specify prototyping behavior for strptime.xs (see perlxs manual)
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- strptime.xsc strptime.c
gcc -c  -I.     -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2        -DVERSION=\"0.13\"    -DXS_VERSION=\"0.13\"  "-IC:\STRAWB~1\perl\lib\CORE"   strptime.c
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
  -e "Mksymlists('NAME'=>\"POSIX::strptime\", 'DLBASE' => 'strptime', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);" 
g++ strptime.def -o blib\arch\auto\POSIX\strptime\strptime.xs.dll -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" strptime.o   "C:\STRAWB~1\perl\lib\CORE\libperl524.a" -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -Wl,--enable-auto-image-base
strptime.o:strptime.c:(.text+0x121): undefined reference to `strptime'
collect2.exe: error: ld returned 1 exit status
dmake.exe:  Error code 129, while making 'blib\arch\auto\POSIX\strptime\strptime.xs.dll'
  GOZER/POSIX-strptime-0.13.tar.gz
  C:\STRAWB~1\c\bin\dmake.exe -- NOT OK
Stopping: 'install' failed for 'POSIX::strptime'.  
Failed during this command:
  GOZER/POSIX-strptime-0.13.tar.gz             : make NO

Is anyone able to help me resolve this issue?

Thanks, Matt

Matt
  • 75
  • 7
  • At first glance, almost all of the CPAN testers [failures](http://www.cpantesters.org/distro/P/POSIX-strptime.html?oncpan=1&distmat=1&version=0.13&grade=3) are on Windows. To rephrase, there are no passing tests for the Win platform. I'm doing some quick testing now though. – stevieb Apr 03 '17 at 23:54
  • After cursory review, it looks like the distribution is using `time.h`, which isn't found on Windows, which may be breaking things. If so, the POD should state this, and there should be checks in the `Makefile.PL` to halt building if `$^O =~ /Win32/` – stevieb Apr 04 '17 at 00:01
  • 1
    [Related](http://stackoverflow.com/questions/321849/strptime-equivalent-on-windows) – ikegami Apr 04 '17 at 02:20
  • 1
    Alternative: [DateTime::Format::Strptime](http://search.cpan.org/perldoc?DateTime::Format::Strptime) – ikegami Apr 04 '17 at 02:20
  • @stevieb `time.h` does indeed exist on Windows. It is the non-ANSI/ISO function [strptime](http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html) that is missing. – Sinan Ünür Apr 04 '17 at 13:55
  • Thanks for the feedback everyone. – Matt Apr 05 '17 at 18:07

1 Answers1

2

In your log, the key error is:

strptime.o:strptime.c:(.text+0x121): undefined reference to 'strptime'

There is no strptime on Windows to link to. Therefore, the module does not have a chance of building on Windows. Makefile.PL should test for that and bail out.

As has been pointed out, DateTime::Format::Strptime may be a suitable replacement. Time::Strptime and Time::Piece->strptime are other alternatives.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 1
    Ultimately I am trying to install Image::ExifTool which depends on POSIX::strptime, so switching probably means I'll need to modify source somewhere. Thanks for you help Sinan, much appreciated. – Matt Apr 05 '17 at 18:03
  • @Matt AFAIK, `POSIX::strptime` is an optional dependency for `exiftool` ... It can use `Time::Piece` instead. I would just force install `Image::ExifTool`. – Sinan Ünür Apr 05 '17 at 19:40
  • Good to know, I'll give it a go. Again, thanks Sinan – Matt Apr 07 '17 at 12:11