Bug #80042 compile 5.7.10 failed on CentOS5

Submitted: 19 Jan 2016 3:18 Modified: 26 Dec 2016 3:13
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.10 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: server

[19 Jan 2016 3:18] Fangxin Flou
Description:
We are going to deploy 5.7.10 to our production, we are still using CentOS5/RHEL5, get the following errors when compiling.

/data/mysql-5.7.10/sql/mysqld.cc: In function ‘void setup_fpu()’:
/data/mysql-5.7.10/sql/mysqld.cc:194: error: ‘FE_ALL_EXCEPT’ was not declared in this scope
/data/mysql-5.7.10/sql/mysqld.cc:194: error: ‘fedisableexcept’ was not declared in this scope
/data/mysql-5.7.10/sql/mysqld.cc:198: error: ‘FE_TONEAREST’ was not declared in this scope
/data/mysql-5.7.10/sql/mysqld.cc:198: error: ‘fesetround’ was not declared in this scope

We just have too much CentOS5/RHEL5 hosts.

How to repeat:
Compile 5.7.10 on CentOS5 with gcc 4.4.7

Suggested fix:
Can we comment two lines? 

inline void setup_fpu()
{
/*
#ifdef HAVE_FEDISABLEEXCEPT
  fedisableexcept(FE_ALL_EXCEPT);
#endif
*/

  /* Set FPU rounding mode to "round-to-nearest" */
  /* fesetround(FE_TONEAREST);  */

Seems this two fuctions are available in higher versions of GLIBC
[19 Jan 2016 9:14] Terje Røsten
Hi!

Thanks for your report.

RHEL5/CentOS5/OracleLinux5 is supported for MySQL 5.7.

Using the gcc44 and  gcc44-c++ packages included in the OS and
setting:

export CC=/usr/bin/gcc44 
export CXX=/usr/bin/g++44

before running cmake I am not able to reproduce your problem.

How is your build done? Passing any special arguments to cmake,
or setting any environmental variables?
[19 Jan 2016 9:26] Fangxin Flou
cmake . -DWITH_EMBEDDED_SERVER=0 \
        -DWITH_ARCHIVE_STORAGE_ENGINE=0 \
        -DWITH_BLACKHOLE_STORAGE_ENGINE=0 \
        -DWITH_EXAMPLE_STORAGE_ENGINE=0 \
        -DWITH_TOKUDB_STORAGE_ENGINE=1 \
        -DWITH_FEDERATED_STORAGE_ENGINE=0 \
        -DWITH_NDBCLUSTER_STORAGE_ENGINE=0 \
        -DENABLE_DTRACE=0 -DENABLED_PROFILING=1 \
        -DWITH_UNIT_TESTS=0 -DCMAKE_BUILD_TYPE=Release \
        -DENABLE_DEBUG_SYNC=0 -DENABLE_GCOV=0 -DWITH_SSL=bundled -DWITH_ZLIB=bundled \
        -DCMAKE_INSTALL_PREFIX=/usr/local/onesql5710 \

Here is the cmake options, I will test the ReleaseWithDebug Build
[19 Jan 2016 9:49] Fangxin Flou
cmake log

-- INSTALL mysqlclient.pc lib/pkgconfig
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_EXAMPLE_STORAGE_ENGINE
    WITH_TOKUDB_STORAGE_ENGINE

-- Build files have been written to: /data/mysql-5.7.10
-- Cache values
// Path to a file.
BOOST_INCLUDE_DIR:PATH=/usr/local/include

// Bundle mecab and ipadic with plugin
BUNDLE_MECAB:BOOL=ON

// Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
 CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo

// CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++

// C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local/onesql5710

// Set to true if this is a community build
COMMUNITY_BUILD:BOOL=ON

// Download boost from sourceforge.
DOWNLOAD_BOOST:BOOL=OFF

// Timeout in seconds when downloading boost.
DOWNLOAD_BOOST_TIMEOUT:STRING=600

// Enable profiling
ENABLED_PROFILING:BOOL=1

// Enable debug sync (debug builds only)
ENABLE_DEBUG_SYNC:BOOL=0

// Enable gcov (debug, Linux builds only)
ENABLE_GCOV:BOOL=0

// Enable gprof (optimized, Linux builds only)
ENABLE_GPROF:BOOL=OFF

// Enable SASL on InnoDB Memcached
ENABLE_MEMCACHED_SASL:BOOL=OFF

// Enable SASL on InnoDB Memcached
ENABLE_MEMCACHED_SASL_PWDB:BOOL=OFF

//  Selection of features. This option is deprecated
FEATURE_SET:STRING=community

// Installation directory layout. Options are: TARGZ (as in tar.gz installer), WIN (as in zip installer), STANDALONE, RPM, DEB, SVR4, FREEBSD, GLIBC, OSX, SLES
INSTALL_LAYOUT:STRING=STANDALONE

// Where to install mysqlclient.pc, defaults to lib/pkgconfig
INSTALL_PKGCONFIGDIR:PATH=

// Mutex type: event, sys or futex
MUTEXTYPE:STRING=event

// default MySQL data directory
MYSQL_DATADIR:PATH=/usr/local/onesql5710/data

// MySQL maintainer-specific development environment
MYSQL_MAINTAINER_MODE:BOOL=OFF

// Support tracing of Optimizer
OPTIMIZER_TRACE:BOOL=ON

// PATH to MySQL TMP dir. Defaults to the P_tmpdir macro in <stdio.h>
TMPDIR:PATH=P_tmpdir

//
WITH_ARCHIVE_STORAGE_ENGINE:BOOL=0

// Enable address sanitizer
WITH_ASAN:BOOL=OFF

//
WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=0

// Path to boost sources: a directory, or a tarball to be unzipped.
WITH_BOOST:PATH=

// Support for client-side protocol tracing plugins
WITH_CLIENT_PROTOCOL_TRACING:BOOL=ON

// Use dbug/safemutex
WITH_DEBUG:BOOL=OFF

// Use flags from cmake/build_configurations/compiler_options.cmake
WITH_DEFAULT_COMPILER_OPTIONS:BOOL=ON

// Use feature set in cmake/build_configurations/feature_set.cmake
WITH_DEFAULT_FEATURE_SET:BOOL=ON

// By default use bundled editline
WITH_EDITLINE:STRING=bundled

// Compile MySQL with embedded server
WITH_EMBEDDED_SERVER:BOOL=0

// Options are: none, complex, all
WITH_EXTRA_CHARSETS:STRING=all

//
WITH_FEDERATED_STORAGE_ENGINE:BOOL=0

// Enable extra InnoDB debug checks
WITH_INNODB_EXTRA_DEBUG:BOOL=OFF

//
WITH_INNODB_MEMCACHED:BOOL=OFF

// By default use bundled libevent on this platform
WITH_LIBEVENT:STRING=bundled

// Compile with tcp wrappers support
WITH_LIBWRAP:BOOL=OFF

// By default use bundled lz4 library
WITH_LZ4:STRING=bundled

// <empty> (disabled) | system (use os library) | </path/to/custom/installation> (use custom version)
WITH_MECAB:STRING=

// Enable memory sanitizer
WITH_MSAN:BOOL=OFF

// Link NGRAM_PARSER statically to the server
WITH_NGRAM_PARSER:BOOL=ON

// Explicitly set NUMA memory allocation policy
WITH_NUMA:BOOL=ON

// Link PARTITION statically to the server
WITH_PARTITION_STORAGE_ENGINE:BOOL=ON

// Generate PIC objects
WITH_PIC:BOOL=OFF

// bundled (use yassl), yes (prefer os library if present, otherwise use bundled), system (use os library), </path/to/custom/installation>
WITH_SSL:STRING=bundled

// Enable installation of systemd support files
WITH_SYSTEMD:BOOL=OFF

// Have a built-in test protocol trace plugin in libmysql (requires WITH_CLIENT_PROTOCOL_TRACING option)
WITH_TEST_TRACE_PLUGIN:BOOL=OFF

// Enable undefined behavior sanitizer
WITH_UBSAN:BOOL=OFF

// Compile MySQL with unit tests
WITH_UNIT_TESTS:BOOL=0

// Valgrind instrumentation
WITH_VALGRIND:BOOL=OFF

//
WITH_ZLIB:STRING=bundled
[19 Jan 2016 10:09] Terje Røsten
You have:

// CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++

// C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc

On my systems that gives:

/usr/bin/cc --version |head -1
cc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)

