Bug #19817 error when try to compile PHP5.1 with mysql 5.0.21 static libs
Submitted: 15 May 2006 14:58 Modified: 11 Dec 2006 9:08
Reporter: Andrew Sitnikov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.21, 5.1.11 OS:Linux (Linux, SuSE 10.0)
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: php, pure_virtual, SSL, yassl

[15 May 2006 14:58] Andrew Sitnikov
Description:
subj

How to repeat:
./configure ... --with-mysql=../mysql-standard-5.0.21-linux-i686 ...

configure: error: mysql configure failed. Please check config.log for more information.

from config.log:

configure:76793: gcc -o conftest -I/usr/include -g -O2  -Wl,-rpath,/home/...v/work/PHP/mysql-standard-5.0.21-linux-i686/lib -L/home/...v/work/PHP/mysq
l-standard-5.0.21-linux-i686/lib -L/usr/lib -L/usr/lib -lpthread -lstdc++ -Wl,-rpath,/usr/ssl/lib -L/usr/ssl/lib -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclie
nt  -lz -lmhash -lmcrypt -lltdl -lldap -llber -lssl -lcrypto -lcrypt -lpam -lgmp -lt1 -lfreetype -lpng -lz -ljpeg -lssl -lcrypto -ldb-4.3 -ldb-4.3 -lndbm -lgd
bm -lcurl -lbz2 -lz -lssl -lcrypto -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lcurl -lssl -lcrypto -ldl -lz -lxml2 -lz -lm >&5
/home/.../work/PHP/mysql-standard-5.0.21-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x8): undefined reference to `__pu
re_virtual'
/home/.../work/PHP/mysql-standard-5.0.21-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0xc): undefined reference to `__pu
re_virtual'

with mysql-standard-5.0.13-rc-linux-i686 PHP build properly
[17 May 2006 7:34] Andrew Sitnikov
some more info 

configure result:
mysql-standard-4.1.19-pc-linux-gnu-i686 - Ok
mysql-standard-5.0.18-linux-i686 - OK
mysql-standard-5.0.19-linux-i686 - OK
mysql-standard-5.0.20-linux-i686 - Error
mysql-standard-5.0.21-linux-i686 - Error

glibc23 libs:

mysql-standard-5.0.19-linux-i686-glibc23
configure & build - Ok
run PHP:
#>./sapi/cli/php -v
PHP 5.1.5-dev (cli) (built: May 17 2006 10:31:23) 
Copyright (c) 1997-2006 The PHP Group

mysql-standard-5.0.20-linux-i686-glibc23
configure & build - Ok
run PHP:
#>./sapi/cli/php -v 
PHP Fatal error:  Unable to start curl module in Unknown on line 0

mysql-standard-5.0.21-linux-i686-glibc23
configure & build - Ok
run PHP:
#>./sapi/cli/php -v 
PHP Fatal error:  Unable to start curl module in Unknown on line 0
[17 May 2006 7:46] Antony Dovgal
ext/curl initialization fails because curl_global_init(CURL_GLOBAL_SSL) returns failure, which happens because this function in turn calls SSLeay_add_ssl_algorithms() and it's failure is the REAL source of the problem.
From what I can see this is somehow caused by the recent OpenSSL support addition - lots of mysql related bug reports @ bugs.php.net appeared exactly after that.
[19 Jul 2006 6:16] Antony Dovgal
See also http://bugs.mysql.com/bug.php?id=19810
[21 Aug 2006 12:23] Magnus Blåudd
Yes, we started to compile MySQL with the yaSSL SSL library. It defines functions with exactly the same names as OpenSSL. That causes these kind of linking problems. It has been fixed by prefixing all yaSSL SSL functions with yaSSL_ so for example 'SSL_Library_init' becomes 'yaSSL_library_init'

Please use version 5.0.24 of MySQL

Duplicate of bug#19575
[21 Aug 2006 12:56] Magnus Blåudd
Verified with "nm" that only yaSSLeay_add_ssl_algorithms exist in "libmysqlclient" library.
[msvensson@host mysql-5.0]$ nm libmysql/.libs/libmysqlclient.so | grep SSLeay_
0009e286 T yaSSLeay_add_ssl_algorithms
0009ced8 T yaSSLeay_version
001f67c8 d _ZZ16yaSSLeay_versionE7version
[21 Aug 2006 13:05] Andrew Sitnikov
php5.1.5

mysql-standard-5.0.24-linux-i686-glibc23 version 
configure/build/run - OK

mysql-standard-5.0.24-linux-i686 :

configure:76493: checking for mysql_close in -lmysqlclient
configure:76523: gcc -o conftest -I/usr/include -g -O2  -Wl,-rpath,/home/sitnikov/work/PHP/mysql-standard-5.0.24-linux-i686/lib -L/home/sitnikov/work/PHP/mysql-standard-5.0.24-linux-i686/lib -L/usr/lib  -Wl,-rpath,/usr/ssl/lib -L/usr/ssl/lib conftest.c -lmysqlclient  -lcurl -lssl -lcrypto -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lcurl -lssl -lcrypto -ldl -lz -lxml2 -lz -lm >&5
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x8): undefined reference to `__pure_virtual'
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0xc): undefined reference to `__pure_virtual'
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x10): undefined reference to `__pure_virtual'
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x14): undefined reference to `__pure_virtual'
...
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(libtaocrypt_la-algebra.o):(.gnu.linkonce.d.__vt_Q28TaoCrypt23AbstractEuclideanDomain+0x40): more undefined references to `__pure_virtual' follow
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(libtaocrypt_la-file.o): In function `TaoCrypt::FileSource::~FileSource(void)':
file.cpp:(.text+0x88): undefined reference to `__builtin_delete'
/<paht>/work/PHP/mysql-standard-5.0.24-linux-i686/lib/libmysqlclient.a(libtaocrypt_la-file.o): In function `TaoCrypt::FileSink::~FileSink(void)':
file.cpp:(.text+0x28c): undefined reference to `__builtin_delete'
collect2: ld returned 1 exit status
configure:76529: $? = 1
configure: failed program was:
[21 Aug 2006 14:50] Magnus Blåudd
Sorry.
[21 Aug 2006 14:55] Magnus Blåudd
We have linked in some C++ code into libmysqlclient, tests are done to verify it's still a pure c library, but those apparently fails.
[23 Aug 2006 9:46] Magnus Blåudd
Andrew, could you please specify what compiler version etc. you use? The undefined functions come from the C++ run time library so this could probably be temporary solved by using the C++ compiler or linking with C++ run time. But of course we wan't to make a better permanent solution.
[4 Sep 2006 5:43] Andrew Sitnikov
gcc --version                                                                                                          
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 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.
[4 Sep 2006 13:03] Magnus Blåudd
Related to #19561
[13 Nov 2006 13:35] Magnus Blåudd
Removing the "yassl_dummy_link_fix" wich is there to fool all our programs to be linked with g++ instead of gcc whcihc is the default if all source files are C.
As the intention is that libmysqlclient should be linkable from C.

This will hopefully allow us to detect these kind of errors earlier.
[13 Nov 2006 16:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/15253

ChangeSet@1.2299, 2006-11-13 17:16:37+01:00, msvensson@neptunus.(none) +4 -0
  Bug#19817 error when try to compile PHP5.1 with mysql 5.0.21 static libs
   - Most likely caused by linking with libmysqlclient using gcc and not g++.
   - Removing our "yassl_dummy_link_fix" hacks so some test programs are linked
     with gcc 
   - Remove build of non working test programs in vio
[13 Nov 2006 16:51] Magnus Blåudd
This should be fixed in our source repository now, see "Bug#19561 MySQL & PHP compile probilem"
[14 Nov 2006 22:44] George Hernando
This thread refers to version 5.0.21.
I'm experiencing the same problem on version 5.1.11 linux (fedora).
Is the 5.1 code base also updated now?
When do you expect that a linux distribution would be available for this fix?
[15 Nov 2006 10:34] Magnus Blåudd
Next release of 5.1 should work.
[11 Dec 2006 9:08] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix for 5.0.32 and 5.1.15.
[9 Jan 2007 15:55] Sveta Smirnova
Bug #25496 was marked as duplicate of this one
[10 Jan 2007 9:17] Sveta Smirnova
Bug #25354 has marked as duplicate of this one
[19 Feb 2007 13:56] Jan Marquardt
I try to compile PHP 5.2.1 with MySQL 5.0.27 and get following errors in config.log.

[...]
/usr/local/mysql/lib/libmysqlclient.a(ssl.o)(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x8): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o)(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0xc): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o)(.gnu.linkonce.d.__vt_Q25yaSSL7Message+0x10): undefined reference to `__pure_virtual'
[...]
[19 Feb 2007 14:26] Jan Marquardt
Same for PHP 4.4.5 and MySQL 5.0.27.
[24 Apr 2007 13:51] Jan Rasche
PHP 5.2.1 ./configure --with-mysql on OpenSuSE 10.2 x86_64

checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock
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.

int main() {
mysql_close()
; return 0; }
configure:58241: checking for mysql_error in -lmysqlclient
configure:58260: gcc -o conftest -I/usr/include -g -O2  -L/usr/lib  -Wl,-rpath,/usr/lib64 -L/usr/lib64 -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient  -lz -lmhash -lgmp -lndbm -lgdbm -lcurl -lbz2 -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -lidn -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz 1>&5
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libgdbm.so when searching for /usr/lib/libgdbm.so
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: cannot find /usr/lib/libgdbm.so
collect2: ld returned 1 exit status
configure: failed program was:
#line 58249 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_error();

int main() {
mysql_error()
; return 0; }