Bug #99799 Please add `#include <string>` to i_s.cc
Description:
While I am aware MySQL 5.6 is now considered unsupported on macOS, the MacPorts package manager is trying to continue offering it if possible. I attempted updating their mysql56 package from 5.6.47 to 5.6.48, and found that the changes introduced by https://github.com/mysql/mysql-server/commit/0b0c30641fd66336e87394ac28587e40864f8af9 as part of the fix for #95125 lead to compilation failure. Although I have so far only observed this failure on macOS, I believe it may affect other platforms, potentially including supported ones.
Example failure:
[ 56%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/handler/i_s.cc.o
cd /opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/build/storage/innobase && /usr/bin/clang++ -DHAVE_CONFIG_H -DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1 -DHAVE_IB_GCC_ATOMIC_BUILTINS=1 -DHAVE_IB_GCC_ATOMIC_BUILTINS_64=1 -DHAVE_IB_GCC_ATOMIC_BUILTINS_BYTE=1 -DHAVE_IB_GCC_ATOMIC_TEST_AND_SET=1 -DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1 -DHAVE_IB_GCC_SYNC_SYNCHRONISE=1 -DHAVE_LIBEVENT2 -DHAVE_TLSv13 -DSIZEOF_PTHREAD_T=8 -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/build/include -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/include -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/include -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/sql -I/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/regex -I/opt/local/include -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-tautological-pointer-compare -Wno-ignored-qualifiers -Wno-null-conversion -Wno-unused-private-field -DNDEBUG -DDBUG_OFF -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o CMakeFiles/innobase.dir/handler/i_s.cc.o -c /opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler/i_s.cc
[…]
/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler/i_s.cc:3018:14: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
std::string fts_table_name(fts_internal_tbl_name);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
class _LIBCPP_TEMPLATE_VIS basic_string;
^
/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler/i_s.cc:3451:14: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
std::string fts_table_name(fts_internal_tbl_name);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
class _LIBCPP_TEMPLATE_VIS basic_string;
^
/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler/i_s.cc:3912:14: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
std::string fts_table_name(fts_internal_tbl_name);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
class _LIBCPP_TEMPLATE_VIS basic_string;
^
/opt/local/var/macports/build/_Users_runner_runners_2.169.1_work_1_s_databases_mysql56/mysql56/work/mysql-5.6.48/storage/innobase/handler/i_s.cc:4082:14: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
std::string fts_table_name(fts_internal_tbl_name);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
class _LIBCPP_TEMPLATE_VIS basic_string;
^
[…]
4 errors generated.
make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/handler/i_s.cc.o] Error 1
How to repeat:
Attempt to build MySQL 5.6.48 using any of the following:
macOS 10.14, Xcode 10.3 and 11.3.1
macOS 10.13, Xcode 9.4.1
macOS 10.12, Xcode 8.3.3
macOS 10.11, Xcode 7.3.1
Suggested fix:
Adding
#include <string>
to storage/innobase/handler/i_s.cc allows MySQL 5.6.48 to build on macOS. From looking online, some recommended explicitly including this to ensure portability whenever std::string is used.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.043 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.