Bug #90898 myisam doesn't compile
Submitted: 16 May 2018 23:40 Modified: 6 Jun 2018 18:21
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[16 May 2018 23:40] Mark Callaghan
Description:
MyISAM in 8.0.11 doesn't compile for me.

This is a problem for 8.0.11. This wasn't a problem for 8.0.3 but the code in question has been changed to use std::isnan. 

The errors I get are like:
/orig8011/storage/myisam/mi_key.cc: In function ‘uint _mi_make_key(MI_INFO*, uint, uchar*, const uchar*, my_off_t)’:
/orig8011/storage/myisam/mi_key.cc:144:13: error: ‘__builtin_isnan’ is not a member of ‘std’
         if (std::isnan(nr)) {
             ^
/orig8011/storage/myisam/mi_key.cc:144:13: note: suggested alternative:
<built-in>: note:   ‘__builtin_isnan’
/orig8011/storage/myisam/mi_key.cc:153:13: error: ‘__builtin_isnan’ is not a member of ‘std’
         if (std::isnan(nr)) {
             ^

How to repeat:
This worked ok at home with Ubuntu 16.04 and gcc 5.4.0

The error occurs at work with what claims to be gcc 5.x and I am still trying to find out from the toolchain team what version of gcc was used.

Suggested fix:
The fix was to add #include <cmath> to storage/myisam/{sp_key.cc,mi_key.cc}

I found suggestions for that via 
https://www.google.com/search?q=__builtin_isnan%E2%80%99+is+not+a+member+of+%E2%80%98std%E...
and
https://github.com/opencv/opencv/issues/10032
[17 May 2018 0:15] Mark Callaghan
this occurs with gcc 5.5.0
[17 May 2018 8:24] MySQL Verification Team
Hello Mark,

Thank you for the report and feedback.

Thanks,
Umesh
[17 May 2018 8:28] MySQL Verification Team
## GCC 5.5 and below cmake - make fails

cmake .. -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=STANDALONE -DWITH_NDBCLUSTER_STORAGE_ENGINE=0 -DCMAKE_INSTALL_PREFIX=/export/umesh/server/source/bugs/src_build/90898/8.0.11 -DWITH_BOOST=../boost

make
.
[ 37%] Building CXX object storage/myisam/CMakeFiles/myisam.dir/mi_key.cc.o
In file included from /export/umesh/server/source/bugs/src_build/90898/mysql-8.0.11/storage/myisam/mi_key.cc:25:0:
/export/umesh/server/source/bugs/src_build/90898/mysql-8.0.11/storage/myisam/mi_key.cc: In function ‘uint _mi_make_key(MI_INFO*, uint, uchar*, const uchar*, my_off_t)’:
/export/umesh/server/source/bugs/src_build/90898/mysql-8.0.11/storage/myisam/mi_key.cc:144:18: error: expected unqualified-id before ‘(’ token
         if (std::isnan(nr)) {
                  ^
/export/umesh/server/source/bugs/src_build/90898/mysql-8.0.11/storage/myisam/mi_key.cc:153:18: error: expected unqualified-id before ‘(’ token
         if (std::isnan(nr)) {
                  ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-class-memaccess’
make[2]: *** [storage/myisam/CMakeFiles/myisam.dir/mi_key.cc.o] Error 1
make[1]: *** [storage/myisam/CMakeFiles/myisam.dir/all] Error 2
make: *** [all] Error 2

## gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) and above cmake - no issues and build completes

If possible please get us your exact cmake options.
[17 May 2018 8:28] MySQL Verification Team
8.0.11 - build on OL7 with gcc 5.5

Attachment: 90898.build_log (application/octet-stream, text), 26.71 KiB.

[17 May 2018 14:22] Mark Callaghan
Slightly edited to remove long paths.

cmake
-DCMAKE_VERBOSE_MAKEFILE=OFF
-DWITH_MYSQLD_LDFLAGS= -Wl,--whole-archive /.../lib/libjemalloc.a -Wl,--no-whole-archive 
/.../lib/libunwind.a
-DBUILD_CONFIG=mysql_release
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_INSTALL_PREFIX:PATH=/data/users/mcallaghan/orig8011
-DINSTALL_SBINDIR=libexec
-DINSTALL_LAYOUT=STANDALONE
-DINSTALL_SQLBENCHDIR=.
-DINSTALL_LIBDIR=lib64/mysql
-DINSTALL_SECURE_FILE_PRIVDIR=
-DCOMPILATION_COMMENT=8.0.11.not_packaged.mcallaghan
-DMYSQL_SERVER_SUFFIX=-fb
-DCURSES_LIBRARY=/.../lib/libncurses.a
-DCURSES_INCLUDE_PATH=/.../gcc-5-glibc-2.23/9bc6787/include
-DWITH_SSL=/.../gcc-5-glibc-2.23/9bc6787
-DWITH_ZLIB=/.../gcc-5-glibc-2.23/9bc6787
-DWITH_ZSTD=/.../gcc-5-glibc-2.23/03859b5
-DWITH_GLIBC=/.../gcc-5-glibc-2.23/ca1d1c0
-DWITH_JUNCTION=/.../gcc-5-glibc-2.23/00b189a
-DWITH_TURF=/.../gcc-5-glibc-2.23/9bc6787
-DCMAKE_PREFIX_PATH=/.../gcc-5-glibc-2.23/25e5116
-DMYSQL_DATADIR=/data/users/mcallaghan/orig8011/data
-DMYSQL_UNIX_ADDR=/data/users/mcallaghan/orig8011/var/mysql.sock
-DMYSQL_USER=mysql
-DEXTRA_CHARSETS=all
-DENABLE_DTRACE=0
-DENABLED_LOCAL_INFILE=1
-DWITH_FAST_MUTEXES=0
-DDEBUG_EXTNAME=0
-DENABLED_PROFILING=0
-DWITH_BOOST=/data/users/mcallaghan/mysql.me/orig8011/boost
-DMYSQL_MAINTAINER_MODE=0
/data/users/mcallaghan/mysql.me/orig8011
[17 May 2018 14:23] Mark Callaghan
From the tail of cmake output:

-- CONFIG_CLIENT_LIBS -lpthread -lz -lm -lrt -lssl -lcrypto -ldl
-- CONFIG_LIBS_PRIVATE -lpthread -lz -lm -lrt -lssl -lcrypto -ldl
-- INSTALL mysqlclient.pc lib64/pkgconfig
-- Skipping deb packaging on unsupported platform .
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H;RAPIDJSON_NO_SIZETYPEDEFINE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;_USE_MATH_DEFINES;HAVE_LIBEVENT1;UNISTR_FROM_STRING_EXPLICIT=explicit;UNISTR_FROM_CHAR_EXPLICIT=explicit

And then the next few are reformatted for readability...

MAKE_C_FLAGS:
-fPIC
-O3
-g
-pipe
-fexceptions
-fstack-protector
--param=ssp-buffer-size=4
-m64
-mtune=generic
-fno-builtin-malloc
-Wp,-D_FORTIFY_SOURCE=2
-D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE
-fno-strict-aliasing
-fwrapv
-fno-omit-frame-pointer
-momit-leaf-frame-pointer
-Wno-type-limits
-nostdinc
-specs=/tmp/tmp2n3G
-DHAVE_JEMALLOC
-DHAVE_READLINE_HISTORY_H
-DHAVE_TIRPC
-Wall
-Wextra
-Wformat-security
-Wvla
-Wundef
-Wmissing-format-attribute
-Wwrite-strings

CMAKE_CXX_FLAGS:
-fPIC
-O3
-g
-pipe
-fexceptions
-fstack-protector
--param=ssp-buffer-size=4
-m64
-mtune=generic
-fno-builtin-malloc
-Wp,-D_FORTIFY_SOURCE=2
-D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE
-fno-strict-aliasing
-fwrapv
-fno-omit-frame-pointer
-momit-leaf-frame-pointer
-Wno-type-limits
-nostdinc
-specs=/tmp/tmp2n3G
-DHAVE_JEMALLOC
-DHAVE_READLINE_HISTORY_H
-DHAVE_TIRPC
-Wall
-Wextra
-Wformat-security
-Wvla
-Wundef
-Wmissing-format-attribute
-Woverloaded-virtual
-Wno-missing-field-initializers
-Wlogical-op

CMAKE_C_LINK_FLAGS:
-fuse-ld=gold
-Wl,--gc-sections
-Wl,-rpath,'$ORIGIN/'

CMAKE_CXX_LINK_FLAGS:
-fuse-ld=gold
-Wl,--gc-sections
-Wl,-rpath,'$ORIGIN/'

CMAKE_C_FLAGS_RELWITHDEBINFO:
-O2
-ffunction-sections
-fdata-sections
-fPIC
-g
-fno-omit-frame-pointer
-DDBUG_OFF

CMAKE_CXX_FLAGS_RELWITHDEBINFO:
-O2
-ffunction-sections
-fdata-sections
-fPIC
-g
-fno-omit-frame-pointer
-std=c++11
-DDBUG_OFF
[6 Jun 2018 18:21] Paul DuBois
Posted by developer:
 
Fixed in 8.0.12.

Under some conditions, MyISAM code compilation failed due to a
missing include file.