简体   繁体   中英

can't find version.pm while trying to install DBD-Pg-2.19.3 on Centos-7

On Centos 7.

The oracle DBD installed just fine I am having a problem with the Postgresql version.

This is the script I am running:

set -x -e
sudo yum -y install perl-devel
sudo yum -y install perl-DBI

cp ./DBD* /tmp
pushd /tmp
tar xvf DBD-Oracle-1.52.tar
tar xvf DBD-Pg-2.19.3.tar
pushd DBD-Oracle-1.52
perl Makefile.PL
sudo make
sudo make install
popd
pushd DBD-Pg-2.19.3
perl Makefile.PL
sudo make
sudo make install

the postgresql DBD perl Makefile.PL returns

++ perl Makefile.PL
Configuring DBD::Pg 2.19.3
PostgreSQL version: 90224 (default port: 5432)
POSTGRES_HOME: (not set)
POSTGRES_INCLUDE: /usr/include
POSTGRES_LIB: /usr/lib64
OS: linux
Warning: prerequisite Test::More 0.61 not found.
Warning: prerequisite version 0 not found.
Could not eval '
                package ExtUtils::MakeMaker::_version;
                no strict;
                BEGIN { eval {
                    # Ensure any version() routine which might have leaked
                    # into this package has been deleted.  Interferes with
                    # version->import()
                    undef *version;
                    require version;
                    "version"->import;
                } }

                local $VERSION;
                $VERSION=undef;
                do {
                        use version; our $VERSION = qv('2.19.3');
                };
                $VERSION;
            ' in Pg.pm: Can't locate version.pm in @INC (@INC contains: t/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 9) line 16, <$fh> line 19.
BEGIN failed--compilation aborted at (eval 9) line 16, <$fh> line 19.
WARNING: Setting VERSION via file 'Pg.pm' failed
 at /usr/share/perl5/vendor_perl/ExtUtils/MakeMaker.pm line 619.
Using DBI 1.627 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/auto/DBI/
Writing Makefile for DBD::Pg
++ sudo make
Skip blib/lib/DBD/testme.tmp.pl (unchanged)
Skip blib/lib/Bundle/DBD/Pg.pm (unchanged)
Skip blib/lib/DBD/Pg.pm (unchanged)
gcc -c  -I/usr/include -I/usr/lib64/perl5/vendor_perl/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=90224 -DPGDEFPORT=5432 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"undef\" -DXS_VERSION=\"undef\" -fPIC "-I/usr/lib64/perl5/CORE"   Pg.c
In file included from Pg.xs:13:0:
Pg.h:36:22: fatal error: libpq-fe.h: No such file or directory
 #include "libpq-fe.h"
                      ^
compilation terminated.
make: *** [Pg.o] Error 1

however locate shows:

/common/oracle/tfa/austin/tfa_home/perl/lib/5.22.0/version.pm
/common/oracle/tfa/austin/tfa_home/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm
/common/orainst/perl/lib/5.22.0/version.pm
/common/orainst/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm
/opt/oracle/product/18c/dbhomeXE/perl/lib/5.22.0/version.pm
/opt/oracle/product/18c/dbhomeXE/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm

You need to install the full Perl core. In CentOS 7 this package is called perl-core , and perl is just the interpreter, not suitable if you actually want to use it yourself. The full Perl been renamed to perl (and the interpreter renamed to perl-interpreter ) in recent versions of Fedora.

yum install perl-core

Even better is to build your own Perl , so that you can install things into it as you need without messing with the system Perl that may be used by other things and not expect these updates. If you stick to using the system Perl, it's recommended to isolate any modules you install without the package manager using a local::lib or Carton .

It looks like you already have a separate build of Perl, as those paths containing 5.22.0 are not from the system perl in CentOS 7. This installation of Perl will not be managed or related to anything you install with yum unless it's from an Oracle repository. The correct way to install modules that can handle the dependencies for that module is with the cpan client, or other clients like cpanm . Just make sure to run the executable for the Perl you want to install modules into and use.

This is the (current) problem prerequisite Test::More 0.61 not found .
This is the solution https://superuser.com/a/1111321/156111

"

yum install make cpan

Then configure your perl with CPAN. Just enter cpan in the command prompt and answer yes to all interactive questions.

Then update you cpan manager:

#cpan install Bundle::CPAN
#cpan reload cpan

And now install packages of your interest:

#cpan install Test::More

"

If you're happy using the system Perl and its associated Perl library (as you seem to be as you're running yum install perl-DBI ) then you can use the pre-packaged version of DBD::Pg.

 sudo yum install perl-DBD-Pg

And this will automatically pull in any other RPMs that are required.

DBD::Oracle is harder. A pre-built package is not available (presumably, because Oracle is not open source), but you could probably build your own RPM following the method I described a few years ago . You will need to ensure that the Oracle client libraries (and their associated header files) are already installed.

set -x -e
sudo yum -y install perl-devel
sudo yum -y install perl-DBI
sudo yum -y install perl-version perl-Data-Dumper
sudo yum -y install postgresql-devel
cp ./DBD* /tmp
pushd /tmp
tar xvf DBD-Oracle-1.52.tar
tar xvf DBD-Pg-2.19.3.tar
pushd DBD-Oracle-1.52
perl Makefile.PL
sudo make
sudo make install
popd
pushd DBD-Pg-2.19.3
perl Makefile.PL
sudo make
sudo make install
cd ~/ora2pg
perl Make.PL
sudo make
sudo make install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM