Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: problem installing DBD::Pg

by expo1967 (Sexton)
on Jan 22, 2020 at 14:40 UTC ( [id://11111724]=note: print w/replies, xml ) Need Help??


in reply to Re: problem installing DBD::Pg
in thread problem installing DBD::Pg

i checked Pg.c and it only had 3241 lines. Are you sure about the line number 3242 ?

Replies are listed 'Best First'.
Re^3: problem installing DBD::Pg
by Tux (Canon) on Jan 22, 2020 at 15:04 UTC

    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
Re^3: problem installing DBD::Pg
by syphilis (Archbishop) on Jan 23, 2020 at 00:06 UTC
    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
        So add something like #if _MSC_VER == 1200 ... #endif so its only added where it was historically needed

        I have Visual Studio 6.0 and I have an ActiveState build of perl-5.16.0 that was built with Visual Studio 6.0.
        I see exactly the same behaviour when I run my Inline::C script on that build of perl, using Visual Studio 6.0.

        I can't see that the inclusion of that static declaration would ever have been anything other than a fatal build-time error.
        And yet, DBD::Pg-3.8.0 (which includes that static declaration) ships with latest Strawberry Perl.
        Did Strawberry Perl developers remove that declaration in order to build DBD::Pg ?
        Could someone check http://strawberryperl.com/package/kmx/perl-modules-patched/ and see if there's any mention of patches to DBD::Pg. (I'm unable to access that page.)

        Cheers,
        Rob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2024-04-25 01:13 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found