Bug #22637 ICC compiled mysql does not compatible with PHP 5.1.6 configuration
Submitted: 24 Sep 2006 12:11 Modified: 29 Oct 2007 13:47
Reporter: ryan zheng Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:mysql-max-4.1.21-pc-linux-gnu-i686-icc-g OS:Linux (Debian etch)
Assigned to: Kent Boortz CPU Architecture:Any
Tags: icc, php

[24 Sep 2006 12:11] ryan zheng
Description:
I have errors while compiling php 5.1.6 with mysql 4.1.21 
(mysql-max-4.1.21-pc-linux-gnu-i686-icc-glibc23)

./configure  --enable-magic-quotes --with-curl --enable-zend-multibyte
\
  --enable-fastcgi --enable-mbstring   --enable-mbregex
--with-config-file-path=/etc \
  --with-gd --with-zlib --with-jpeg --with-png --with-xpm  \
  --enable-gd-native-ttf --with-ttf   --with-mysql=/usr/local/mysql \
  --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-sockets \
  --without-sqlite --with-iconv   -with-pear -disable-debug \
  --with-freetype-dir --with-gettext --enable-memory-limit
 
But I always get the error 
...
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for
more information.
...

And:
configure:58533: checking for mysql_close in -lmysqlclient
configure:58552: gcc -o conftest -I/usr/include -g -O2 
-Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -L/usr/lib 
conftest.c -lmysqlclient  -lfreetype -lpng -lz -lcurl -lz -lresolv -lm
-ldl -lnsl  -lxml2 -lcurl -lgssapi_krb5 -lkrb5 -lk5crypto -lkrb5support
-lcom_err -lresolv -lidn -lssl -lcrypto -ldl -lssl -lcrypto -lz -lxml2
1>&5
/usr/local/mysql/lib/libmysqlclient.a(client.o): In function
`mysql_real_connect':
client.c:(.text+0x1482): undefined reference to `_intel_fast_memcpy'
/usr/local/mysql/lib/libmysqlclient.a(client.o): In function
`cli_read_rows':
client.c:(.text+0x1f93): undefined reference to `_intel_fast_memcpy'
/usr/local/mysql/lib/libmysqlclient.a(net.o): In function
`my_net_write':

Seeing the '_intel_fast_memcpy', I knew that it is because of the icc
compiled mysql. 
Can you help me how to solve this problem? I do not want to download a
new gcc compiled mysql. 
Maybe I just need  libmysqlclient 4.1.21 (non-rpm), and where to
download it? 
I am using gcc 4.1.2.

How to repeat:
compiling php 5.1.6 with mysql 4.1.21 
(mysql-max-4.1.21-pc-linux-gnu-i686-icc-glibc23)

./configure --with-mysql=/usr/local/mysql \
  --with-mysqli=/usr/local/mysql/bin/mysql_config
[24 Sep 2006 13:32] ryan zheng
I guess maybe it is because of icc incompatibility with gcc4.

I try to replace the libmysqlclient.a, libmysqlclient_r.a, libz.a in 
/usr/local/mysql/lib by the gcc compiled ones.
So i download the MySQL-devel-standard-4.1.21-0.sles9.i586.rpm,
and extract the three .a files above to there.
Superisely, it worked.

So it proved some of my judgement. 
But can the three .a file be enough? Can my temporary solution be good?
Is there something better to do to avoid some future failure due to this replacement behavior?

Thanks ~!
[25 Sep 2006 9:07] Valeriy Kravchuk
Thank you for a problem report. Looks like a duplicate of a known bug #18776, but for i686 instead of IA64.
[5 Jun 2007 15:58] Heinz Bast
I have updated case 18776  which describes the same problem - there is a rather simple solution to prevent the issue using option -i-static of the Intel Compiler. Please check there for details
[6 Jun 2007 18:25] Joerg Bruehe
Some remarks:

1) This is *no* duplicate of bug#18776, because that is about a dependency
   of RPMs, while this here is about tar.gz packages.
Yes, technically it is the same library function which is called,
so Heinz Bast's comments there are valid.

2) By now, all icc-compiled servers built by MySQL AB have the Intel
   runtime libraries statically linked, so it is (for the server)
   not needed separately.

3) Yes, the "libmysqlclient" library (if the modules were compiled by icc)
   on both the x86 (32 bit) and the x86_64 CPU calls functions from the
   Intel runtime libraries.
Currently, it is necessary to download and install that library separately,
if the user wants to link other modules with that library (icc-built).
The library is available from Intel direct, or from MySQL AB:
   http://dev.mysql.com/downloads/os-linux.html
The correct version (currently) is the one named "9.0":
   intel-icc9-libs-9.0-*  (choose CPU and package format as needed)

4) If the user wants to avoid that separate step, the best choice (for now)
   is to use a tar.gz package built by gcc.

5) We want to include the Intel runtime library into our tar.gz packages
   if these are built using icc, but that is "work in progress" only,
   and I will not guess any date or version when it will be done.

6) It is possible to let a gcc-generated client library (which does not
   have that dependency) access an icc-generated server (see item 5).
However, there is no "mixed" package available with this combination,
so this requires manual action by the user.

7) Note that all this is no issue on the ia64 CPU,
   because there no such calls are generated.
[29 Oct 2007 13:47] Kent Boortz
This will not (most likely) be solved in 4.1.
The only option in 4.1 is to use gcc compiled
binaries.

In 5.0 there are shared libraries, and those are
not dependent on Intel icc runtime libraries.

In 5.0 there will be work done to solve static
linking with icc compiled client libraries, in
addition to the solution to link with the shared
libraries.
[1 Nov 2007 8:22] Saidur Rahman
I have an error when am going to connect mysql using c.

 [Linker error] undefined reference to `mysql_close@4' 
Please anyone help me. 
maill address: rana_0036@yahoo.com