Subject: | compile error for DBD::cego with DBI > 1.622 on fbsd 9.1 amd64 |
From: | complx-on-cpan [...] opsec.eu |
On a recent ports tree on freebsd 9.1 amd64, there's an issue compiling
databases/p5-DBD-cego because of a type conflict in
/usr/local/lib/perl5/site_perl/5.16.2/mach/auto/DBI/Driver.xst
Below is the log of the compile error and some patch against Driver.xst.
I'm *not* familiar with DBI and do not know whether my patch breaks
anything or causes security issues, but maybe this helps.
I submitted a fbsd PR as an intermediate fix for databases/p5-DBD-cego:
http://www.freebsd.org/cgi/query-pr.cgi?pr=177473
Here is how databases/p5-DBD-cego fails:
--------------
# cd /usr/ports/databases/p5-DBD-cego
# make
===> License GPLv2 accepted by the user
===> Fetching all distfiles required by p5-DBD-cego-1.2.0 for building
===> Extracting for p5-DBD-cego-1.2.0
=> SHA256 Checksum OK for DBD-cego-1.2.0.tar.gz.
===> p5-DBD-cego-1.2.0 depends on file: /usr/local/bin/perl5.16.2 - found
===> Patching for p5-DBD-cego-1.2.0
===> p5-DBD-cego-1.2.0 depends on file: /usr/local/bin/perl5.16.2 - found
===> Applying FreeBSD patches for p5-DBD-cego-1.2.0
===> p5-DBD-cego-1.2.0 depends on package: p5-DBI>=1.61 - found
===> p5-DBD-cego-1.2.0 depends on file: /usr/local/bin/perl5.16.2 - found
===> p5-DBD-cego-1.2.0 depends on shared library: cego.1 - found
===> Configuring for p5-DBD-cego-1.2.0
Checking if your kit is complete...
Looks good
Using DBI 1.625 (for perl 5.016002 on amd64-freebsd) installed in /usr/local/lib/perl5/site_perl/5.16.2/mach/auto/DBI/
Writing Makefile for DBD::Cego
Writing MYMETA.yml and MYMETA.json
===> Building for p5-DBD-cego-1.2.0
cp Cego.pm blib/lib/DBD/Cego.pm
/usr/local/bin/perl5.16.2 -p -e "s/~DRIVER~/Cego/g" /usr/local/lib/perl5/site_perl/5.16.2/mach/auto/DBI/Driver.xst > Cego.xsi
/usr/local/bin/perl5.16.2 /usr/local/lib/perl5/site_perl/5.16.2/ExtUtils/xsubpp -noprototypes -C++ -typemap /usr/local/lib/perl5/5.16.2/ExtUtils/typemap -typemap perlobject.map -typemap typemap Cego.xs > Cego.xsc && mv Cego.xsc Cego.c
c++ -c -I/usr/local/lib/perl5/site_perl/5.16.2/mach/auto/DBI -I/usr/local/include -O2 -pipe -fno-strict-aliasing -O6 -DNDEBUG=1 -DVERSION=\"1.1.15\" -DXS_VERSION=\"1.1.15\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.16.2/mach/CORE" Cego.c
./Cego.xsi: In function 'void XS_DBD__Cego__db__login(CV*)':
./Cego.xsi:96: error: invalid conversion from 'const char*' to 'char*'
./Cego.xsi:97: error: invalid conversion from 'const char*' to 'char*'
./Cego.xsi: In function 'void XS_DBD__Cego__db_selectall_arrayref(CV*)':
./Cego.xsi:124: warning: deprecated conversion from string constant to 'char*'
./Cego.xsi:139: warning: deprecated conversion from string constant to 'char*'
./Cego.xsi: In function 'void XS_DBD__Cego__db_selectrow_arrayref(CV*)':
./Cego.xsi:182: warning: deprecated conversion from string constant to 'char*'
./Cego.xsi: In function 'void XS_DBD__Cego__db_disconnect(CV*)':
./Cego.xsi:304: error: invalid conversion from 'const char*' to 'char*'
./Cego.xsi: In function 'void XS_DBD__Cego__st_fetchall_arrayref(CV*)':
./Cego.xsi:658: warning: deprecated conversion from string constant to 'char*'
*** [Cego.o] Error code 1
Stop in /usr/ports/databases/p5-DBD-cego/work/DBD-cego-1.2.0.
*** [do-build] Error code 1
Stop in /usr/ports/databases/p5-DBD-cego.
fa9# exit
Script done on Fri Mar 29 15:11:08 2013
--------------
And here is a diff against Driver.xst so that it works:
--------------
--- Driver.xst 2013-03-29 14:48:52.000000000 +0100
+++ Driver.xst-working 2013-03-29 14:16:28.000000000 +0100
@@ -93,8 +93,8 @@
D_imp_dbh(dbh);
#if !defined(dbd_db_login6_sv)
STRLEN lna;
- char *u = (SvOK(username)) ? SvPV(username,lna) : "";
- char *p = (SvOK(password)) ? SvPV(password,lna) : "";
+ char *u = (SvOK(username)) ? SvPV(username,lna) : (char*)"";
+ char *p = (SvOK(password)) ? SvPV(password,lna) : (char*)"";
#endif
#ifdef dbd_db_login6_sv
ST(0) = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs) ? &PL_sv_yes : &PL_sv_no;
@@ -301,7 +301,7 @@
/* still exists. This possibly needs some more thought. */
if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) {
STRLEN lna;
- char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
+ char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : (char*)"s";
warn("%s->disconnect invalidates %d active statement handle%s %s",
SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural,
"(either destroy statement handles or call finish on them before disconnecting)");
--------------