Bug #109076 COMPILATION FAILURE IN 5.7 SERVER WITH GCC 7.5.0

Submitted: 14 Nov 2022 11:35 Modified: 15 Nov 2022 6:52
Reporter: Varun Nagaraju (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.40 OS:Linux
Assigned to: CPU Architecture:x86

[14 Nov 2022 11:35] Varun Nagaraju
Description:
When MySQL 5.7.40 source is compiled on Ubuntu 22.04 with gcc version 7.5.0, the build fails with the following compilation error.

/home/varun/xtrabackup-2.4/varun-xtrabackup/sql/sql_connect.cc: In function ‘int check_connection(THD*)’:
/home/varun/xtrabackup-2.4/varun-xtrabackup/sql/sql_connect.cc:518:5: error: ‘mysql_thread_set_peer_port’ was not declared in this scope
     mysql_thread_set_peer_port(thd->peer_port);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/varun/xtrabackup-2.4/varun-xtrabackup/sql/sql_connect.cc:518:5: note: suggested alternative: ‘mysql_thread_set_psi_THD’
     mysql_thread_set_peer_port(thd->peer_port);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
     mysql_thread_set_psi_THD

The change was as part of WL#14611 BACKPORT SHOW PROCESSLIST TO 5.7. The definition of mysql_thread_set_peer_port() is only compiled when HAVE_PSI_THREAD_INTERFACE is defined where as it is called without the check. 

How to repeat:
Compile MySQL 5.7.40 with gcc 7.5.0

Suggested fix:
It can be fixed in two ways:

* The definition of the method should be moved outside the #ifdef check block in mysql_thread.h to have the method always defined but the contents compiled only if HAVE_PSI_THREAD_INTERFACE is set.

* Enclose the method call with the ifdef HAVE_PSI_THREAD_INTERFACE check.
[15 Nov 2022 6:52] MySQL Verification Team
Hello Varun,

Thank you for the report and feedback.

regards,
Umesh
[18 Nov 2022 8:42] Varun Nagaraju
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Attachment: 0001-Bug-109076-COMPILATION-FAILURE-IN-5.7-SERVER-WITH-GC.patch (text/x-patch), 1.46 KiB.

[6 Apr 2023 13:15] Varun Nagaraju
Uploading the patch via contribution

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

Contribution: 0001-Bug-109076-COMPILATION-FAILURE-IN-5.7-SERVER-WITH-GC.patch (text/x-patch), 1.46 KiB.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.072 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.