Bug #90734 Compile failure
Submitted: 3 May 2018 12:19 Modified: 3 May 2018 12:34
Reporter: Al Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.11 OS:Linux (Slackware 14.1)
Assigned to: CPU Architecture:x86

[3 May 2018 12:19] Al Smith
Description:
MySQL refuses to compile.

[ 76%] Built target master
[ 76%] Linking CXX executable ../../../runtime_output_directory/pfs_connect_attr-t
/whatever/mysql/src/mysql-8.0.11/sql/table.h:3288: error: undefined reference to 'TLS init function for temptable::tables'
/whatever/mysql/src/mysql-8.0.11/sql/table.h:3288: error: undefined reference to 'TLS init function for temptable::tables'
/whatever/mysql/src/mysql-8.0.11/sql/table.h:3288: error: undefined reference to 'TLS init function for temptable::tables'
/whatever/mysql/src/mysql-8.0.11/sql/table.h:3288: error: undefined reference to 'TLS init function for temptable::tables'
collect2: error: ld returned 1 exit status
make[2]: *** [runtime_output_directory/pfs_connect_attr-t] Error 1
make[1]: *** [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2
make: *** [all] Error 2

How to repeat:
% cmake . -DCMAKE_INSTALL_PREFIX=/whatever/mysql -DWITH_SSL=yes -DOPENSSL_ROOT_DIR=/whatever/ssl -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/whatever/mysql/src/boost
% make

OpenSSL is 1.0.2o. CMake is 3.11.0.

GCC/G++ is 4.8.2.
[3 May 2018 12:34] Terje Røsten
Hi!

Thanks for your report!

Checks for GCC version is a bit too weak, in fact you need GCC 4.8.3 or better[1] or Clang 3.4 to compile MySQL 8 on Linux.

Stricter cmake checks has been added upstream and will be part of next release.

[1]: TLS wrappers were added in GCC 4.8.3.

 - Terje
[18 May 2018 7:52] Terje Røsten
https://bugs.mysql.com/bug.php?id=90906 marked as duplicate.
[24 Oct 2018 13:10] Steven Van Ingelgem
(see next comment for more info)

Attachment: MySQL.txt (text/plain), 4.99 KiB.

[24 Oct 2018 13:11] Steven Van Ingelgem
I have a similar issue:

OpenSSL: OpenSSL 1.1.0f  25 May 2017
CMake: cmake version 3.7.2
GCC: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
kernel : Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
OS: Debian GNU/Linux 9.5 (stretch)
[24 Oct 2018 13:17] Terje Røsten
Hi Steven!

Can you please post your build script, what commands did you run to build?
[24 Oct 2018 13:19] Steven Van Ingelgem
My build script is this:
cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST="$DOWNLOAD_DIR/boost" -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Release -DENABLED_PROFILING=ON -DENABLED_LOCAL_INFILE=OFF -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -DWITH_ZLIB=yes -DENABLE_DOWNLOADS=OFF -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc/mysql -DMYSQL_MAINTAINER_MODE=OFF -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" -DWITH_SSL=yes "$SOURCE_DIR"
[24 Oct 2018 13:38] Terje Røsten
Hi again,

not able to reproduce so far, can you try without ccache?
[24 Oct 2018 17:00] Steven Van Ingelgem
Ok, so retrying without ccache (btw, this is not version 8.0.11, I'm doing it with 8.0.13) -- sorry it took so long, but I did it single threaded, with VERBOSE=1 to get you all possible information necessary (I'll upload the logfile next):

Downloaded source from: "Generic Linux (Architecture Independent), Compressed TAR Archive Includes Boost Headers = mysql-boost-8.0.13.tar.gz"

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

rm -rf (in build-directory ;))

MAIN_DIR=`pwd`/..
SOURCE_DIR="$MAIN_DIR/mysql"
INSTALL_DIR="$MAIN_DIR/mysql-install"
DOWNLOAD_DIR="$MAIN_DIR/mysql-downloads"

cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST="$DOWNLOAD_DIR/boost" -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Release -DENABLED_PROFILING=ON -DENABLED_LOCAL_INFILE=OFF -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -DWITH_ZLIB=yes -DENABLE_DOWNLOADS=OFF -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc/mysql -DMYSQL_MAINTAINER_MODE=OFF -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" -DWITH_SSL=yes "$SOURCE_DIR"
[24 Oct 2018 17:01] Steven Van Ingelgem
build log

Attachment: log.zip (application/zip, text), 78.15 KiB.

[24 Oct 2018 17:05] Steven Van Ingelgem
To me it looks like it is trying to include this:

archive_output_directory/libsql_main.a
                 U bool dd::get_tablespace_name<dd::Partition>(THD*, dd::Partition const*, char const**, MEM_ROOT*)

But it is unknown in any other archive/library in the build tree.
[25 Oct 2018 8:25] Terje Røsten
Hi!

Seems like -DCMAKE_BUILD_TYPE=Release is problematic, I have created:

 https://bugs.mysql.com/bug.php?id=92945

to resolve this.

Can you please verify this is the problem for you by using -DCMAKE_BUILD_TYPE=RelWithDebInfo ?
[25 Oct 2018 9:55] Steven Van Ingelgem
I confirm it works with the workaround proposed by Terje:
[100%] Built target mysqld
[100%] Built target pfs_connect_attr-t