Bug #59058 Can't compile mysql 5.5.8 through the latest Intel C++ Compiler for Linux
Submitted: 20 Dec 2010 12:58 Modified: 20 Dec 2010 22:55
Reporter: Neil Armstrong Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.5.8 OS:Linux (CentOS 5.5 64-bit)
Assigned to: CPU Architecture:Any

[20 Dec 2010 12:58] Neil Armstrong
Description:
Hello!

I can't compile mysql 5.5.8 through the latest Intel Compiler 12.0.1.107 for Linux.

# uname -a
Linux dhcppc8 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
# icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.1.107 Build 20101116
# icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.1.107 Build 20101116

During compiling MySQL 5.5.8 (Final Release) from source with ICC 12.0.1 and CMake 2.8.3 I get many warnings like:

tar -zxvf mysql-5.5.8.tar.gz
cd mysql-5.5.8
CC=icc CXX=icpc cmake .

-- The C compiler identification is Intel
-- The CXX compiler identification is Intel
-- Check for working C compiler: /opt/intel/composerxe-2011.1.107/bin/intel64/icc
-- Check for working C compiler: /opt/intel/composerxe-2011.1.107/bin/intel64/icc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/intel/composerxe-2011.1.107/bin/intel64/icpc
-- Check for working CXX compiler: /opt/intel/composerxe-2011.1.107/bin/intel64/icpc -- works

...

[ 7%] Building C object strings/CMakeFiles/strings.dir/ctype-gbk.c.o
/root/src/mysql-5.5.8/include/m_ctype.h(235): warning #1287: invalid attribute for field "snprintf"
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);

[ 8%] Building C object strings/CMakeFiles/strings.dir/ctype-latin1.c.o
/root/src/mysql-5.5.8/include/m_ctype.h(235): warning #1287: invalid attribute for field "snprintf"
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);

[ 21%] Building C object mysys/CMakeFiles/mysys.dir/my_gethostbyname.c.o
/root/src/mysql-5.5.8/include/m_ctype.h(235): warning #1287: invalid attribute for field "snprintf"
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);

[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item_sum.cc.o
/root/src/mysql-5.5.8/include/m_string.h(82): warning #584: omission of exception specification is incompatible with previous function "stpcpy" (declared at line 364 of "/usr/include/string.h")
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
/root/src/mysql-5.5.8/include/m_ctype.h(235): warning #1287: invalid attribute for member "my_charset_handler_st::snprintf"
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);

[ 99%] Building CXX object sql/CMakeFiles/sql.dir/sql_yacc.cc.o
/root/src/mysql-5.5.8/include/m_string.h(82): warning #584: omission of exception specification is incompatible with previous function "stpcpy" (declared at line 364 of "/usr/include/string.h")
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
/root/src/mysql-5.5.8/include/m_ctype.h(235): warning #1287: invalid attribute for member "my_charset_handler_st::snprintf"
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
/root/src/mysql-5.5.8/sql/item_xmlfunc.h(24): warning #161: unrecognized #pragma
#pragma interface /* gcc class implementation */
/root/src/mysql-5.5.8/sql/sql_partition.h(20): warning #161: unrecognized #pragma
#pragma interface /* gcc class implementation */
/root/src/mysql-5.5.8/sql/item_xmlfunc.h(24): warning #161: unrecognized #pragma
#pragma interface /* gcc class implementation */
----------------------

make
make install
cd /usr/local/mysql/
chown -R mysql:mysql .

Therefore running /scripts/mysql_install_db --user=mysql gives me just an error in results, can't create the main mysql database and mysql gets unworkable. If I compile with gcc there aren't any errors and warnings during compiling and mysql_install_db works just fine without any problems.

----------------------
# /usr/local/mysql/scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
101217 7:29:45 - mysqld got signal 8 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=402653184
read_buffer_size=2097152
max_used_connections=0
max_threads=151
thread_count=1
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1013428 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x1c324c00
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x40c9e078 thread_stack 0x40000
./bin/mysqld(my_print_stacktrace+0x20)[0xa760e0]
./bin/mysqld(handle_segfault+0x37a)[0x50885a]
/lib64/libpthread.so.0[0x35b4a0eb10]
./bin/mysqld[0xabc047]
[0x1c337550]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x1c337280 = SET @cmd=concat(@l1,@l2)
thd->thread_id=1
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Installation of system tables failed!
----------------------

How to repeat:
Clean CentOS 5.5 64-bit installation.
CMake 2.8.3 compiled from source.
IntelĀ® C++ Composer XE 2011 for Linux (Includes IntelĀ® C++ Compiler 12.0.1.107) compiled from source. You can download the free version here http://software.intel.com/en-us/articles/non-commercial-software-download/

tar -zxvf mysql-5.5.8.tar.gz
cd mysql-5.5.8
CC=icc CXX=icpc cmake .
make
make install
cd /usr/local/mysql/
chown -R mysql:mysql .
/usr/local/mysql/scripts/mysql_install_db --user=mysql
----------------------

Any thoughts? How can I compile mysql 5.5.8 with icc to get a workable mysql?
[20 Dec 2010 22:52] Sveta Smirnova
Thank you for the report.

ICC is partially supported: we use it on IA64 platforms only. Therefore I have to close this report as "Won't Fix". If you have a patch we can consider it though.

For now please use gcc.
[20 Dec 2010 22:54] Joerg Bruehe
Our experiences with the Intel compiler are not too positive, it seems not to be the best match for MySQL sources.

When we last used it, our settings were:
      CC          "icc  -static-intel -static-libgcc"
      CXX         "icpc -static-intel -static-libgcc"
      CFLAGS      "-g iccoptO3 -mp -restrict"
      CXXFLAGS    "-g iccoptO3 -mp -restrict"

If you really want to use icc, take that as a startpoint.
However, using gcc will definitely be easier.
[20 Dec 2010 23:01] Joerg Bruehe
Sorry for the copy-paste error:
In the above settings, "iccoptO3" expands to "-O3 -unroll2 -ip" in an optimized build,
and to empty in a debug build.