Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile failed on 5.001 on undeclared MYSQL_OPT_GET_SERVER_PUBLIC_KEY #361

Closed
thockar opened this issue Oct 4, 2023 · 9 comments · Fixed by #366
Closed

compile failed on 5.001 on undeclared MYSQL_OPT_GET_SERVER_PUBLIC_KEY #361

thockar opened this issue Oct 4, 2023 · 9 comments · Fixed by #366
Assignees
Milestone

Comments

@thockar
Copy link

thockar commented Oct 4, 2023

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!

@bschmalhofer
Copy link

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 .

@mtelka
Copy link

mtelka commented Oct 5, 2023

Same issue here with OpenIndiana and MariaDB 10.6.

@dveeden
Copy link
Collaborator

dveeden commented Oct 5, 2023

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 dveeden self-assigned this Oct 5, 2023
@dveeden dveeden added this to the 5.002 milestone Oct 5, 2023
@mtelka
Copy link

mtelka commented Oct 5, 2023

@dveeden, does it mean that DBD::mysql won't compile/work with MariaDB?

@dveeden
Copy link
Collaborator

dveeden commented Oct 5, 2023

@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.

@mtelka
Copy link

mtelka commented Oct 5, 2023

I see. Thanks for explanation.

@bschmalhofer
Copy link

@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.

@karenetheridge
Copy link

or, you could use https://metacpan.org/release/DVEEDEN/DBD-mysql-4.051

@dveeden
Copy link
Collaborator

dveeden commented Oct 6, 2023

@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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants