Bug #34292 netdb.h missing in hostname.cc
Submitted: 4 Feb 2008 18:03 Modified: 6 Mar 2010 20:21
Reporter: Susanne Ebrecht Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:6.0-bk OS:FreeBSD (7.0 AMD 64)
Assigned to: CPU Architecture:Any

[4 Feb 2008 18: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 19: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 11:26] Brian Aker
Looking into this.
[13 Mar 2008 16:37] Bugs System
Pushed into 6.0.4-alpha
[13 Mar 2008 17:32] Brian Aker
Freebsd should be fine now.
[16 Mar 2008 10: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 15: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 20: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 2009 15: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 2009 16:40] Susanne Ebrecht
Feel free to close it. It really seems to be fixed.
[17 Jun 2009 11:23] Lars Heill
Closing as per last comments.
[3 Dec 2009 9:08] Bugs System
Pushed into 5.6.0-beta (revid:alik@sun.com-20091202160026-699xnqx8c6a6t2lk) (version source revid:alik@sun.com-20091125105323-j82ts9ns936i45vv) (merge vers: 5.6.0-beta) (pib:13)
[3 Dec 2009 9:10] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091202161413-u81nw1foglcu7nao) (version source revid:alik@sun.com-20091125105553-vvedtv1bpmugb1nj) (merge vers: 6.0.14-alpha) (pib:13)
[7 Dec 2009 14:01] MC Brown
Also added entries to 5.6.0 and 6.0.14.
[6 Mar 2010 11:00] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:wlad@sol-20091204200504-9d3d3b6ad75ijkqo) (merge vers: 5.6.0-beta) (pib:16)
[6 Mar 2010 20:21] Paul DuBois
Moved 5.6.0 changelog entry to 5.5.3.