perldb2rhelcpanmrocky-os

Not able to install/compile perl module DBD::DB2 on Rocky Linux 9.4 with cpanm


I'm trying to install/compile the DBD::DB2 perl module on rocky linux 9.4 with the cpanm commando but it is not working.I tried even On RHEL and Oracle Linux but is not working anyway.

I get the following error:

    [root@ol9vm-desk01 ~]# cpanm DBD::DB2
    --> Working on DBD::DB2
    Fetching http://www.cpan.org/authors/id/R/RO/ROCKETDB/DBD-DB2-1.89.tar.gz ... OK
    Configuring DBD-DB2-1.89 ... OK
    Building and testing DBD-DB2-1.89 ... FAIL
    ! Installing DBD::DB2 failed. See /root/.cpanm/work/1720158884.3245/build.log for details. Retry with --force to force install it.

What I did untill now:

1. Perl Installed:

    [root@ol9vm-desk01 ~]# perl -V
    Summary of my perl5 (revision 5 version 32 subversion 1) configuration:
      Platform:
        osname=linux
        osvers=5.15.0-5.76.5.1.el9uek.x86_64
        archname=x86_64-linux-thread-multi
        uname='linux host-100-100-224-49 5.15.0-5.76.5.1.el9uek.x86_64 #2 smp fri dec 9 18:37:36 pst 2022 x86_64 x86_64 x86_64 gnulinux'
config_args='-des -Doptimize=none -Dccflags=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Dldflags=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Dlddlflags=-shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.32.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5/5.32 -Dsitearch=/usr/local/lib64/perl5/5.32 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize -Duse64bitint'

 @INC:
    /usr/local/lib64/perl5/5.32
    /usr/local/share/perl5/5.32
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5

2. IBM DB2 Data Server Client installed

    tdbcli@ol9vm-desk01 ~]$ db2level
    DB21085I  This instance or install (instance name, where applicable: "tdbcli") 
    uses "64" bits and DB2 code release "SQL11059" with level identifier 
    "060A010F".
    Informational tokens are "DB2 v11.5.9.0", "s2310270807", "DYN2310270807AMD64", 
    and Fix Pack "0".
    Product is installed at "/opt/ibm/db2/V11.5".

3. DBI Perl module successfully installed as prerequisite:

    instmodsh 
    Available commands are:
       l            - List all installed modules
       m <module>   - Select a module
       q            - Quit the program
    cmd? l
    Installed modules are:
       DBI
       Perl

4. Try Installing the perl Module as root DBD::DB2:

    DB2_HOME=/opt/ibm/db2/V11.5
    export DB2LIB=/opt/ibm/db2/V11.5/lib64

    [root@ol9vm-desk01 ~]# cpanm DBD::DB2
    --> Working on DBD::DB2
    Fetching http://www.cpan.org/authors/id/R/RO/ROCKETDB/DBD-DB2-1.89.tar.gz ... OK
    Configuring DBD-DB2-1.89 ... OK
    Building and testing DBD-DB2-1.89 ... FAIL
    ! Installing DBD::DB2 failed. See /root/.cpanm/work/1720158884.3245/build.log for details. Retry     with --force to force install it.

Here the final part of the compilation log error:

dbdimp.c: In function ‘dbd_st_cancel’:
/usr/local/lib64/perl5/5.32/auto/DBI/DBIXS.h:383:45: warning: unused variable ‘imp_dbh’ [-Wunused-variable]
  383 | #define D_imp_dbh_from_sth D_imp_from_child(imp_dbh, imp_dbh_t, imp_sth)
      |                                             ^~~~~~~
/usr/local/lib64/perl5/5.32/auto/DBI/DBIXS.h:381:39: note: in definition of macro ‘D_imp_from_child’
  381 |                                 type *name = (type*)(DBIc_PARENT_COM(child))
      |                                       ^~~~
dbdimp.c:3000:9: note: in expansion of macro ‘D_imp_dbh_from_sth’
 3000 |         D_imp_dbh_from_sth;
      |         ^~~~~~~~~~~~~~~~~~
dbdimp.c: In function ‘db2_st_finish’:
/usr/local/lib64/perl5/5.32/auto/DBI/DBIXS.h:383:45: warning: unused variable ‘imp_dbh’ [-Wunused-variable]
  383 | #define D_imp_dbh_from_sth D_imp_from_child(imp_dbh, imp_dbh_t, imp_sth)
      |                                             ^~~~~~~
/usr/local/lib64/perl5/5.32/auto/DBI/DBIXS.h:381:39: note: in definition of macro ‘D_imp_from_child’
  381 |                                 type *name = (type*)(DBIc_PARENT_COM(child))
      |                                       ^~~~
dbdimp.c:3019:9: note: in expansion of macro ‘D_imp_dbh_from_sth’
 3019 |         D_imp_dbh_from_sth;
      |         ^~~~~~~~~~~~~~~~~~
dbdimp.c: In function ‘bind_lob_column_helper’:
dbdimp.c:1081:1: warning: control reaches end of non-void function [-Wreturn-type]
 1081 | }
      | ^
dbdimp.c: In function ‘db2_describe’:
dbdimp.c:1318:20: warning: ‘db_codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1318 |                 if ( app_codepage != db_codepage) {
      |                    ^
dbdimp.c:1318:20: warning: ‘app_codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
cc1: some warnings being treated as errors
make: *** [Makefile:351: dbdimp.o] Error 1

At the moment I am really lost...

Thank you in advance for your help

I tried sourcing the db2 environment in this way:

source /home/tdbcli/sqllib/db2profile

but I got the same failure.

For a better understanding I post the complete build log: https://drive.google.com/open?id=1-4UaeGKh_hZ__-T0v0TVwNxxce8I_6zD&usp=drive_fs


Solution

  • Fix in dbdimp.c:

    $ diff -u dbdimp.bak dbdimp.c
    --- dbdimp.bak  2021-04-07 05:43:19.000000000 +0200
    +++ dbdimp.c    2024-07-08 14:30:15.240336900 +0200
    @@ -2896,7 +2896,7 @@
                   if( longTruncOk )
                     warn( "%s", msg );
                   else
    -                croak( msg );
    +                croak( "%s", msg );    
                 }
                 else if( ChopBlanks && SQL_CHAR == fbh->dbtype )