为什么Perl的DBD :: DB2在安装过程中找不到dbivport.h?

时间:2010-04-28 05:54:51

标签: perl dbd

我们正在使用Perl实用程序从DB2数据库转储数据。我们安装了DBI包,它也要求DBD包。

我们没有root访问权限,当我们尝试安装DBD软件包时,我们收到以下错误:

    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

我们如何解决这个问题?我们是否需要root访问权限来解决此问题?

2 个答案:

答案 0 :(得分:2)

您遇到了问题,因为大多数perl模块(包括DBD-DB2)都没有写入安装到DBI模块以外的其他位置,如果您尝试以非root用户身份安装,则会发生这种情况。要使其工作,您需要在Makefile中添加如下行:

DEFINE =  -DDB2_CACHE_FIX  -I${DBI_INCL}

并将DBI_INCL设置为具有DBI头文件的目录。

答案 1 :(得分:1)

请查看DBD::DB2 make failed

的CPAN论坛

另外,如果你在下面做的话可以帮助你:

Set the DB2 environment variable

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

安装模块:

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

但是,如果你能为我们提供perl -V输出,你所使用的平台和DBI版本,那么回答这个问题会很有帮助。