php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21831 PHP fails to build on MySQL section
Submitted: 2003-01-22 21:37 UTC Modified: 2003-02-03 06:16 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: jason at devrandom dot org Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.0 OS: Linux/Redhat 8.0.92
Private report: No CVE-ID: None
 [2003-01-22 21:37 UTC] jason at devrandom dot org
  Not sure if this is a problem of my own making or not, but something I've been profoundly frustrated with.  I'm running Redhat 8.0.92 (Phoebe - Beta) with Apache 2.0.44 (tried .43 as well) and MySQL.  I run into what appears to be the same error whether I use --with-mysql=/path/to/mysql or leave it built with the internal MySQL access libraries.  

  When using the following build string:

./configure --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql/ --with-gettext --with-zlib --enable-track-vars --enable-force-cgi-redirect

I get the following results:

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.

Inside config.log I see:

configure:47975: gcc -o conftest -g -O2
    -L/opt/mysql//lib
    conftest.c -lmysqlclient  -lz -lcrypt -lresolv -lm -ldl -lnsl  -lcrypt 1>&5
/opt/mysql//lib/libmysqlclient.a(my_malloc.o)(.text+0x28): In function `my_mallo
c':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_realloc.o)(.text+0x65): In function `my_real
loc':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_lib.o)(.text+0x2e1): In function `my_dir':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_lib.o)(.text+0x3d1): In function `my_stat':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_getwd.o)(.text+0x44): In function `my_getwd'
:
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_getwd.o)(.text+0xce): more undefined referen
ces to `errno' follow
collect2: ld returned 1 exit status
configure: failed program was:
#line 47964 "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_close();

int main() {
mysql_close()
; return 0; }
configure:48102: checking for mysql_error in -lmysqlclient
configure:48121: gcc -o conftest -g -O2
        -L/usr/lib -L/opt/mysql//lib
        -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient  -lz -lz -lcrypt -lresol
v -lm -ldl -lnsl  -lcrypt 1>&5
/opt/mysql//lib/libmysqlclient.a(my_malloc.o)(.text+0x28): In function `my_mallo
c':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_realloc.o)(.text+0x65): In function `my_real
loc':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_lib.o)(.text+0x2e1): In function `my_dir':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_lib.o)(.text+0x3d1): In function `my_stat':
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_getwd.o)(.text+0x44): In function `my_getwd'
:
: undefined reference to `errno'
/opt/mysql//lib/libmysqlclient.a(my_getwd.o)(.text+0xce): more undefined referen
ces to `errno' follow
collect2: ld returned 1 exit status
configure: failed program was:
#line 48110 "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; }

If I build without the --with-mysql=/opt/mysql, the configure script completes correctly but during 'make' I get the following error:

