Liju Mathew
Liju Mathew

Reputation: 899

Why can't Perl's DBD::DB2 find dbivport.h during installation?

We are using a Perl utility to dump data from DB2 database. We installed DBI package and it is asking for DBD package also.

We dont have root access and when we try to install DBD package we are getting the following error:

    ERROR BUILDING DB2.pm
    [lijumathew@intblade03 DBD-DB2-1.78]$ make
    make[1]: Entering directory '/home/lijumathew/lperl/perlsrc/DBD-DB2-1.78/Constants'
    gcc -c  -I"/db2/db2tf1/sqllib/include" -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386 -mtune=pentium4   -DVERSION=\"1.78\" -DXS_VERSION=\"1.78\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   Constants.c
    Running Mkbootstrap for DBD::DB2::Constants ()
    chmod 644 Constants.bs
    rm -f ../blib/arch/auto/DBD/DB2/Constants/Constants.so
    gcc  -shared -L/usr/local/lib Constants.o  -o ../blib/arch/auto/DBD/DB2/Constants/Constants.so
    chmod 755 ../blib/arch/auto/DBD/DB2/Constants/Constants.so
    cp Constants.bs ../blib/arch/auto/DBD/DB2/Constants/Constants.bs
    chmod 644 ../blib/arch/auto/DBD/DB2/Constants/Constants.bs
    make[1]: Leaving directory `/home/lijumathew/lperl/perlsrc/DBD-DB2-1.78/Constants'
    gcc -c  -I"/db2/db2tf1/sqllib/include" -I"/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI" -I"/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/DBI" -I"/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI" -I"/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI"  -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386 -mtune=pentium4   -DVERSION=\"1.78\" -DXS_VERSION=\"1.78\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   DB2.c
    In file included from DB2.h:22,
                     from DB2.xs:7:
    dbdimp.h:10:22: dbivport.h: No such file or directory
    make: *** [DB2.o] Error 1

How do we fix this? Do we need root access to resolve this?

Upvotes: 2

Views: 1045

Answers (2)

Eric
Eric

Reputation: 5365

You're having a problem because most perl modules, including DBD-DB2, aren't written to be installed to different places than the DBI module, which is what happens if you try to install things as non-root. To get this to work, you need to add a line like this to the Makefile:

DEFINE =  -DDB2_CACHE_FIX  -I${DBI_INCL}

and set DBI_INCL to the directory that has the DBI header files.

Upvotes: 2

Space
Space

Reputation: 7259

Please have a look at CPAN forum for DBD::DB2 make failed

Also, if you do below can help you out:

Set the DB2 environment variable

   1. In C Shell setenv DB2_HOME $HOME/sqllib
   2. In Bash Shell export DB2_HOME=$HOME/sqllib

Install Module:

# perl Makefile.PL PREFIX=path
# make
# make test
# make install

However, it would be helpful to answer the problem if you can provide us with the perl -V output, the platform you are on and DBI version.

Upvotes: 1

Related Questions