Bug #98798 Looks like size limitation in ARM64 machines on page sizes causing build failure
Submitted: 2 Mar 2020 9:35 Modified: 18 Mar 2020 7:39
Reporter: Tapas Kundu Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Packaging Severity:S2 (Serious)
Version:8.0.18 8.0.19 OS:Linux
Assigned to: CPU Architecture:ARM

[2 Mar 2020 9:35] Tapas Kundu
Description:
I have downloaded mysql from https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.19.tar.gz and building it on arm with below configs:

cmake . \
      -DCMAKE_INSTALL_PREFIX=/usr   \
      -DWITH_BOOST=boost/boost_1_70_0 \
      -DINSTALL_MANDIR=share/man \
      -DINSTALL_DOCDIR=share/doc \
      -DINSTALL_DOCREADMEDIR=share/doc \
      -DINSTALL_SUPPORTFILESDIR=share/support-files \
      -DCMAKE_BUILD_TYPE=RELEASE \
      -DCMAKE_C_FLAGS="-Wl -fPIC" \
      -DCMAKE_CXX_FLAGS="-Wl -fPIC" \
      -DWITH_EMBEDDED_SERVER=OFF \
      -DFORCE_INSOURCE_BUILD=1 \
      -DWITH_PROTOBUF=system

Its failing with below logs:

[100%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/sql/sql_builtin.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/pfs_connect_attr-t
[100%] Built target mysqld
CMakeFiles/pfs_connect_attr-t.dir/pfs_connect_attr-t.cc.o: in function `test_multibyte_lengths()':
pfs_connect_attr-t.cc:(.text._ZL22test_multibyte_lengthsv+0x38): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `my_charset_utf8_bin' defined in .data.rel.my_charset_utf8_bin section in ../../../archive_output_directory/libstrings.a(ctype-utf8.cc.o)
/bin/ld: pfs_connect_attr-t.cc:(.text._ZL22test_multibyte_lengthsv+0x38): warning: too many GOT entries for -fpic, please recompile with -fPIC
/bin/ld: final link failed: symbol needs debug section which does not exist
collect2: error: ld returned 1 exit status
make[2]: *** [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/build.make:171: runtime_output_directory/pfs_connect_attr-t] Error 1
make[1]: *** [CMakeFiles/Makefile2:3305: storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

I tried to check this page(https://dev.mysql.com/doc/refman/8.0/en/source-configuration-options.html#option_cmake_cma...) if any flag introduced in 8.0.18 onward which needs to be set to fix this, but coudnt figure out.

Also checked the existing bugs and couldn't find this behaviour logged anywhere.

Kindly help me if i am missing something as part of the build.

How to repeat:
Building with below config on arm causes the above mentioned failure:

cmake . \
      -DCMAKE_INSTALL_PREFIX=/usr   \
      -DWITH_BOOST=boost/boost_1_70_0 \
      -DINSTALL_MANDIR=share/man \
      -DINSTALL_DOCDIR=share/doc \
      -DINSTALL_DOCREADMEDIR=share/doc \
      -DINSTALL_SUPPORTFILESDIR=share/support-files \
      -DCMAKE_BUILD_TYPE=RELEASE \
      -DCMAKE_C_FLAGS="-Wl -fPIC" \
      -DCMAKE_CXX_FLAGS="-Wl -fPIC" \
      -DWITH_EMBEDDED_SERVER=OFF \
      -DFORCE_INSOURCE_BUILD=1 \
      -DWITH_PROTOBUF=system
[3 Mar 2020 3:59] Tapas Kundu
This is the correct cmake configs, pls forgive for the typo in description.

cmake . \
      -DCMAKE_INSTALL_PREFIX=/usr   \
      -DWITH_BOOST=boost/boost_1_70_0 \
      -DINSTALL_MANDIR=share/man \
      -DINSTALL_DOCDIR=share/doc \
      -DINSTALL_DOCREADMEDIR=share/doc \
      -DINSTALL_SUPPORTFILESDIR=share/support-files \
      -DCMAKE_BUILD_TYPE=RELEASE \
      -DCMAKE_C_FLAGS="-fPIC" \
      -DCMAKE_CXX_FLAGS="-fPIC" \
      -DWITH_EMBEDDED_SERVER=OFF \
      -DFORCE_INSOURCE_BUILD=1 \
      -DWITH_PROTOBUF=system
[5 Mar 2020 12:57] Tapas Kundu
Can some one please help on this?
[6 Mar 2020 13:28] MySQL Verification Team
Hi Mr. Kundu,

Thank you for your bug report.

First of all, why are you building MySQL at all ??? We have on our download site plenty of binary packages for the ARM processor.

Next, you should use bundled BOOST and not your version. Next, do not use -fPIC flag at all, please.

If nothing of the above helps, let us know exact info on your Linux, compiler and linker versions.
[13 Mar 2020 7:09] Tapas Kundu
Thanks for replying.

I have been using bundled boost only for building.

Have removed fPIC flag, still see the issue.

I am using Photon OS to build mysql.

Here are the details on the cmake and gcc i am using for the build.
root@photon-20748be6fe64 [ / ]# cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@photon-20748be6fe64 [ / ]#                                                                                                                   root@photon-20748be6fe64 [ / ]# gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@photon-20748be6fe64 [ / ]#
oot@photon-20748be6fe64 [ / ]# ld --version
GNU ld (GNU Binutils) 2.32
Copyright (C) 2019 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
root@photon-20748be6fe64 [ / ]#
Let me know if you need any more information.
[13 Mar 2020 13:30] MySQL Verification Team
Hi Mr. Kundu,

I have also asked you to try using our ARM binary for Linux.

Do you have problems with it or not. It is hard to thoroughly check your building process, OS etc, etc ... If our binary works, then there is not a problem.
[13 Mar 2020 14:31] MySQL Verification Team
Hi Mr. Kundu,

I was just informed that we do not support PhotonOS.

Also, we only support 64-bit ARM CPU.
[18 Mar 2020 7:39] Tapas Kundu
Hi Sinisa,

I have been using 64-bit arm CPU machine to build this.

root@photon-20748be6fe64 [ ~ ]# uname -a
Linux photon-20748be6fe64 4.19.97-1.ph3 #1-photon SMP Mon Jan 27 19:47:57 UTC 2020 aarch64 GNU/Linux
root@photon-20748be6fe64 [ ~ ]#

root@photon-20748be6fe64 [ ~ ]# uname -m
aarch64
root@photon-20748be6fe64 [ ~ ]#

root@photon-20748be6fe64 [ ~ ]# file /bin/bash
/bin/bash: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=88acb0e156baa935c3341ae292479c4cc32acefd, stripped
root@photon-20748be6fe64 [ ~ ]#

root@photon-20748be6fe64 [ ~ ]# lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  1
Core(s) per socket:  8
Socket(s):           1
NUMA node(s):        1

Kindly let me know if i am missing some parameter while configuring before build which is causing me this error.
[18 Mar 2020 14:04] MySQL Verification Team
Hi Mr. Kundu,

As I wrote before, we do not support PhotonOS, so we can not know how to build or run MySQL server on it.