Bug #113662 NDB compilation error on macOS Release build
Submitted: 17 Jan 10:50 Modified: 8 May 13:07
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified 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 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 5:09] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feedback!

regards,
Umesh
[8 May 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)