Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

Can't compile mysql 5.5.8 with the latest icc and cmake

sigurd_sigurdsson
638 Views

Hello!

My configuration:
CentOS 5.5 64-bit
CMake 2.6.4
4Gb RAM

# 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 C Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.107 Build 20101116
# icpc -V
Intel C++ Intel 64 Compiler XE for applications running on Intel 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.6.4 (tried also with CMake 2.8.3, got the same result) I get many warnings like:

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

-----------
[ 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 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!
----------------------

Any thoughts? How can I compile mysql 5.5.8 with icc and cmake to get a workable mysql?
0 Kudos
8 Replies
levicki
Valued Contributor I
638 Views
This is just a band-aid post until someone more knowledgeable jumps in :)

To me it looks like the source code "thinks" it is being compiled with GCC when you are compiling it with ICC. Check if there are any #defines that you could set in some config.h file, or if there are perhaps some options settable with CMAKE.
0 Kudos
sigurd_sigurdsson
638 Views
Quoting Igor Levicki
This is just a band-aid post until someone more knowledgeable jumps in :)

To me it looks like the source code "thinks" it is being compiled with GCC when you are compiling it with ICC. Check if there are any #defines that you could set in some config.h file, or if there are perhaps some options settable with CMAKE.

No, as you can see, there aren't any GCC here:

# 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

Also I've tried with another way to alter cc and cxx with the same result - switching to the intel compiler takes a place quite well:
# export 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
-- Detecting CXX compiler ABI info

Over thoughts? Is anybody tried to compile mysql 5.5.8 from source with the latest Intel Compiler for Linux?

0 Kudos
levicki
Valued Contributor I
638 Views
If you check your error log you will notice the following:

warning #161: unrecognized #pragma
#pragma interface /* gcc class implementation */

This pragma should probably be inside of an #ifdef block and be included only for compilation using GCC (which is apparent from the code comment).

That is why I suspected that the source "doesn't know" you are using ICC.

I have no other ideas, sorry.
0 Kudos
sigurd_sigurdsson
638 Views
Quoting Igor Levicki
If you check your error log you will notice the following:

warning #161: unrecognized #pragma
#pragma interface /* gcc class implementation */

This pragma should probably be inside of an #ifdef block and be included only for compilation using GCC (which is apparent from the code comment).

That is why I suspected that the source "doesn't know" you are using ICC.

I have no other ideas, sorry.

I've installed GCC 4.5.2. Everything compiles well with the new GCC, but ICC now even can't finished compiling mysql 5.5.8 through cmake.

0 Kudos
JenniferJ
Moderator
638 Views
strange.
The icc 12.0 should work withc gcc 4.1 and 4.5.

did you source compilervars.sh to set up the environment before make?

Jennifer
0 Kudos
JenniferJ
Moderator
638 Views
if you have env setup correctly, it might be something in the mysql that we don't support.
could you send the definition of this macro "ATTRIBUTE_FORMAT_FPTR"? or the preprocessed .i files of ctype-gbk.c using icc and gcc?

Jennifer
0 Kudos
sigurd_sigurdsson
638 Views
if you have env setup correctly, it might be something in the mysql that we don't support.

yes, env installed correctly, I have "source /opt/intel/composerxe-2011/bin/compilervars.sh intel64" in an .sh file,executed at system startup, and don't have any problem with compiling the latest LAMP (mysql 5.1.54, php 5.3.4, apache 2.2.17) by the latest Intel Compiler, the problem only with "mysql 5.5.8 + cmake".

could you send the definition of this macro "ATTRIBUTE_FORMAT_FPTR"? or the preprocessed .i files of ctype-gbk.c using icc and gcc?

- could you please give me step by step instructions how can I get the definition or files?

0 Kudos
JenniferJ
Moderator
638 Views
About generating the .i file, use the options like below:
$ icc -O2... -c -EP -P t.c
It will create a t.i file, rename it as t_icc.i
$ gcc -O2 .... -c-save-temps t.c
Above will generate t.i as well. rename it as t_gcc.i

then compile t_icc.i again with icc to see if the same error is still there.

thanks,
Jennifer
0 Kudos
Reply