ext/mysql/libmysql/my_tempnam.lo(.text+0x4c): In function `my_tempnam':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp'
ext/mysql/libmysql/my_lib.lo(.text+0x3d1): In function `my_dir':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_lib.c:169: undefined reference to `errno'
ext/mysql/libmysql/my_lib.lo(.text+0x5ef): In function `my_stat':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_lib.c:588: undefined reference to `errno'
ext/mysql/libmysql/my_malloc.lo(.text+0xde): In function `my_malloc':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_malloc.c:24: undefined reference to `errno'
ext/mysql/libmysql/my_realloc.lo(.text+0xd5): In function `my_realloc':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_realloc.c:44: undefined reference to `errno'
ext/mysql/libmysql/my_delete.lo(.text+0x86): In function `my_delete':
/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_delete.c:16: undefined reference to `errno'
ext/mysql/libmysql/my_tempnam.lo(.text+0x89):/home/downloads/web/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:108: more undefined references to `errno' follow
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1


As I said, I'm not sure if this isn't a problem with RH 8.0.92 but I've complied many other things succesfully.  Please let me know if I can be of any help testing.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-22 21:40 UTC] jason at devrandom dot org
Had marked in configuration as opposed to compile by accident.
 [2003-01-22 21:51 UTC] sniper@php.net
What gcc version?
And does this work:

# rm config.cache
# make clean
# ./configure
# make

??


 [2003-01-23 06:19 UTC] jason at devrandom dot org
No, that didn't work.  I've done that before but tried again just to 
make sure I wasn't crazy.  I'm using GCC 3.2.1 which is the 
default package on RH 8.0.92
 [2003-01-23 10:16 UTC] sniper@php.net
Was mysql compiled with the same compiler?
And WHAT version of mysql is it?

 [2003-01-23 14:37 UTC] jason at devrandom dot org
The MySQL is MySQL 4.0.9.  This configuration (GCC 3.2 + Apache 2.0.44 + MySQL 4.0.9 + PHP 4.3.0) seems to compile and run fine on Redhat 8.0.  RH8 ships with GCC 3.2 not 3.2.1 however.  I guess I'm just trying to get a feel for this being a PHP thing or a RedHat thing.  As I said before, I've compiled all sorts of other things on 8.0.92 and hadn't run into any compatability problems.  Thanks!
 [2003-01-29 01:54 UTC] duke at mastre dot com
It's not gcc, it's libc6 2.3.1-38; errno breaks quite a few packages at anything newer than 2.3.1-5 (standard 8.0?).

Snapshot does not fix this, as this is a problem with the pre-packaged MySQL binaries and not PHP.

Quick fix:  grab the mysql 4.0.9 sources, patch using my patch at the end of this message and build/install it somewhere; you can still use their supplied binaries to run the actual mysql server, but you need a proper libmysqlclient to link PHP against.

Then PHP 4.3.0 will build w/o incident.


configure mysql as such:
CFLAGS="-O2 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O2 -mcpu=pentiumpro -felide-constructors" ./configure --prefix=/usr/src/mysql-4.0.9-gamma-libc6-2.3.1-6+ --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --without-innodb

then use --with-mysql=../mysql-4.0.9-gamma-libc6-2.3.1-6+ for configuring PHP

Patch:
--- mysql-4.0.9-gamma.vanilla/bdb/examples_c/ex_thread.c        Thu Jan  9 04:35:18 2003
+++ mysql-4.0.9-gamma/bdb/examples_c/ex_thread.c        Wed Jan 29 02:29:03 2003
@@ -99,7 +99,8 @@
        char *argv[];
 {
        extern char *optarg;
-       extern int errno, optind;
+/*     extern int errno, optind;       */
+       extern optind;
        pthread_t *tids;
        int ch, i, ret;
        char *home;
--- mysql-4.0.9-gamma.vanilla/include/my_sys.h  Thu Jan  9 04:35:22 2003
+++ mysql-4.0.9-gamma/include/my_sys.h  Wed Jan 29 02:30:12 2003
@@ -192,11 +192,7 @@
 #endif
 #endif /* MSDOS */
 
-#ifdef HAVE_ERRNO_AS_DEFINE
 #include <errno.h>                     /* errno is a define */
-#else
-extern int errno;                      /* declare errno */
-#endif
 extern const char ** NEAR my_errmsg[];
 extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
 extern char *home_dir;                 /* Home directory for user */
--- mysql-4.0.9-gamma.vanilla/readline/bind.c   Thu Jan  9 04:35:21 2003
+++ mysql-4.0.9-gamma/readline/bind.c   Wed Jan 29 02:31:37 2003
@@ -45,10 +45,6 @@
 #include <signal.h>
 #include <errno.h>
 
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
 #include "posixstat.h"

 /* System-specific feature definitions and include files. */
--- mysql-4.0.9-gamma.vanilla/readline/complete.c       Thu Jan  9 04:35:22 2003
+++ mysql-4.0.9-gamma/readline/complete.c       Wed Jan 29 02:31:06 2003
@@ -44,9 +44,6 @@
 #include <stdio.h>
 
 #include <errno.h>
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
 
 #include <pwd.h>
 #if !defined (HAVE_GETPW_DECLS)
--- mysql-4.0.9-gamma.vanilla/readline/histfile.c       Thu Jan  9 04:35:17 2003
+++ mysql-4.0.9-gamma/readline/histfile.c       Wed Jan 29 02:31:24 2003
@@ -65,9 +65,6 @@
 #endif /* !__EMX__ */
 
 #include <errno.h>
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
 
 #include "history.h"
 #include "histlib.h"
--- mysql-4.0.9-gamma.vanilla/readline/input.c  Thu Jan  9 04:35:18 2003
+++ mysql-4.0.9-gamma/readline/input.c  Wed Jan 29 02:31:50 2003
@@ -57,10 +57,6 @@
 #include <stdio.h>
 #include <errno.h>
 
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 
--- mysql-4.0.9-gamma.vanilla/readline/rltty.c  Thu Jan  9 04:35:17 2003
+++ mysql-4.0.9-gamma/readline/rltty.c  Wed Jan 29 02:30:45 2003
@@ -44,10 +44,6 @@
 #include "rltty.h"
 #include "readline.h"

-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
 extern int readline_echoing_p;
 extern int _rl_eof_char;
 [2003-01-29 23:11 UTC] duke at mastre dot com
BTW, I made the patch available for download here:

  http://www.mastre.com/unsupported/patches/
 [2003-02-03 06:16 UTC] sniper@php.net
Living on the edge sometimes really isn't worth it..
Not PHP bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 04:01:28 2024 UTC