Bug #19561 MySQL & PHP compile probilem
Submitted: 5 May 2006 13:07 Modified: 13 Nov 2006 16:11
Reporter: Okulov Vitaliy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.22, 5.0.21 OS:Linux (Gentoo Linux 2006)
Assigned to: Magnus Blåudd CPU Architecture:Any

[5 May 2006 13:07] Okulov Vitaliy
Description:
Description:
------------
Just install new mysql from binary package which I download from
mysql.com. Configure fail.

How to repeat:

Reproduce code:
---------------
Config:

#!/bin/sh
./configure --enable-safe-mode --with-apxs2=/usr/local/apache2/bin/apxs
\
--enable-libxml \
--with-openssl=shared \
--with-zlib=shared \
--enable-bcmath=shared \
--with-bz2=shared \
--enable-calendar=shared \
--enable-ftp=shared \
--with-gd=shared \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-ttf \
--with-freetype-dir \
--enable-gd-native-ttf \
--with-gettext=shared \
--enable-mbstring=shared \
--with-mcrypt=shared \
--with-mhash=shared \
--with-mysql=/usr/local/mysql \
--enable-sockets=shared \
--enable-memory-limit \
--enable-inline-optimization \
--with-regex=shared \
--enable-mbregex=shared \
--with-pcre-regex=shared \
--enable-session=shared \
--with-xsl \
--without-sqlite \
--with-curl=shared \
--with-curlwrappers \
--with-xmlrpc \
--with-ming=shared \
--with-mime-magic=shared \
--enable-dom \
--enable-pdo=shared \
--with-pdo-mysql=shared,/usr/local/mysql \
--with-sqlite=shared \
--with-pdo-sqlite=shared \
--with-mssql=shared

Config.log:

configure:58792: gcc -o conftest -I/usr/include -g -O2 
-Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -L/usr/lib 
-Wl,-rpath,/usr -L/usr conftest.c
-lmysqlclient  -lz -lm -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2
-lz -lm 1>&5
/usr/local/mysql/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25ya
SSL7Message+0x8): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25ya
SSL7Message+0xc): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25ya
SSL7Message+0x10): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25ya
SSL7Message+0x14): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(ssl.o):(.gnu.linkonce.d.__vt_Q25ya
SSL7Message+0x18): undefined reference to `__pure_virtual'
/usr/local/mysql/lib/libmysqlclient.a(cert_wrapper.o): In function
`yaSSL::x509::~x509(void)':
cert_wrapper.cpp:(.text+0x53): undefined reference to
`__builtin_delete'
/usr/local/mysql/lib/libmysqlclient.a(cert_wrapper.o): In function
`yaSSL::CertManager::~CertManager(void)':
cert_wrapper.cpp:(.text+0x275): undefined reference to
`__builtin_delete'
/usr/local/mysql/lib/libmysqlclient.a(template_instnt.o): In function
`mySTL::list<yaSSL::SSL_SESSION *>::~list(void)':
template_instnt.cpp:(.gnu.linkonce.t._._Q25mySTLt4list1ZPQ25yaSSL11SSL_S
ESSION+0x32): undefined reference to `__builtin_delete'
/usr/local/mysql/lib/libmysqlclient.a(template_instnt.o): In function
`mySTL::list<yaSSL::input_buffer *>::~list(void)':
template_instnt.cpp:(.gnu.linkonce.t._._Q25mySTLt4list1ZPQ25yaSSL12input
_buffer+0x32): undefined reference to `__builtin_delete'
/usr/local/mysql/lib/libmysqlclient.a(template_instnt.o): In function
`mySTL::list<yaSSL::output_buffer *>::~list(void)':
template_instnt.cpp:(.gnu.linkonce.t._._Q25mySTLt4list1ZPQ25yaSSL13outpu
t_buffer+0x32): undefined reference to `__builtin_delete'
/usr/local/mysql/lib/libmysqlclient.a(template_instnt.o):template_instnt
.cpp:(.gnu.linkonce.t._._Q25mySTLt4list1ZPUc+0x32): more undefined
references to `__b
uiltin_delete' follow

And so on.
[6 May 2006 6:54] Okulov Vitaliy
There is mysqlbug output:

SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
From: doktor
To: mysql@lists.mysql.com
Subject: [50 character or so descriptive subject here (for reference)]

>Description:
        <precise description of the problem (multiple lines)>
>How-To-Repeat:
        <code/input/activities to reproduce the problem (multiple lines)>
>Fix:
        <how to correct or work around the problem, if known (multiple lines)>

>Submitter-Id:  <submitter ID>
>Originator:    V.Okulov
>Organization:
 <organization of PR author (multiple lines)>
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:      <synopsis of the problem (one line)>
>Severity:      <[ non-critical | serious | critical ] (one line)>
>Priority:      <[ low | medium | high ] (one line)>
>Category:      mysql
>Class:         <[ sw-bug | doc-bug | change-request | support ] (one line)>
>Release:       mysql-5.0.19 (Source distribution)

