gethostbyname_r() (un)bug in MySQL source build

2003-01-23 Thread Michael Bacarella
Hope everyone's having fun at LinuxWorld.


I couldn't find any discussion of a solution for this (according
to Google, mysql.com search), other than at least a dozen reports
from people having trouble with it.  The bug is that the proper error
is not reported and at least I was sent on a wild goose chase.

In attempting to build MySQL 3.23.54a on a fresh Red Hat 8.0:

libmysql.c: In function `mysql_real_connect':
libmysql.c:1325: warning: passing arg 5 of `gethostbyname_r' from incompatible pointer 
type
libmysql.c:1325: too few arguments to function `gethostbyname_r'
libmysql.c:1325: warning: assignment makes pointer from integer without a cast

Very odd.  What ends up being generated in include/my_net.h is:

#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),

When it should be generating:

struct hostent *my_gethostbyname_r(const char *name,struct hostent
*result, char *buffer,int buflen, int *h_errnop);

It does not get generated because ./configure does not detect GLIBC2's
gethostbyname_r() even though it is there, and it is the six argument
version that ends up being called with five.

The problem actually has nothing to do with gethostbyname_r().

The problem is that g++ is not installed.  The configure test program
for gethostbyname_r() type depends on a C++ compiler, and ./configure is
not halting the process for lack of C++ compiler:

configure:19299: checking style of gethostname_r routines
configure:19347: g++ -c -O -DDBUG_OFFconftest.cc 5
./configure: line 1: g++: command not found
configure:19350: $? = 127
configure: failed program was:
#line 19316 configure
#include confdefs.h
#undef inline
#if !defined(SCO)  !defined(__osf__)  !defined(_REENTRANT)
#define _REENTRANT
#endif
#include pthread.h
#include sys/types.h
#include sys/socket.h
#include netinet/in.h
#include arpa/inet.h
#include netdb.h
#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
 extern C
#  endif
   int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
int skr;

 skr = gethostbyname_r((const char *) 0,
  (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, skr);
  ;
  return 0;
}

Solution?  Tell the user there is no C++ compiler if there is no C++ compiler.

-- 
Michael Bacarella  24/7 phone: 646 641-8662
Netgraft Corporation   http://netgraft.com/
  unique technologies to empower your business

Finger email address for public key.  Key fingerprint:
  C40C CB1E D2F6 7628 6308  F554 7A68 A5CF 0BD8 C055

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: gethostbyname_r() (un)bug in MySQL source build

2003-01-23 Thread Gelu Gogancea
Hi,
IMHO:
I think if you use autoheader it's possible to fix that according with your
glibc/compiler version.Also (...from what i remember what i saw in the
source code)  is used macros for checking GLIBC2 style.

Regards,

Gelu
_
G.NET SOFTWARE COMPANY

Permanent e-mail address : [EMAIL PROTECTED]
  [EMAIL PROTECTED]
- Original Message -
From: Michael Bacarella [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 4:23 PM
Subject: gethostbyname_r() (un)bug in MySQL source build


 Hope everyone's having fun at LinuxWorld.


 I couldn't find any discussion of a solution for this (according
 to Google, mysql.com search), other than at least a dozen reports
 from people having trouble with it.  The bug is that the proper error
 is not reported and at least I was sent on a wild goose chase.

 In attempting to build MySQL 3.23.54a on a fresh Red Hat 8.0:

 libmysql.c: In function `mysql_real_connect':
 libmysql.c:1325: warning: passing arg 5 of `gethostbyname_r' from
incompatible pointer type
 libmysql.c:1325: too few arguments to function `gethostbyname_r'
 libmysql.c:1325: warning: assignment makes pointer from integer without a
cast

 Very odd.  What ends up being generated in include/my_net.h is:

 #define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),

 When it should be generating:

 struct hostent *my_gethostbyname_r(const char *name,struct hostent
 *result, char *buffer,int buflen, int *h_errnop);

 It does not get generated because ./configure does not detect GLIBC2's
 gethostbyname_r() even though it is there, and it is the six argument
 version that ends up being called with five.

 The problem actually has nothing to do with gethostbyname_r().

 The problem is that g++ is not installed.  The configure test program
 for gethostbyname_r() type depends on a C++ compiler, and ./configure is
 not halting the process for lack of C++ compiler:

 configure:19299: checking style of gethostname_r routines
 configure:19347: g++ -c -O -DDBUG_OFFconftest.cc 5
 ./configure: line 1: g++: command not found
 configure:19350: $? = 127
 configure: failed program was:
 #line 19316 configure
 #include confdefs.h
 #undef inline
 #if !defined(SCO)  !defined(__osf__)  !defined(_REENTRANT)
 #define _REENTRANT
 #endif
 #include pthread.h
 #include sys/types.h
 #include sys/socket.h
 #include netinet/in.h
 #include arpa/inet.h
 #include netdb.h
 #ifdef F77_DUMMY_MAIN
 #  ifdef __cplusplus
  extern C
 #  endif
int F77_DUMMY_MAIN() { return 1; }
 #endif
 int
 main ()
 {
 int skr;

  skr = gethostbyname_r((const char *) 0,
   (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, skr);
   ;
   return 0;
 }

 Solution?  Tell the user there is no C++ compiler if there is no C++
compiler.

 --
 Michael Bacarella  24/7 phone: 646 641-8662
 Netgraft Corporation   http://netgraft.com/
   unique technologies to empower your business

 Finger email address for public key.  Key fingerprint:
   C40C CB1E D2F6 7628 6308  F554 7A68 A5CF 0BD8 C055

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php