/usr/bin/g++ --version |head -1
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)

Which don't work for building MySQL 5.7.

Packages is:

$ rpm -qf /usr/bin/cc /usr/bin/g++
gcc-4.1.2-54.el5
gcc-c++-4.1.2-54.el5

To build I use /usr/bin/gcc44 and /usr/bin/g++44 from packages:

$ rpm -qf /usr/bin/gcc44  /usr/bin/g++44 
gcc44-4.4.7-1.el5
gcc44-c++-4.4.7-1.el5

Have you replace gcc 4.1 packages with some custom built compiler?

Can you try to install the gcc44 and gcc44-c++ packages?

And set:

export CC=/usr/bin/gcc44 
export CXX=/usr/bin/g++44

It's also more safe to build outside sources:

$ cd /data/mysql-5.7.10
$ mkdir build
$ cd build
$ cmake .. <add-options>
[19 Jan 2016 11:56] Fangxin Flou
I replace the gcc & g++ binary file with gcc 4.4.7-1

[root@rh4srv1 ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-1)
Copyright (C) 2010 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@rh4srv1 ~]# g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-1)
Copyright (C) 2010 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.

Anyway I am making more tests.
[26 Dec 2016 3:13] Fangxin Flou
This happens when I compile it with gcc44, and run it without gcc44 libraries.

After I install the gcc44 related libraries on the target host, it's fine.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.