>C compiler:    gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
>C++ compiler:  g++ (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
>Environment:
        <machine, os, target, libraries (multiple lines)>
System: Linux devel 2.6.15-gentoo-r1 #2 SMP Wed Mar 1 16:20:42 MSK 2006 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: /var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.4 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.4/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include/g++-v3 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
Compilation info: CC='gcc'  CFLAGS=''  CXX='g++'  CXXFLAGS=''  LDFLAGS=''  ASFLAGS=''
LIBC:
lrwxrwxrwx  1 root root 13 Feb 27 02:48 /lib/libc.so.6 -> libc-2.3.5.so
-rwxr-xr-x  1 root root 1219264 Feb 14 09:55 /lib/libc-2.3.5.so
-rw-r--r--  1 root root 2644830 Feb 14 09:55 /usr/lib/libc.a
-rwxr-xr-x  1 root root 204 Feb 14 09:55 /usr/lib/libc.so
Configure command: ./configure '--enable-assembler' '--with-unix-socket-path=/tmp/mysql.sock' '--prefix=/usr/local/mysql' '--with-charset=cp1251' '--with-collation=cp1251_general_ci' '--with-extra-charsets=complex' '--enable-thread-safe-client' '--with-innodb' '--with-big-tables'
[12 May 2006 12:33] Valeriy Kravchuk
Looks like a duplucate of Bug #19289. Please, check.
[12 Jun 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[20 Jun 2006 16:03] Ulf Wendel
PHP config.log

Attachment: config.log.tar.gz (application/x-gzip, text), 21.02 KiB.

[20 Jun 2006 16:03] Ulf Wendel
I'm not sure if this is a duplicate for #19289, I'm sceptical. #19289 is not on compile problems, is it?

I can reproduce the configure error messages with some versions of MySQL 5.0.22 (mysql-standard-5.0.22-linux-i686) and PHP 5.1.4. The __builtin_delete / __pure_virtual error messages can be fixed by adding -lmygcc to the correspondending gcc call. 

During configure, PHP does the following test:

gcc -o conftest -I/usr/include -g -O2  -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib -L/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lnss_files -lnss_dns -lresolv -lnss_files -lnss_dns -lresolv conftest.c -lmysqlclient  -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5

This gcc fails as shown by the uploaded config.log. It does not fail, if you add -lmygcc (if you have that lib on your system) to the gcc call. See also the comments on http://bugs.php.net/bug.php?id=37388 . 

The small test program that fails to compile during the configure run of PHP is:

linux-fupx:/home/nixnutz/php-5.1.4 # cat conftest.c
/* 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_set_server_option();

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

It compiles fine if you use -lmygcc as explained above:

linux-fupx:/home/nixnutz/php-5.1.4 # gcc -o conftest -I/usr/include -g -O2  -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib -L/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lnss_files -lnss_dns -lresolv -lnss_files -lnss_dns -lresolv conftest.c -lmysqlclient  -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm -lmygcc
linux-fupx:/home/nixnutz/php-5.1.4 #    

And it fails to compile, if you omit the flag:

linux-fupx:/home/nixnutz/php-5.1.4 # gcc -o conftest -I/usr/include -g -O2  -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib -L/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lnss_files -lnss_dns -lresolv -lnss_files -lnss_dns -lresolv conftest.c -lmysqlclient  -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm
/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(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

Note that if I compile PHP against a different MySQL binary distribution (mysql-standard-5.0.22-linux-i686-glibc23, mysql-debug-5.0.22-linux-i686-glibc23) using --with-mysqli=/usr/local/ysql-debug-5.0.22-linux-i686-glibc23/bin/mysql_config, it works. The same is true for a source distribution of MySQL.
[20 Jun 2006 16:07] Ulf Wendel
Ulf: mysqlbug, uname -a, rpm -q gcc, rpm -q glibc

Attachment: mysqlbug (application/octet-stream, text), 3.38 KiB.

[22 Jun 2006 11:35] Alexandre Dulaunoy
I got the exact same issue when configuring a PHP 5.1.4 against MySQL 5.0.22-standard (static). But with the glibc version (non static), it works well.

Linux (thenameofthesystem) 2.6.11-1.14_FC3smp #1 SMP Thu Apr 7 19:38:19 EDT 2005 i686 i686 i386 GNU/Linux

 gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)

For your information.
[18 Jul 2006 17:50] Valeriy Kravchuk
Looks like mysql_config --libs should include -lmygcc for the static builds of MySQL.
[4 Sep 2006 13:04] Magnus Blåudd
Related to #19817
[13 Nov 2006 16:11] Magnus Blåudd
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
[13 Nov 2006 16:13] Magnus Blåudd
[msvensson@neptunus mysql-5.0-maint]$ ./configure  --disable-shared --with-yassl && make
[msvensson@neptunus php-5.2.0]$ ./configure --with-mysql=../mysql-5.0-maint/libmysql/ --with-openssl=shared --with-curl=shared  && make
[msvensson@neptunus php-5.2.0]$ sapi/cli/php -v
PHP 5.2.0 (cli) (built: Nov 13 2006 16:59:33) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies