-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
-
Code not compliant with C++17 standard.
This is the error that stops the build:
/usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -march=skylake -O2 -pipe -felide-constructors -fno-strict-aliasing -Wall -Wextra -Wformat-security -Wvla -Wimplicit-fallthrough=2 -Woverloaded-virtual -Wno-unused-parameter -DNDEBUG -DDBUG_OFF -fPIC -Wl,-O1 -Wl, --sort-common -Wl, --as-needed -shared -o udf_example.so CMakeFiles/ udf_example.dir/udf_example.cc.o \-lpthread ../archive_output_directory/libmysqlservices.a -lpthread
In file included from /var/tmp/portage/dev-db/mysql-5.7.26/work/mysql/storage/innobase/buf/buf0checksum.cc:26:
/var/tmp/portage/dev-db/mysql-5.7.26/work/mysql/storage/innobase/include/univ.i:410:33: error: unnamed scoped enum is not allowed
410 | #define byte unsigned char
^~~~~~~~
/var/tmp/portage/dev-db/mysql-5.7.26/work/mysql/storage/innobase/include/univ.i:410:33: error: expected identifier before ‘unsigned’}}
It looks like tweaking the gcc flags might solve the problem. I haven't researched to find out what, but I've seen other packages that fail to build with -std=c++17, which is standard for the gcc-11.* we're using.
In fact, I found a bug report on Gentoo with this same error, but with myslq-8.0.24 and their solution was in fact to force std=c++14.
I did a little test with the following code, using the same macro that apparently triggers the error:
#define byte unsigned char #include <iostream> int main(int argc, char **argv) { byte test='b'; std::cout << test; }
...which will trigger the same error as mysql when I compile with -std=c++17 and above, but not with -c++14 and below.