Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

problem installing DBD::Pg

by expo1967 (Sexton)
on Jan 20, 2020 at 17:23 UTC ( [id://11111639]=perlquestion: print w/replies, xml ) Need Help??

expo1967 has asked for the wisdom of the Perl Monks concerning the following question:

I am not able to install the DBD::Pg module on my windows 10 64 bit laptop.

I followed the instruction in Bundle::DBD::Pg which stated to use the following command:

perl -MCPAN -e 'install Bundle::DBD::Pg'

after a short while the build process failed. Here are the last few lines of output

C:\Perl64\bin\perl.exe C:\Perl64\lib\ExtUtils\xsubpp -typemap C:\Perl +64\lib\ExtUtils\typemap Pg.xs > Pg.xsc && C:\Perl64\bin\perl.exe -ME +xtUtils::Command -e mv -- Pg.xsc Pg.c cl -c -I"C:/PROGRA~1/POSTGR~1/12/include" -IC:\Perl64\lib\aut +o\DBI -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DWIN32 - +D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS +-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE +_PERLIO -DPGLIBVERSION=120001 -DPGDEFPORT=5432 -MD -Zi -DNDEBUG -Ox - +GL -fp:precise -DVERSION=\"3.10.2\" -DXS_VERSION=\"3.10.2\" "-IC +:\Perl64\lib\CORE" Pg.c Pg.c c:\perl64\lib\core\win32.h(218): warning C4005: 'isnan': macro redefin +ition C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corec +rt_math.h(276): note: see previous definition of 'isnan' C:\Perl64\lib\auto\DBI\Driver_xst.h(70): warning C4996: 'sprintf': Thi +s function or variable may be unsafe. Consider using sprintf_s instea +d. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online he +lp for details. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' C:\Perl64\lib\auto\ +DBI\Driver_xst.h(110): warning C4244: 'function': conversion from 'IV +' to 'I32', possible loss of data C:\Perl64\lib\auto\DBI\Driver_xst.h(114): warning C4244: 'function': c +onversion from '__int64' to 'I32', possible loss of data C:\Perl64\lib\auto\DBI\Driver_xst.h(97): warning C4996: 'sprintf': Thi +s function or variable may be unsafe. Consider using sprintf_s instea +d. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online he +lp for details. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' ./Pg.xsi(210): warn +ing C4244: 'initializing': conversion from '__int64' to 'int', possib +le loss of data ./Pg.xsi(642): warning C4244: 'initializing': conversion from '__int64 +' to 'int', possible loss of data Pg.xs(259): warning C4244: 'function': conversion from 'IV' to 'int', +possible loss of data Pg.xs(267): warning C4244: 'function': conversion from 'IV' to 'int', +possible loss of data Pg.xs(270): warning C4244: 'function': conversion from 'IV' to 'int', +possible loss of data Pg.xs(805): warning C4244: 'function': conversion from 'IV' to 'int', +possible loss of data Pg.c(3242): error C2129: static function 'int *_errno(void)' declared +but not defined C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\errno +.h(19): note: see declaration of '_errno' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual S +tudio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.EXE +"' : return code '0x2' Stop. TURNSTEP/DBD-Pg-3.10.2.tar.gz C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Host +X86\x86\nmake.exe -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxil +iary\Build>

How do I correct this issue ? I have been google searching but I have not yet found anything helpfull.

Replies are listed 'Best First'.
Re: problem installing DBD::Pg
by syphilis (Archbishop) on Jan 21, 2020 at 00:22 UTC
      i checked Pg.c and it only had 3241 lines. Are you sure about the line number 3242 ?

        There is no Pg.c in the distribution, only Pg.xs, which will be translated to Pg.c by the ExtUtils/xsubpp tool in your perl distribution.

        Depending on a lot of aspects, line numbers in Pg.c have no meaning to people working on different versions of perl, DBI or OS.

        If you build from source, you can find the line numbers after make/nmake/dmake/gmake:

        $ grep ^#line Pg.c | tail -4 #line 907 "Pg.xs" #line 2834 "Pg.c" #line 39 "./Pg.xsi" #line 3359 "Pg.c"

        Only the line numbers in Pg.xs will be useful to others (using the same version of DBD::Pg).


        Enjoy, Have FUN! H.Merijn
        Are you sure about the line number 3242 ?

        Sorry - it hadn't occurred to me that Pg.c was (as Tux has just pointed out) a generated file.

        The problem arises because of the declaration of static int errno; in Pg.h. (This declaration is made only on Windows.)
        I would first try removing that declaration (line 14) from Pg.h and then rebuild DBD::Pg afresh.
        Here's a simple demo of the problem:

        UPDATE: In this demo script, I originally declared foo() as SV * foo().
        I have now corrected that declaration to void foo().
        use strict; use warnings; use Inline C => <<'END_OF_C'; static int errno; void foo() { printf("errno: %d\n", errno); } END_OF_C foo();
        On Windows, running that perl script with my Platform SDK compiler (14.00.40310.41), I get:
        Microsoft (R) Program Maintenance Utility Version 7.00.8882 Copyright (C) Microsoft Corp 1988-2000. All rights reserved. --snip-- cl -c -I"C:/_32/pscrpt/inline" -nologo -GF -W3 -MD -Zi -DNDEBUG +-Ox -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVA +TIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONT +EXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -Ox -GL -fp:pre +cise -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" "-IC:\_64\ap1600\l +ib\CORE" try_pl_3645.c try_pl_3645.c try_pl_3645.c(210) : error C2129: static function 'int *_errno(void)' +declared but not defined C:\_64\Platform_SDK\Include\crt\errno.h(54) : see declaration +of '_errno' NMAKE : fatal error U1077: 'cl' : return code '0x2' Stop. A problem was encountered while attempting to compile and install your + Inline C code. The command that failed was: C:\_64\PLATFO~1\Bin\nmake.exe > out.make 2>&1 The build directory was: C:\_32\pscrpt\inline\_Inline\build\try_pl_3645 To debug the problem, cd to the build directory, and inspect the outpu +t files. at try.pl line 12. ...propagated at C:/_64/ap1600/site/lib/Inline/C.pm line 772. BEGIN failed--compilation aborted at try.pl line 12.
        I get the same problem with mingw (gcc) compilers - with slightly different error messages.

        There's only the one instance of "errno" in the entire DBD::Pg source, so I'm guessing there's no harm in removing that one and only instance at line 14 of Pg.h.
        Or am I missing something ?

        Cheers,
        Rob
Re: problem installing DBD::Pg
by swl (Parson) on Jan 20, 2020 at 23:30 UTC

    Could you provide more details about your system? The output of the perl -V command, for example.

    cpan testers show green for Windows for version 3.10.2, but those look like 32 bit Strawberry perl builds and it looks like you're using your own 64 bit perl compiled with VS2017?

    http://matrix.cpantesters.org/?dist=DBD-Pg%203.10.2

      Output from perl -V on my system is as follows
      Summary of my perl5 (revision 5 version 16 subversion 3) configuration +: Platform: osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:pr +ecise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TE +XTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMP +LICIT_SYS -DUSE_PERLIO', optimize='-MD -Zi -DNDEBUG -Ox -GL -fp:precise', cppflags='-DWIN32' ccversion='19.0.23506', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__in +t64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -lt +cg -libpath:"C:\Perl64\lib\CORE" -machine:AMD64' libpth=\lib libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib +comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi3 +2.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib o +dbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.l +ib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib net +api32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.l +ib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt: +ref,icf -ltcg -libpath:"C:\Perl64\lib\CORE" -machine:AMD64' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB +_ALLOC USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1603 [296746] Built under MSWin32 Compiled at Mar 13 2013 13:31:10 @INC: C:/Perl64/site/lib C:/Perl64/lib .
Re: problem installing DBD::Pg
by 1nickt (Canon) on Jan 20, 2020 at 21:46 UTC

    Hi, just a complete and not totally serious stab in the dark: at the moment I read your question I noticed that a new version of DBD::Pg was released (seen in this site's CPAN nodelet) ... worth a look, maybe your question ascended out of the Monastery and to the heavens already?


    The way forward always starts with a minimal test.
      I downloaded and unpacked the file from your link for DBD-Pg-3.10.3 and followed the instructions in the README file. The "perl Makefile.PL" command was successfull. The make command failed with the following output
      C:\Users\barry\Downloads\DBD-Pg-3.10.3>perl Makefile.PL Configuring DBD::Pg 3.10.3 PostgreSQL version: 120001 (default port: 5432) POSTGRES_HOME: (not set) POSTGRES_INCLUDE: C:/PROGRA~1/POSTGR~1/12/include POSTGRES_LIB: C:/PROGRA~1/POSTGR~1/12/lib OS: MSWin32 Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lm Using DBI 1.623 (for perl 5.016003 on MSWin32-x64-multi-thread) instal +led in C:/Perl64/lib/auto/DBI/ Writing Makefile for DBD::Pg Writing MYMETA.yml and MYMETA.json C:\Users\barry\Downloads\DBD-Pg-3.10.3>make make: *** No rule to make target `C:\Perl64\libConfig.pm', needed by ` +makefile'. Stop. C:\Users\barry\Downloads\DBD-Pg-3.10.3>
        You probably need to run 'nmake' instead of 'make'. And you shouldn't need to modify the generated Makefile.
        Run perl -V:make to find out what flavour of make you need to execute.

        Cheers,
        Rob

        I'm not familiar with the details of makefiles, but in your original example you were using nmake, while in this version you are using make. Are these the same?

        I've also seen the issue with paths like C:\Perl64\libConfig.pm before, but forget the specifics. It was something to do with running gmake/dmake via the cmd window, possibly with msys folders in %PATH%.

        C:\Perl64\libConfig.pm
        missing a slash after 'lib' ?


        The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11111639]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found