Reputation: 13
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
Upvotes: 1
Views: 460
Reputation: 12267
Your question states that you also fail to do the build of DBD::DB2 on RHEL, although you gave no details.
This answer shows the current successful status of that build of DBD::DB2 on RHEL 8.10 x64.
The sequence of commands below uses a disposable copy of clidriver, only to show that the build is working. If you want to test the build then unpack the clidriver into a permanent location (not /tmp) and adjust the environment variable appropriately. However, in your case you have a Db2-client locally installed so you would use that instead if correctly configured (typically by dotting in the relevant db2profile
even if a client-instance).
Note: you do not need to install any Db2 components to perform this specific build, although relevant header-files and library files have to be present and identified via environment-variables but this can be via a zero install method. But if you do have a relevant Db2-component already installed then it has to be correctly configured, and in particular the relevant environment variables (see below) have to be properly set before the build (db2profile).
If you get a different result on RHEL, check your configuration.
perl -v
-- 5.26.3
cpanm DBI
-- 1.643
cd /tmp
-- download a copy of IBM's clidriver.
curl -O https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz
-- unpack the clidriver and point environment variables to it
tar xzf linuxx64_odbc_cli.tar.gz
export INCLUDE=/tmp/clidriver/include
export LIB=/tmp/clidriver/lib
export DB2_HOME=/tmp/clidriver
export LD_LIBRARY_PATH=/tmp/clidriver/LIB
-- now build the DBD::DB2 driver and install it.
# 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 ... OK
Successfully installed DBD-DB2-1.89
1 distribution installed
If you get a different result (i.e. cc1: some warnings being treated as errors
) then It may be that your version of perl is compiled with -Werror
(or similar) option to gcc in the CCFLAGS to report warnings as errors.
Some options to investigate :
(1) rebuild perl without the -Werror=format-security (not recommended)
(2) don't use cpanm to build DBD::DB2 but instead build it manually from the Makefile.PL adjusting the code if needed (see the other answer for a possible code change).
(3) see if additional options to cpanm can adjust cflags, for example --configure-args="--cflags=...." to remove the
-Werror=format-security`
(4) Either use an older version of Perl that does not have the coding defect that causes the format-security
warning to get emitted. Or just wait for the repository to get updated with the code fix and rebuild afterwards.
Upvotes: 1
Reputation: 1910
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 )
Upvotes: 1