Bug #104126 compile failure
Submitted: 28 Jun 2021 6:25 Modified: 1 Jul 2021 2:27
Reporter: xu chunming Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:MySQL5.7.32 OS:Mac OS X (11.2.3)
Assigned to: CPU Architecture:x86
Tags: Compile failure on macOS Big Sur

[28 Jun 2021 6:25] xu chunming
Description:

When execute make -j 8 VERBOSE=1, the error is reported as follows :

[ 40%] Linking CXX static library ../../archive_output_directory/libinnobase.a
cd /Users/tom/Desktop/src/mysql-5.7.32/bld/storage/innobase && /usr/local/Cellar/cmake/3.20.4/bin/cmake -P CMakeFiles/innobase.dir/cmake_clean_target.cmake
cd /Users/tom/Desktop/src/mysql-5.7.32/bld/storage/innobase && /usr/local/Cellar/cmake/3.20.4/bin/cmake -E cmake_link_script CMakeFiles/innobase.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/ar qc ../../archive_output_directory/libinnobase.a CMakeFiles/innobase.dir/api/api0api.cc.o CMakeFiles/innobase.dir/api/api0misc.cc.o CMakeFiles/innobase.dir/btr/btr0btr.cc.o CMakeFiles/innobase.dir/btr/btr0cur.cc.o CMakeFiles/innobase.dir/btr/btr0pcur.cc.o CMakeFiles/innobase.dir/btr/btr0sea.cc.o CMakeFiles/innobase.dir/btr/btr0bulk.cc.o CMakeFiles/innobase.dir/buf/buf0block_hint.cc.o CMakeFiles/innobase.dir/buf/buf0buddy.cc.o CMakeFiles/innobase.dir/buf/buf0buf.cc.o CMakeFiles/innobase.dir/buf/buf0dblwr.cc.o CMakeFiles/innobase.dir/buf/buf0checksum.cc.o CMakeFiles/innobase.dir/buf/buf0dump.cc.o CMakeFiles/innobase.dir/buf/buf0flu.cc.o CMakeFiles/innobase.dir/buf/buf0lru.cc.o CMakeFiles/innobase.dir/buf/buf0rea.cc.o CMakeFiles/innobase.dir/data/data0data.cc.o CMakeFiles/innobase.dir/data/data0type.cc.o CMakeFiles/innobase.dir/dict/dict0boot.cc.o CMakeFiles/innobase.dir/dict/dict0crea.cc.o CMakeFiles/innobase.dir/dict/dict0dict.cc.o CMakeFiles/innobase.dir/dict/dict0load.cc.o CMakeFiles/innobase.dir/dict/dict0mem.cc.o CMakeFiles/innobase.dir/dict/dict0stats.cc.o CMakeFiles/innobase.dir/dict/dict0stats_bg.cc.o CMakeFiles/innobase.dir/eval/eval0eval.cc.o CMakeFiles/innobase.dir/eval/eval0proc.cc.o CMakeFiles/innobase.dir/fil/fil0fil.cc.o CMakeFiles/innobase.dir/fsp/fsp0fsp.cc.o CMakeFiles/innobase.dir/fsp/fsp0file.cc.o CMakeFiles/innobase.dir/fsp/fsp0space.cc.o CMakeFiles/innobase.dir/fsp/fsp0sysspace.cc.o CMakeFiles/innobase.dir/fut/fut0fut.cc.o CMakeFiles/innobase.dir/fut/fut0lst.cc.o CMakeFiles/innobase.dir/ha/ha0ha.cc.o CMakeFiles/innobase.dir/ha/ha0storage.cc.o CMakeFiles/innobase.dir/ha/hash0hash.cc.o CMakeFiles/innobase.dir/fts/fts0fts.cc.o CMakeFiles/innobase.dir/fts/fts0ast.cc.o CMakeFiles/innobase.dir/fts/fts0blex.cc.o CMakeFiles/innobase.dir/fts/fts0config.cc.o CMakeFiles/innobase.dir/fts/fts0opt.cc.o CMakeFiles/innobase.dir/fts/fts0pars.cc.o CMakeFiles/innobase.dir/fts/fts0que.cc.o CMakeFiles/innobase.dir/fts/fts0sql.cc.o CMakeFiles/innobase.dir/fts/fts0tlex.cc.o CMakeFiles/innobase.dir/gis/gis0geo.cc.o CMakeFiles/innobase.dir/gis/gis0rtree.cc.o CMakeFiles/innobase.dir/gis/gis0sea.cc.o CMakeFiles/innobase.dir/fts/fts0plugin.cc.o CMakeFiles/innobase.dir/handler/ha_innodb.cc.o CMakeFiles/innobase.dir/handler/ha_innopart.cc.o CMakeFiles/innobase.dir/handler/handler0alter.cc.o CMakeFiles/innobase.dir/handler/i_s.cc.o CMakeFiles/innobase.dir/ibuf/ibuf0ibuf.cc.o CMakeFiles/innobase.dir/lock/lock0iter.cc.o CMakeFiles/innobase.dir/lock/lock0prdt.cc.o CMakeFiles/innobase.dir/lock/lock0lock.cc.o CMakeFiles/innobase.dir/lock/lock0wait.cc.o CMakeFiles/innobase.dir/log/log0log.cc.o CMakeFiles/innobase.dir/log/log0recv.cc.o CMakeFiles/innobase.dir/mach/mach0data.cc.o CMakeFiles/innobase.dir/mem/mem0mem.cc.o CMakeFiles/innobase.dir/mtr/mtr0log.cc.o CMakeFiles/innobase.dir/mtr/mtr0mtr.cc.o CMakeFiles/innobase.dir/os/os0file.cc.o CMakeFiles/innobase.dir/os/os0proc.cc.o CMakeFiles/innobase.dir/os/os0event.cc.o CMakeFiles/innobase.dir/os/os0thread.cc.o CMakeFiles/innobase.dir/page/page0cur.cc.o CMakeFiles/innobase.dir/page/page0page.cc.o CMakeFiles/innobase.dir/page/page0zip.cc.o CMakeFiles/innobase.dir/pars/lexyy.cc.o CMakeFiles/innobase.dir/pars/pars0grm.cc.o CMakeFiles/innobase.dir/pars/pars0opt.cc.o CMakeFiles/innobase.dir/pars/pars0pars.cc.o CMakeFiles/innobase.dir/pars/pars0sym.cc.o CMakeFiles/innobase.dir/que/que0que.cc.o CMakeFiles/innobase.dir/read/read0read.cc.o CMakeFiles/innobase.dir/rem/rem0cmp.cc.o CMakeFiles/innobase.dir/rem/rem0rec.cc.o CMakeFiles/innobase.dir/row/row0ext.cc.o CMakeFiles/innobase.dir/row/row0ftsort.cc.o CMakeFiles/innobase.dir/row/row0import.cc.o CMakeFiles/innobase.dir/row/row0ins.cc.o CMakeFiles/innobase.dir/row/row0merge.cc.o CMakeFiles/innobase.dir/row/row0mysql.cc.o CMakeFiles/innobase.dir/row/row0log.cc.o CMakeFiles/innobase.dir/row/row0purge.cc.o CMakeFiles/innobase.dir/row/row0row.cc.o CMakeFiles/innobase.dir/row/row0sel.cc.o CMakeFiles/innobase.dir/row/row0trunc.cc.o CMakeFiles/innobase.dir/row/row0uins.cc.o CMakeFiles/innobase.dir/row/row0umod.cc.o CMakeFiles/innobase.dir/row/row0undo.cc.o CMakeFiles/innobase.dir/row/row0upd.cc.o CMakeFiles/innobase.dir/row/row0quiesce.cc.o CMakeFiles/innobase.dir/row/row0vers.cc.o CMakeFiles/innobase.dir/srv/srv0conc.cc.o CMakeFiles/innobase.dir/srv/srv0mon.cc.o CMakeFiles/innobase.dir/srv/srv0srv.cc.o CMakeFiles/innobase.dir/srv/srv0start.cc.o CMakeFiles/innobase.dir/sync/sync0arr.cc.o CMakeFiles/innobase.dir/sync/sync0rw.cc.o CMakeFiles/innobase.dir/sync/sync0debug.cc.o CMakeFiles/innobase.dir/sync/sync0sync.cc.o CMakeFiles/innobase.dir/trx/trx0i_s.cc.o CMakeFiles/innobase.dir/trx/trx0purge.cc.o CMakeFiles/innobase.dir/trx/trx0rec.cc.o CMakeFiles/innobase.dir/trx/trx0roll.cc.o CMakeFiles/innobase.dir/trx/trx0rseg.cc.o CMakeFiles/innobase.dir/trx/trx0sys.cc.o CMakeFiles/innobase.dir/trx/trx0trx.cc.o CMakeFiles/innobase.dir/trx/trx0undo.cc.o CMakeFiles/innobase.dir/usr/usr0sess.cc.o CMakeFiles/innobase.dir/ut/ut0byte.cc.o CMakeFiles/innobase.dir/ut/ut0crc32.cc.o CMakeFiles/innobase.dir/ut/ut0dbg.cc.o CMakeFiles/innobase.dir/ut/ut0list.cc.o CMakeFiles/innobase.dir/ut/ut0mem.cc.o CMakeFiles/innobase.dir/ut/ut0new.cc.o CMakeFiles/innobase.dir/ut/ut0rbt.cc.o CMakeFiles/innobase.dir/ut/ut0rnd.cc.o CMakeFiles/innobase.dir/ut/ut0ut.cc.o CMakeFiles/innobase.dir/ut/ut0vec.cc.o CMakeFiles/innobase.dir/ut/ut0wqueue.cc.o
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../archive_output_directory/libinnobase.a(fut0fut.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../archive_output_directory/libinnobase.a(ut0byte.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib ../../archive_output_directory/libinnobase.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../archive_output_directory/libinnobase.a(fut0fut.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../archive_output_directory/libinnobase.a(ut0byte.cc.o) has no symbols
cd /Users/tom/Desktop/src/mysql-5.7.32/bld/storage/innobase && /usr/local/Cellar/cmake/3.20.4/bin/cmake -DTARGET_NAME=innobase -DTARGET_LOC=/Users/tom/Desktop/src/mysql-5.7.32/bld/archive_output_directory/libinnobase.a -DCFG_INTDIR=. -P /Users/tom/Desktop/src/mysql-5.7.32/bld/archive_output_directory/lib_location_innobase.cmake
[ 40%] Built target innobase
make: *** [all] Error 2

The error message is not clear.Execute ls -lptrh ../../archive_output_directory/libinnobase.a, the results are as follows:
-rw-r--r--  1 tom  staff    76M  6 25 11:35 ../../archive_output_directory/libinnobase.a

How to repeat:
Operating system version is macOS 11.2.3. Cmake version is 3.20.4.
MySQL version is 5.7.32.
Follow the source code compilation steps in the reference manual:
shell> cd mysql-5.7.32
shell> mkdir bld
shell> cd bld
shell> cmake ..
[29 Jun 2021 2:51] xu chunming
This problem has been resolved.
[30 Jun 2021 23:22] MySQL Verification Team
Log of cmake process

Attachment: cmake-log-bug104126.txt (text/plain), 33.95 KiB.

[30 Jun 2021 23:33] MySQL Verification Team
Log partial of make

Attachment: make-bug104126-txt (application/octet-stream, text), 2.42 MiB.

[30 Jun 2021 23:39] MySQL Verification Team
Thank you for the bug report. I could not repeat with 5.7.34 source ( see attached logs of cmake and make ):

rc/sql_service/sql_service_context.cc.o CMakeFiles/group_replication.dir/src/sql_service/sql_service_context_base.cc.o CMakeFiles/group_replication.dir/src/sql_service/sql_service_interface.cc.o CMakeFiles/group_replication.dir/src/sql_service/sql_command_test.cc.o CMakeFiles/group_replication.dir/src/sql_service/sql_service_command.cc.o  ../../../archive_output_directory/libmysqlservices.a -Wl,-bundle_loader,/Users/miguel/bugcompilation/mysql-5.7.34/sql/mysqld ../../../archive_output_directory/liblz4_lib.a /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a ../../../archive_output_directory/liblz4_lib.a /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a 
[100%] Built target group_replication
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/miguel/bugcompilation/mysql-5.7.34/CMakeFiles 0

miguel:mysql-5.7.34 miguel$ sql/mysqld --version
sql/mysqld  Ver 5.7.34 for osx10.15 on x86_64 (Source distribution)
miguel:mysql-5.7.34 miguel$
[1 Jul 2021 2:27] xu chunming
The reason why the problem cannot be reproduced should be related to the system version osx11.2.3.

The error after the compile command is changed to make VERBOSE=1 is as follows :
In file included from /Users/tom/Desktop/src/test/mysql-5.7.32/storage/perfschema/cursor_by_account.cc:28:
In file included from /Users/tom/Desktop/src/test/mysql-5.7.32/include/my_global.h:654:
In file included from /Users/tom/Desktop/src/test/mysql-5.7.32/include/my_dbug.h:233:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/sstream:173:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ostream:140:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/locale:189:
/Users/tom/Desktop/src/test/mysql-5.7.32/version:1:1: error: expected unqualified-id
MYSQL_VERSION_MAJOR=5
^

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [storage/perfschema/CMakeFiles/perfschema.dir/cursor_by_account.cc.o] Error 1
make[1]: *** [storage/perfschema/CMakeFiles/perfschema.dir/all] Error 2
make: *** [all] Error 2

/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/locale:189 ,the code is #include <version>.  At the same time, there is a VERSION file in the compilation root directory . It looks like the file has the same name. So, I renamed the file VERSION to VERSION_BAK, and modified the mysql_version.cmake file, changed several VERSION in the file to VERSION_BAK, and then recompiled with make to be normal.
[22 Nov 2021 14:42] Rahul Sisondia
I see the same error even with latest 5.7.36 build.

I tried it on mac using ninja as following.

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=debug ../src -DWITH_SSL=system -DWITH_CURL=system -DWITH_BOOST=/Volumes/Neo/work/sw/boost_1_59_0 && ninja
[22 Nov 2021 14:44] Rahul Sisondia
In continuation to my previous message. 
Here are the error logs. 

In file included from /Users/rsisondi/work/mysql-57/src/storage/perfschema/pfs_account.cc:28:
In file included from /Users/rsisondi/work/mysql-57/src/include/my_global.h:654:
In file included from /Users/rsisondi/work/mysql-57/src/include/my_dbug.h:231:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/sstream:173:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ostream:140:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/locale:189:
/Users/rsisondi/work/mysql-57/src/version:1:1: error: expected unqualified-id
MYSQL_VERSION_MAJOR=5
^
include/my_config.h:404:29: note: expanded from macro 'MYSQL_VERSION_MAJOR'
#define MYSQL_VERSION_MAJOR 5
                            ^
In file included from /Users/rsisondi/work/mysql-57/src/storage/perfschema/pfs_account.cc:28:
In file included from /Users/rsisondi/work/mysql-57/src/include/my_global.h:654:
In file included from /Users/rsisondi/work/mysql-57/src/include/my_dbug.h:231:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/sstream:173:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ostream:140:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/locale:197:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/nl_types.h:92:4: error: C++ requires a type specifier for all declarations
} *nl_catd;
[23 Nov 2021 8:48] Rahul Sisondia
Workaround proposed by Xu chunming works. But appreciate if mysql team could fix the problem.