perlmodulestrawberry-perldbd

DBD::Pg compilation error (Windows 10 / Strawberry Perl)


I'm trying to install the DBD::Pg (3.7.4) module on my windows 10/Strawberry Perl, but the compilation failed

For that I downloaded the module on metacpan and executed following command in the windows terminal:

perl Makefile.PL phrtsd_orig

Response:

Configuring DBD::Pg 3.7.4
PostgreSQL version: 90603 (default port: 5432)
POSTGRES_HOME: (not set)
POSTGRES_INCLUDE: C:/STRAWB~1/c/include
POSTGRES_LIB: C:/STRAWB~1/c/lib
OS: MSWin32
Multiple copies of Driver.xst found in: C:/Strawberry/perl/site/lib/auto/DBI/ C:/Strawberry/perl/vendor/lib/auto/DBI/ at Makefile.PL line 182.
Multiple copies of Driver.xst found in: C:/Strawberry/perl/site/lib/auto/DBI/ C:/Strawberry/perl/vendor/lib/auto/DBI/ at Makefile.PL line 285.
Using DBI 1.64 (for perl 5.026001 on MSWin32-x64-multi-thread) installed in C:/Strawberry/perl/site/lib/auto/DBI/
Generating a gmake-style Makefile
Writing Makefile for DBD::Pg
Writing MYMETA.yml and MYMETA.json

But the problem comes after the execution of the command gmake. Response:

Skip blib\lib/Bundle/DBD/Pg.pm (unchanged)
Skip blib\lib\DBD/Pg.pm (unchanged)
Running Mkbootstrap for Pg ()
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "Pg.bs"
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Pg.bs blib\arch\auto\DBD\Pg\Pg.bs 644
gcc -c  -I"C:/STRAWB~1/c/include" -IC:\Strawberry\perl\site\lib\auto\DBI -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPGLIBVERSION=90603 -DPGDEFPORT=5432 -s -O2   -DVERSION=\"3.7.4\" -DXS_VERSION=\"3.7.4\"  "-IC:\STRAWB~1\perl\lib\CORE"   Pg.c
gcc -c  -I"C:/STRAWB~1/c/include" -IC:\Strawberry\perl\site\lib\auto\DBI -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPGLIBVERSION=90603 -DPGDEFPORT=5432 -s -O2   -DVERSION=\"3.7.4\" -DXS_VERSION=\"3.7.4\"  "-IC:\STRAWB~1\perl\lib\CORE"   dbdimp.c
gcc -c  -I"C:/STRAWB~1/c/include" -IC:\Strawberry\perl\site\lib\auto\DBI -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPGLIBVERSION=90603 -DPGDEFPORT=5432 -s -O2   -DVERSION=\"3.7.4\" -DXS_VERSION=\"3.7.4\"  "-IC:\STRAWB~1\perl\lib\CORE"   quote.c
gcc -c  -I"C:/STRAWB~1/c/include" -IC:\Strawberry\perl\site\lib\auto\DBI -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -DPGLIBVERSION=90603 -DPGDEFPORT=5432 -s -O2   -DVERSION=\"3.7.4\" -DXS_VERSION=\"3.7.4\"  "-IC:\STRAWB~1\perl\lib\CORE"   types.c
g++ Pg.def -o blib\arch\auto\DBD\Pg\Pg.xs.dll -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" Pg.o dbdimp.o quote.o types.o   "C:\STRAWB~1\perl\lib\CORE\libperl526.a" "C:\STRAWB~1\c\lib\libpq.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libsecur32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-base
quote.o:quote.c:(.text+0x63d): undefined reference to `__imp__snprintf.constprop.4'
collect2.exe: error: ld returned 1 exit status
gmake: *** [Makefile:496: blib\arch\auto\DBD\Pg\Pg.xs.dll] Error 1

In case this information can help, I have two other module installed:

Thanks in advance for you help !


Solution

  • I can reproduce this with DBD-Pg-3.7.4. It is a known bug. The patch by kmx worked for me.