Bug #12023 Compile error in libmysql.c

Submitted: 18 Jul 2005 23:02 Modified: 22 Aug 2005 20:52
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:4.0.25 OS:Linux (Mandriva 2005)
Assigned to: CPU Architecture:Any

[18 Jul 2005 23:02] [ name withheld ]
Description:
Compiled fine on our older Mandrake 10.0 systems, but on our next-gen Mandriva 2005 box, we ran into a compile error as seen below.  Downgrading GCC to 3.2.x did not solve the problem.

System Info:
Linux 2.6.11-6mdk
gcc (GCC) 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk)
glibc-2.3.4-8mdk

Compile settings:
CFLAGS="-Oc -march=" CXX="gcc" CXXFLAGS="-Oc -march=athlon-4 -felide-constructors -fno-exceptions -fno-rtti" ./configure  --with-mysqld-ldflags=-all-static --enable-assembler --with-big-tables --with-jpeg-dir=/usr/local

[...]

make[1]: Entering directory `/usr/local/src/mysql-4.0.25/libmysql'
if /bin/sh ../libtool --preserve-dup-deps --mode=compile gcc -DDEFAULT_CHARSET_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -DSHAREDIR="\"/usr/local/share/mysql\"" -DUNDEF_THREADS_HACK -DDONT_USE_RAID  -DMYSQL_CLIENT -I. -I. -I.. -I./../include -I../include -I./.. -I.. -I..     -O3 -DDBUG_OFF -Os -march=athlon-4   -MT libmysql.lo -MD -MP -MF ".deps/libmysql.Tpo" -c -o libmysql.lo libmysql.c; \
then mv -f ".deps/libmysql.Tpo" ".deps/libmysql.Plo"; else rm -f ".deps/libmysql.Tpo"; exit 1; fi
 gcc -DDEFAULT_CHARSET_HOME=\"/usr/local\" -DDATADIR=\"/usr/local/var\" -DSHAREDIR=\"/usr/local/share/mysql\" -DUNDEF_THREADS_HACK -DDONT_USE_RAID -DMYSQL_CLIENT -I. -I. -I.. -I./../include -I../include -I./.. -I.. -I.. -O3 -DDBUG_OFF -Os -march=athlon-4 -MT libmysql.lo -MD -MP -MF .deps/libmysql.Tpo -c libmysql.c  -fPIC -DPIC -o .libs/libmysql.o
libmysql.c: In function `mysql_real_connect':
libmysql.c:1862: warning: passing arg 5 of `gethostbyname_r' from incompatible pointer type
libmysql.c:1862: error: too few arguments to function `gethostbyname_r'
libmysql.c:1862: warning: assignment makes pointer from integer without a cast
make[1]: *** [libmysql.lo] Error 1
make[1]: Leaving directory `/usr/local/src/mysql-4.0.25/libmysql'
make: *** [install-recursive] Error 1

How to repeat:
Take a stock install of Mandriva 2005 on an AMD system, try to compile a stock download of MySQL 4.0.25 source with flags as seen above.
[18 Jul 2005 23:33] [ name withheld ]
After extensive googling, I found a fix at <http://circle.ch/blog/index.php?p=727&tb=1>

in config.h, make the following changes:

/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines
this with 6 arguments */
/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */
#define HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1
[22 Aug 2005 19:29] Hartmut Holzgraefe
were you building from a freshly unpacked source archive or reusing a source tree that had already been used on another machine? (just want to make sure you are not tricked by the "configure" cache mechanism ...)
[22 Aug 2005 20:52] [ name withheld ]
I download a completely fresh mysql-4.0.25 and it compiled properly, so looks like you were right about the configuration from a previous build being cached.  Changing "make clean" to "make distclean" in our build scripts, and apologies for taking your time with this.

Thanks for a great product!

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.