Re: Problems with DBD::Pg on MacBook Air w/M1 chip

Darren Duncan <[email protected]> Tue, 24 Nov 2020 16:49:18 -0800
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Are you using your own Perl or the System Perl?

I suggest you install your own Perl and use that, it should avoid the SIP 
problem because then you aren't trying to add to a system resource.

-- Darren Duncan

On 2020-11-22 5:25 p.m., adamwizon via dbd-pg wrote:
> I am running Postgres 12.5 on Mac OS X Big Sur 11.0.01 and Perl 5.28.2.
> 
> When I try to build the DBD::Pg module, the ‘make test’ fails on what looks like 
> the SIP problem.  Using the install_name_tool fix does not work, or at least I 
> can not get it to work because I think the libpg.5.dylib does not seem to be in 
> the bundle.
> 
> I am not fluent enough to fix the problem and I may be describing this error 
> inaccurately.  The DBD::Pg version is 3.14.2.  I installed DBI version 1.643 and 
> I looks like it installed properly.
> 
> Here is the error from ‘make test’ on DBD:Pg.
> -------------------------------------------------
> make test
> "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Pg.bs 
> blib/arch/auto/DBD/Pg/Pg.bs 644
> PGINITDB="/Library/PostgreSQL/12/bin/initdb" PERL_DL_NONLAZY=1 "/usr/bin/perl" 
> "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef 
> *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00_signature.t ....... skipped: Set the environment variable TEST_SIGNATURE to 
> enable this test
> t/00basic.t ............ 1/3
> #   Failed test 'use DBD::Pg;'
> #   at t/00basic.t line 18.
> #     Tried to use 'DBD::Pg'.
> #     Error:  Can't load 'blib/arch/auto/DBD/Pg/Pg.bundle' for module DBD::Pg: 
> dlopen(blib/arch/auto/DBD/Pg/Pg.bundle, 0x0002): open("", O_RDONLY) failed with 
> errno=2 at /System/Library/Perl/5.28/darwin-thread-multi-2level/DynaLoader.pm 
> line 197.
> #  at t/00basic.t line 18.
> # Compilation failed in require at t/00basic.t line 18.
> # BEGIN failed--compilation aborted at t/00basic.t line 18.
> # CCFLAGS: q[ -g -pipe -fno-strict-aliasing -fstack-protector-strong 
> -DPERL_USE_SAFE_PUTENV -DPGLIBVERSION=120005 -DPGDEFPORT=5432]
> # INC: q[-I/Library/PostgreSQL/12/include 
> -I/Library/Perl/5.28/darwin-thread-multi-2level/auto/DBI]
> # LIBS: [q[-L/Library/PostgreSQL/12/lib -lpq -lm]]
> # If the error mentions libpq.so, please see the troubleshooting section of the 
> README file
> Bailout called.  Further testing stopped:  Cannot continue without DBD::Pg
> FAILED--Further testing stopped: Cannot continue without DBD::Pg
> make: *** [test_dynamic] Error 255
> 
> ---------------------------------------------------
> 
> 
> Looks like a library path error, but the fix that has been previously posted 
> (see below) did not work with my paths fixed from the example below.
> 
> [sudo install_name_tool -change \
> 
> 	libpq.5.dylib /Library/PostgreSQL/11/lib/libpq.5.dylib \
>      ~/perl5/lib/perl5/darwin-thread-multi-2level/auto/DBD/Pg/Pg.bundle
> 
> ]