Bug #89391 8.0.4RC Debug Compile Error
Submitted: 25 Jan 2018 1:16 Modified: 2 Feb 2018 11:57
Reporter: Roel Van de Paar Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:8.0.4rc OS:Any
Assigned to: CPU Architecture:Any

[25 Jan 2018 1:16] Roel Van de Paar
Description:
Scanning dependencies of target dbug
[ 22%] Building C object dbug/CMakeFiles/dbug.dir/dbug.c.o
[ 22%] Building CXX object dbug/CMakeFiles/dbug.dir/trace.cc.o
Linking CXX static library ../archive_output_directory/libdbug.a
[ 22%] Built target dbug
Scanning dependencies of target conf_to_src
[ 22%] Building CXX object strings/CMakeFiles/conf_to_src.dir/conf_to_src.cc.o
Linking CXX executable ../runtime_output_directory/conf_to_src
/usr/bin/ld.gold: warning: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-utf8.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(xml.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-simple.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-ucs2.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(dtoa.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(int2str.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(my_strtoll10.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(my_vsnprintf.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(str_alloc.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(strmake.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-bin.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-gb18030.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: warning: ../archive_output_directory/libstrings.a(ctype-latin1.cc.o): last entry in mergeable string section '.debug_str' not null terminated
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol malloc
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol malloc
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol realloc
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol free
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol stderr
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol stderr
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol stdout
/usr/bin/ld.gold: error: CMakeFiles/conf_to_src.dir/conf_to_src.cc.o: unsupported reloc 42 against global symbol stderr
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype.cc.o): unsupported reloc 42 against global symbol my_charset_utf8_general_ci
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-utf8.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-utf8.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-utf8.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(xml.cc.o): unsupported reloc 42 against global symbol my_str_malloc
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(xml.cc.o): unsupported reloc 42 against global symbol my_str_realloc
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(xml.cc.o): unsupported reloc 42 against global symbol my_str_free
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_uni_ctype
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_uni_ctype

How to repeat:
Centos 7.4.1708 x64, gcc 5.5, binutils 2.29.1 - not sure if it matters

git clone --recursive --depth=1 https://github.com/mysql/mysql-server.git -b 8.0 MS-8.0.4rc 
cp -R MS-8.0.4rc MS-8.0.4rc_dbg
cd MS-8.0.4rc_dbg
mkdir /tmp/boost1
cmake . -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=system -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DDEBUG_EXTNAME=OFF -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost1 -DENABLE_DTRACE=0 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_ZLIB=system
[25 Jan 2018 1:17] Roel Van de Paar
Rest of the log (bug did not allow insert)

/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-mb.cc.o): unsupported reloc 42 against global symbol my_uni_ctype
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-simple.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-simple.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_charset_utf8_general_ci
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_charset_utf8_general_ci
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v400
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v520
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v900
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol ja_han_pages
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol combining_marks
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol combining_marks
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol uni_dec
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol char_grp_infos
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol char_grp_infos
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol char_grp_infos
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol char_grp_infos
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v400
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v520
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_unicase_unicode520
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v400
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_unicase_default
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_uca_v400
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_unicase_default
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_charset_utf8_unicode_ci
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_unicase_default
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-uca.cc.o): unsupported reloc 42 against global symbol my_mb_wc_utf8mb4_thunk
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(int2str.cc.o): unsupported reloc 42 against global symbol _dig_vec_upper
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(int2str.cc.o): unsupported reloc 42 against global symbol _dig_vec_lower
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(my_vsnprintf.cc.o): unsupported reloc 42 against global symbol my_charset_latin1
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(my_vsnprintf.cc.o): unsupported reloc 42 against global symbol my_charset_latin1
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(my_vsnprintf.cc.o): unsupported reloc 42 against global symbol my_charset_latin1
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(my_vsnprintf.cc.o): unsupported reloc 42 against global symbol my_charset_latin1
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-bin.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-bin.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-gb18030.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: error: ../archive_output_directory/libstrings.a(ctype-gb18030.cc.o): unsupported reloc 42 against global symbol my_string_stack_guard
/usr/bin/ld.gold: internal error in read_header_prolog, at dwarf_reader.cc:1641
collect2: error: ld returned 1 exit status
make[2]: *** [runtime_output_directory/conf_to_src] Error 1
make[1]: *** [strings/CMakeFiles/conf_to_src.dir/all] Error 2
make: *** [all] Error 2
[25 Jan 2018 3:44] Roel Van de Paar
Tried another system. Ubuntu 17.10 x64, gcc 7.2.0, ld 2.29.1 - here the issue does not reproduce.
[25 Jan 2018 5:29] Roel Van de Paar
Failing system updated to gcc 7.2.0 - same issue. One other difference observed;

$ ld.gold --version
GNU gold (GNU Binutils for Ubuntu 2.29.1) 1.14  # Ubuntu working system 

vs

$ ld.gold --version
GNU gold (version 2.25.1-32.base.el7_4.1 ) 1.11  # Centos failing system
[25 Jan 2018 5:47] Roel Van de Paar
I tried "export LD=ld" to set the linked to ld instead of ld.gold, ref
https://globalengineer.wordpress.com/2016/05/22/gnu-c-and-gold-linker/

But the same issue presented itself. Linker must be set elsewhere.
[25 Jan 2018 5:49] Roel Van de Paar
Tried the following to prevent ld.gold from being used;
sudo mv /usr/bin/ld.gold /usr/bin/NOT_USED_ld.gold

This changed the result;

Scanning dependencies of target GenError
[ 22%] Generating ../include/mysqld_error.h, ../share/english/errmsg.sys
../runtime_output_directory/comp_err: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../runtime_output_directory/comp_err)
../runtime_output_directory/comp_err: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ../runtime_output_directory/comp_err)
make[2]: *** [include/mysqld_error.h] Error 1
make[1]: *** [utilities/CMakeFiles/GenError.dir/all] Error 2
make: *** [all] Error 2
[25 Jan 2018 6:08] Roel Van de Paar
$ cd /lib64
$ sudo mv libstdc++.so.6 libstdc++.so.6.old
$ sudo mv libstdc++.so.6.0.19 libstdc++.so.6.0.19.old
$ cd ~/gcc/objdir-7.2.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
$ sudo cp * /usr/lib64

To update the libstdc++.so.6 to the latest release (you can check with;
$ strings libstdc++.so.6 | grep GLIBCXX_3.4.2
to see if it includes GLIBCXX_3.4.20/21 first. It did not on the failing machine, now it does.)

Tried with ld.gold back in place (moved file change above back), same result.
Tried with NOT_USED_ld.gold again, FINALLY IT WORKS :)

My preliminary conclusion; 
GNU gold (version 2.25.1-32.base.el7_4.1 ) 1.11
Is no longer sufficient to compile MySQL 8.0.4rc, and this is a "regression"
[25 Jan 2018 6:09] Roel Van de Paar
Another alternative is that there is a mismatch between the older ld.gold and the newer <other build utils>
[25 Jan 2018 6:15] Roel Van de Paar
Copied ld.gold (x86_64-linux-gnu-ld.gold) from the working Ubuntu machine to the failing Centos machine. Renamed to /usr/bin/ld.gold and checked;

-bash-4.2$ ld.gold --version
GNU gold (GNU Binutils for Ubuntu 2.29.1) 1.14

Re-tried compile. Works as well. 

This confirms the thoughts in the last two comments further.
[25 Jan 2018 6:16] Roel Van de Paar
With thanks https://askubuntu.com/questions/575505/glibcxx-3-4-20-not-found-how-to-fix-this-error# for the strings idea.
[25 Jan 2018 6:17] Roel Van de Paar
My question; does 8.0.4rc have new compiler/binutils version requirements?
[2 Feb 2018 11:57] MySQL Verification Team
Hello Roel,

Thank you for the report and feedback.
While working on Bug #89428 I observed no issues(used -DWITH_ZLIB=bundled instead of -DWITH_ZLIB=system to avoid bug#89373). 

Reg "compiler/binutils version requirements", I haven't seen anything in change log etc but would let you as and when I find more details if any.

Thanks,
Umesh