Bug #34292 netdb.h missing in hostname.cc
Submitted: 4 Feb 2008 19:03 Modified: 17 Jun 13:23
Reporter: Susanne Ebrecht
Status: Closed
Category:Server: Compiling Severity:S3 (Non-critical)
Version:6.0-bk OS:FreeBSD (7.0 AMD 64)
Assigned to: Target Version:6.0-beta
Triage: Triaged: D1 (Critical)

[4 Feb 2008 19:03] Susanne Ebrecht
Description:
if gcc -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/home/miracee/mysql60bk\""
-DDATADIR="\"/usr/home/miracee/mysql60bk/var\""
-DSHAREDIR="\"/usr/home/miracee/mysql60bk/share/mysql\""
-DLIBDIR="\"/usr/home/miracee/mysql60bk/lib/mysql\"" -DHAVE_CONFIG_H -I. -I. -I../include
-I../include -I../include -I../regex -I.      -g  -DSAFE_MUTEX -Wimplicit -Wreturn-type
-Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare
-Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable
-Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti 
-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS  -DSAFEMALLOC
-DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized   -fno-implicit-templates
-fno-exceptions -fno-rtti -DMYSQLD_NET_RETRY_COUNT=1000000 -MT hostname.o -MD -MP -MF
".deps/hostname.Tpo" -c -o hostname.o hostname.cc; \
        then mv -f ".deps/hostname.Tpo" ".deps/hostname.Po"; else rm -f
".deps/hostname.Tpo"; exit 1; fi
hostname.cc: In function 'char* ip_to_hostname(sockaddr_storage*, int, uint*)':
hostname.cc:238: error: 'EAI_ADDRFAMILY' was not declared in this scope
hostname.cc:238: error: 'EAI_NODATA' was not declared in this scope
gmake[3]: *** [hostname.o] Error 1
gmake[3]: Leaving directory `/usr/home/miracee/mysql60bksrc/sql'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/usr/home/miracee/mysql60bksrc/sql'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/usr/home/miracee/mysql60bksrc/sql'
gmake: *** [all-recursive] Error 1

How to repeat:
./BUILD/compile-amd64-debug-max on FreeBSD, using gcc 4.2

Suggested fix:
I would say, add: #include netdb.h
[4 Feb 2008 20:08] Hartmut Holzgraefe
FreeBSDs /usr/include/netdb.h doesn't define EAI_ADDRFAMILY
but marks it as obsoleted instead:

  #if 0
  /* obsoleted */
  #define EAI_ADDRFAMILY   1      /* address family for hostname not supported */
  #endif

See also: http://archives.postgresql.org/pgsql-hackers/2003-05/msg00574.php
[6 Feb 2008 12:26] Brian Aker
Looking into this.
[13 Mar 2008 17:37] Bugs System
Pushed into 6.0.4-alpha
[13 Mar 2008 18:32] Brian Aker
Freebsd should be fine now.
[16 Mar 2008 11:39] MC Brown
A note has been added to the 6.0.4 changelog: 

Compiling MySQL on FreeBSD would fail due to missing definitions for certain network
constants.
[25 Mar 2008 16:21] Brian Aker
Fixed previous issue, looks like more issues exist for FreeBSD 7.0. We don't have 7.0 in
pushbuild though... so I have started a download and will test everything directly
(instead of doing this piecemeal through Susanne issuing bugs for each needed change).
[17 Apr 2008 22:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/45580

ChangeSet@1.2619, 2008-04-17 22:54:31+02:00, jperkin@mysql.com +8 -0
  Various build fixes for 6.0.5-alpha
  
  SyncObject.cpp:
    #include <string.h> for strlen()
  plug.in, Makefile.am, configure.in:
    CXXFLAGS is a user variable, you should not override it;
    use AM_CXXFLAGS instead.
  hostname.cc:
    EAI_NODATA was deprecated in RFC3493, and at least FreeBSD
    has removed it in favour of EAI_NONAME, so handle that
    case.  May fix bug#34292.
  libevent.m4:
    Wrap AH_VERBATIM sections within HAVE_LIBEVENT as
    they are defined unconditionally and break if
    libevent is not used.
  azio.h:
    No comma for final enum.
[17 Mar 16:49] Daniel Fischer
I can't reproduce this anymore. I know that several build issues were fixed on FreeBSD 7
independent of this bug report, and a gcc 4.2.1 build on FreeBSD 7 now regularly passes
in integration testing. If the problem persists, please re-open.
[17 Mar 17:40] Susanne Ebrecht
Feel free to close it. It really seems to be fixed.
[17 Jun 13:23] Lars Heill
Closing as per last comments.