Bug #110658 mysql_binlog_xxx() symbols are not exported in lybmysqlclient.so
Submitted: 11 Apr 2023 16:37 Modified: 28 Apr 2023 22:32
Reporter: Yura Sorokin (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any

[11 Apr 2023 16:37] Yura Sorokin
Description:
Official C API Binary Log Interface documentation
https://dev.mysql.com/doc/c-api/8.0/en/c-api-binary-log-interface-usage.html
refers to the following three functions that can be used by developers who would like to access remote Binary Logs:
* mysql_binlog_open()
* mysql_binlog_fetch()
* mysql_binlog_close()

Moreover, they are declared in the <mysql/mysql.h> header file.

Unfortunately, these symbols are not available (not exported) in the "libmysqlclient.so" shared library which leads to "unresolved symbol" linker errors even when "-lmysqlclient" is specified.

How to repeat:
nm libmysqlclient.so | grep binlog
0000000000053307 t mysql_binlog_close
0000000000053166 t mysql_binlog_fetch
0000000000052b76 t mysql_binlog_open

Lowercase letter "t" indicates that the symbol is local (not exported).

At the same time, all the other functions are marked with "T", meaning global (external).
nm -D --defined-only --without-symbol-versions libmysqlclient.so | grep connect
000000000004ea27 T mysql_real_connect
0000000000039d7d T mysql_real_connect_dns_srv
000000000004ec6a T mysql_real_connect_nonblocking
000000000005974a T mysql_reset_connection

Suggested fix:
Add
* mysql_binlog_open
* mysql_binlog_fetch
* mysql_binlog_close
to the list of the exported libmysqlclient.so functions.
[11 Apr 2023 16:44] Yura Sorokin
A patch for the libmysqlclient CMakeLists.txt

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug110658_mysql_binlog_xxx.diff (application/octet-stream, text), 437 bytes.

[12 Apr 2023 7:33] MySQL Verification Team
Hello Yura Sorokin,

Thank you for the report and contribution.

regards,
Umesh
[28 Apr 2023 22:32] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL 8.0.34 and MySQL 8.1.0 releases, and here's the proposed changelog entry from the documentation team:

Several functions now are added to the libmysqlclient.so shared library
that enable developers to access a MySQL server binary log:
mysql_binlog_open(), mysql_binlog_fetch(), and mysql_binlog_close(). 

Our thanks to Yura Sorokin for the contribution.

Thank you for the bug report.