1

First logged on GitHub:
https://github.com/metacpan/metacpan-web/issues/2266

Then CPAN:
https://rt.cpan.org/Ticket/Display.html?id=131708

1st issue:

cpan install DBD::Pg fails looking for LIBPQ.dll

Fix:

  1. set Postgres ENVIRONMENT VARIABLES so CPAN/Perl could find all PostgreSQL binaries
  2. Installed MinGW then installed pexports MinGW package so I could follow the DBD::Pg README for Strawberry
  3. Exported symbols from LIBPQ.DLL as described above

Current Issue:

cpan DBD::Pg install now failing with the follow error for all exported symbols above:

dbdimp.o:dbdimp.c:(.text+0x479): undefined reference to 'PQstatus' <...etc...etc...>

Anyone know how I can get this installed and working properly so I can drive Postgres with Perl?

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
skeetastax
  • 1,016
  • 8
  • 18
  • Last couple of lines following the `undefined reference to` lines is: `c:/perl64/site/lib/auto/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: dbdimp.o: bad reloc address 0x0 in section .da ta' collect2: ld returned 1 exit status dmake.exe: Error code 129, while making 'blib\arch\auto\DBD\Pg\Pg.dll'` – skeetastax Feb 09 '20 at 04:47
  • Could the installation of MinGW have spoiled something in Perl? – skeetastax Feb 09 '20 at 04:49

1 Answers1

0

This worked for me:

  • Windows 10
  • Strawberry perl 5.30.1
  • Downloaded PostgreSQL version 12.1 for Windows x86-64
  • Ran the installer. Pre Installation Summary:

    Installation Directory: C:\Program Files\PostgreSQL\12
    Server Installation Directory: C:\Program Files\PostgreSQL\12
    Data Directory: C:\Program Files\PostgreSQL\12\data
    Database Port: 5432
    Database Superuser: postgres
    Operating System Account: NT AUTHORITY\NetworkService
    Database Service: postgresql-x64-12
    Command Line Tools Installation Directory: C:\Program Files\PostgreSQL\12
    pgAdmin4 Installation Directory: C:\Program Files\PostgreSQL\12\pgAdmin 4
    Stack Builder Installation Directory: C:\Program Files\PostgreSQL\12
    
  • From the command prompt:

    > cpanm DBD::Pg
    --> Working on DBD::Pg
    Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.10.4.tar.gz ... OK
    Configuring DBD-Pg-3.10.4 ... OK
    Building and testing DBD-Pg-3.10.4 ... OK
    Successfully installed DBD-Pg-3.10.4 (upgraded from 3.8.0)
    1 distribution installed
    
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174