MySQL compile error: gethostbyname_r

To come around those errors:

libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r\’ from incompatible pointer type
libmysql.c:1329: too few arguments to function `gethostbyname_r\’
libmysql.c:1329: warning: assignment makes pointer from integer without a cast
make[2]: *** [libmysql.lo] Error 1

… I had to edit config.h like this:

/* 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

It is mainly a gcc problem, but I found [1] no other way round; until that:

me:~# apt-get install g++-2.95
Reading Package Lists… Done
Building Dependency Tree… Done
The following extra packages will be installed:
cpp-2.95 g++ g++-3.2 gcc-2.95 libstdc++2.10-dev libstdc++5-dev
The following NEW packages will be installed:
cpp-2.95 g++ g++-2.95 g++-3.2 gcc-2.95 libstdc++2.10-dev libstdc++5-dev
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.[..]

After probably an hour of compilation it results in this; which is quite positive:
me:/usr/local/src/archives/mysql-4.1.0-alpha# mysql -V
mysql Ver 13.5 Distrib 4.1.0-alpha, for unknown-linux (powerpc)

[1] http://www.mysql.com/doc/en/Compilation_problems.html

Leave a Reply