Search code examples
windowsperlcpanstrawberry-perl

Unable to install perl CPAN module POSIX::strptime


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


Solution

  • 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.