compile failed on 5.001 on undeclared MYSQL_OPT_GET_SERVER_PUBLIC_KEY
Closed this issue ยท 9 comments
the check for
#ifdef MYSQL_OPT_GET_SERVER_PUBLIC_KEY
...
#endif
is removed in dbdimp.c (from 4.0.51)
which causes an compile error using mysqllib 50716
c:\perl\cpan\build\DBD-mysql-5.001>gmake
cp lib/DBD/mysql/INSTALL.pod blib\lib\DBD\mysql\INSTALL.pod
cp lib/DBD/mysql/GetInfo.pm blib\lib\DBD\mysql\GetInfo.pm
cp lib/DBD/mysql.pm blib\lib\DBD\mysql.pm
cp lib/Bundle/DBD/mysql.pm blib\lib\Bundle\DBD\mysql.pm
Running Mkbootstrap for mysql ()
"C:\perl\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "mysql.bs"
"C:\perl\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- mysql.bs blib\arch\auto\DBD\mysql\mysql.bs 644
gcc -c -IC:\perl\perl\vendor\lib\auto\DBI -Ic:\perl\c\bin..\include\mysql50716 -g -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -Os -DVERSION="5.001" -DXS_VERSION="5.001" "-IC:\perl\perl\lib\CORE" dbdimp.c
dbdimp.c: In function 'mysql_dr_connect':
dbdimp.c:1407:31: error: 'MYSQL_OPT_GET_SERVER_PUBLIC_KEY' undeclared (first use in this function); did you mean 'MYSQL_SERVER_PUBLIC_KEY'?
mysql_options(sock, MYSQL_OPT_GET_SERVER_PUBLIC_KEY, &server_get_pubkey);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MYSQL_SERVER_PUBLIC_KEY
dbdimp.c:1407:31: note: each undeclared identifier is reported only once for each function it appears in
....
changing the dbdimp.c to
**#ifdef MYSQL_OPT_GET_SERVER_PUBLIC_KEY**
if ((svp = hv_fetch(hv, "mysql_get_server_pubkey", 23, FALSE)) && *svp && SvTRUE(*svp)) {
bool server_get_pubkey = 1;
mysql_options(sock, MYSQL_OPT_GET_SERVER_PUBLIC_KEY, &server_get_pubkey);
}
**#endif**
solves the problem
I know: "..... always use the latest mysql version .....",
but this is not quickly possible on every system (e.g. Windows + Strawberry Perl 5.38)
It would be nice, if the two lines can come back in the next version
Thank you!
I see the same error running under Debain with the package mysql-default-client installed, https://packages.debian.org/bookworm/default-mysql-client . The default mysql client is actually the MariaDB client.
See also RotherOSS/otobo#2548 .
Same issue here with OpenIndiana and MariaDB 10.6.
The issue here is that DBD::mysql v5.x requires MySQL 8.x client libraries for building.
I plan to do a PR to make it fail earlier and with a clear message when compiling with MariaDB or MySQL 5.x libraries.
@dveeden, does it mean that DBD::mysql won't compile/work with MariaDB?
This only means that DBD::mysql will need MySQL 8.x to build.
Then DBD::mysql can connect to MySQL 8.x, MySQL 5.7, MySQL 5.6, MariaDB or anything else that speaks the MySQL protocol.
If you want to build against MariaDB, then I would suggest using DBD::MariaDB.
This is done to remove complexity to make it easier to maintain and test.
I see. Thanks for explanation.
@dveeden, I do get the point about making DBD::mysql easier to maintain. But it is confusing. I use DBD::mysql on Debian based Docker images where the package default-mysql-client is installed. It is not intuitive, at least to me, that DBD::mysql can't be installed in that environment.
But of course it is your call, and I can install the mysql 8 packages if that is the design decision.
or, you could use https://metacpan.org/release/DVEEDEN/DBD-mysql-4.051
@dveeden, I do get the point about making DBD::mysql easier to maintain. But it is confusing. I use DBD::mysql on Debian based Docker images where the package default-mysql-client is installed. It is not intuitive, at least to me, that DBD::mysql can't be installed in that environment.
But of course it is your call, and I can install the mysql 8 packages if that is the design decision.
I agree that this is confusing. But the truth is that MySQL and MariaDB are not the same. Both are fine databases but each have added many new features that are not fully compatible. When MariaDB forked from MySQL it was a drop in replacement, but that's no longer the case. And that is what Linux distros e.d. have to adjust to.
There are multiple options:
- Use
libdbd-mysql-perl
from Debian (v4.050 + Debian patches) - Use DBD::mysql v4.051 as @karenetheridge suggested. Note that v4 is only getting critical updates.
- Add the APT repo for Oracle MySQL (https://dev.mysql.com/downloads/repo/apt/ but be aware of https://bugs.mysql.com/bug.php?id=111398 )
- Use Debian SID with
libmysqlclient-dev
(see https://packages.debian.org/sid/libmysqlclient-dev ) - Use a tarball install of MySQL 8.x