Bug #102308 | Compilation error for Boolean literal in sql/mysqld.cc with MySQL 8.0.23 | ||
---|---|---|---|
Submitted: | 20 Jan 2021 7:41 | Modified: | 22 Jan 2021 19:05 |
Reporter: | Georgi Sotirov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
Version: | 8.0.23 | OS: | Linux (Slackware) |
Assigned to: | CPU Architecture: | x86 |
[20 Jan 2021 7:41]
Georgi Sotirov
[21 Jan 2021 8:38]
Tor Didriksen
Posted by developer: We removed my_bool and TRUE/FALSE almost four years ago: commit f870e0fd12ed906569c8dcabd9da23c1a1fc6d7f Author: Steinar H. Gunderson <steinar.gunderson@oracle.com> Date: Fri Feb 24 13:47:08 2017 +0100 Bug #25597667: REMOVE MY_BOOL Replace TRUE with true and FALSE with false, with some notable exceptions: - In SQL, where we keep talking about TRUE and FALSE. - In comments that talk about SQL. - In string literals, especially in the parser and such. - In InnoDB, which has its own �<80><9C>ibool�<80><9D> type and TRUE/FALSE definitions. - In NDB, which get their own TRUE and FALSE definitions in ndb_global.h. But evidently, some TRUE/FALSE instances have managed to creep in after that. The build didn't break, since there are plenty of Unix system headers which do: #undef TRUE #define TRUE 1 #undef FALSE #define FALSE 0
[21 Jan 2021 8:53]
Tor Didriksen
Posted by developer: It seems mysqld.cc got the definition of TRUE from extra/icu/source/common/unicode/umachine.h uncommenting the defines there, I get sql/mysqld.cc:7093:32: error: ‘TRUE’ was not declared in this scope 7093 | my_getopt_skip_unknown = TRUE; our bundled ICU sources are at version 65 However, recent ICU versions no longer define TRUE and FALSE, so -DWITH_ICU=system will break the build. Apparently there is an -DU_DEFINE_FALSE_AND_TRUE=1 you can add to CMAKE_CXX_FLAGS to unbreak the build.
[21 Jan 2021 9:12]
Georgi Sotirov
Thanks for the detailed explanation Tor. The ICU version on the system I am building is 68.2, but although I presumed TRUE/FALSE could have come from some header I did not suspect ICU at all. Anyway, do not you think that it is better to fix MySQL's source sql/mysqld.cc, instead of relying on headers from external libraries and -D flags to provide TRUE/FALSE macros? As I wrote in the description in sql/mysqld.cc there are other occasions where my_getopt_skip_unknown is properly set with true or false, so it only remains to fix the problematic line. The simple patch I gave in "Suggested fix" solved the problem for me and IMHO is the right solution.
[21 Jan 2021 9:22]
Tor Didriksen
Yes, of course mysql source should be fixed. A patch will show up in 8.0.24 I was just showing some workarounds for you.
[21 Jan 2021 12:36]
Georgi Sotirov
Ah, OK. Thanks again Tor.
[22 Jan 2021 19:05]
Paul DuBois
Posted by developer: Fixed in 8.0.24. Use of the symbol TRUE in the source resulted in a build failure on some platforms. This was replaced by true.