Bug #113662 NDB compilation error on macOS Release build

Submitted: 17 Jan 2024 10:50 Modified: 18 Jul 2024 22:18
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.36 OS:MacOS (14.2.1)
Assigned to: CPU Architecture:ARM

[17 Jan 2024 10:50] Laurynas Biveinis
Description:
/Users/laurynas/vilniusdb/mysql-8.0.36/storage/ndb/src/common/transporter/TransporterRegistry.cpp:203:9: error: unused variable 'trp_id' [-Werror,-Wunused-variable]
  TrpId trp_id = t->getTransporterIndex();
        ^

This seems to be specific for intersection of macOS and Release configurations, because the method in question looks as follows. macOS does not have epoll_create.

...
{
  TrpId trp_id = t->getTransporterIndex();
  assert(m_transporters.get(trp_id));

#if defined(HAVE_EPOLL_CREATE)
   // Use trp_id here
#endif
  return true;
}

The fact that NDB is built in the first place is bug 113661.

How to repeat:
On macOS:
-DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Release -DMYSQL_MAINTAINER_MODE=ON

Suggested fix:
A workaround is -DCMAKE_CXX_FLAGS="-Wno-error=unused-variable" -DCMAKE_CXX_FLAGS_DEBUG="-Wno-error=unused-variable -g" -DCMAKE_CXX_FLAGS_RELEASE="-Wno-error=unused-variable -O2 -g -DNDEBUG"
[18 Jan 2024 5:09] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feedback!

regards,
Umesh
[8 May 2024 13:07] Laurynas Biveinis
Seems to be fixed by

4ba18a6ec53ac769a5e94cc9255cb35e76162fcd
Author:     Tor Didriksen <tor.didriksen@oracle.com>
AuthorDate: Mon Nov 6 12:43:09 2023 +0100
Commit:     Tor Didriksen <tor.didriksen@oracle.com>
CommitDate: Mon Feb 5 10:09:50 2024 +0100

Parent:     a8c38f2264c Bug#36108397 Upgrade to latest protobuf library
Merged:     8.0
Contained:  (no branch)
Follows:    mysql-8.0.35 (448)
Precedes:   mysql-cluster-8.0.37 (172)

Bug#35750394 Refactor Transporter interface to use TrpId over NodeId

Post-push fix:
Broken build for clang on windows: error: unused variable 'trp_id'

Change-Id: I9f637a53267280c90fbcb6266a17b3bb7f7650bf
(cherry picked from commit 950041975c5dea7fd55f4412b377b47038a35902)

1 file changed, 1 insertion(+), 1 deletion(-)
storage/ndb/src/common/transporter/TransporterRegistry.cpp | 2 +-

modified   storage/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -185,7 +185,7 @@ fallback:
 }
 
 bool TransporterReceiveData::epoll_add(Transporter *t [[maybe_unused]]) {
-  TrpId trp_id = t->getTransporterIndex();
+  TrpId trp_id [[maybe_unused]] = t->getTransporterIndex();
   assert(m_transporters.get(trp_id));
 
 #if defined(HAVE_EPOLL_CREATE)
[25 Jun 2024 14:45] Magnus BlÄudd
Posted by developer:
 
This compilation problem has been fixed in 8.0.37.

Warnings for unused variables are turned into compilation errors when compiling with MYSQL_MAINTAINER_MODE=1. To avoid this -DMYSQL_MAINTAINER_MODE=0 can be used to turn off these errors.
[18 Jul 2024 22:18] Jon Stephens
Documented fix as follows in the MySQL 8.0.37 and 8.4.0 changelogs:

    Warnings for unused variables are turned into compilation errors when
    compiling with -DMYSQL_MAINTAINER_MODE=1. To avoid this issue, use
    -DMYSQL_MAINTAINER_MODE=0 to disable such errors. 

Closed.

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

Page generated in 0.055 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.