Bug 2114 - Android requires sys/socket.h to be included before sys/un.h.
Summary: Android requires sys/socket.h to be included before sys/un.h.
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 6.2p1
Hardware: Other Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_6_3
  Show dependency treegraph
 
Reported: 2013-06-02 09:16 AEST by Nathan Osman
Modified: 2015-08-11 23:02 AEST (History)
1 user (show)

See Also:


Attachments
Performs an explicit check for sys/un.h with the appropriate #includes. (519 bytes, patch)
2013-06-02 09:16 AEST, Nathan Osman
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Osman 2013-06-02 09:16:25 AEST
Created attachment 2290 [details]
Performs an explicit check for sys/un.h with the appropriate #includes.

I freely confess that this is one of the most bizarre things I have ever seen. Android's sys/un.h header uses sa_family_t in the sockaddr_un struct but neither defines it nor includes a header that does.

This leads to the following warning when running ./configure:

  configure: WARNING: sys/un.h: present but cannot be compiled
  configure: WARNING: sys/un.h:     check for missing prerequisite headers?
  configure: WARNING: sys/un.h: see the Autoconf documentation
  configure: WARNING: sys/un.h:     section "Present But Cannot Be Compiled"
  configure: WARNING: sys/un.h: proceeding with the compiler's result
  configure: WARNING:     ## ------------------------------------------- ##
  configure: WARNING:     ## Report this to openssh-unix-dev@mindrot.org ##
  configure: WARNING:     ## ------------------------------------------- ##

Thankfully this struct is defined in sys/socket.h. I have attached a patch that explicitly runs AC_CHECK_HEADERS with the appropriate parameters to ensure sys/un.h is detected properly. No actual source code needed to be modified.
Comment 1 Darren Tucker 2013-06-02 09:21:40 AEST
(In reply to Nathan Osman from comment #0)
> I freely confess that this is one of the most bizarre things I have
> ever seen.

It's actually common on older platforms.  That header (plus some of the netinet ones) neither include what they need nor protect themselves from being included multiple times which makes them a pain to use.  Autoconf never used to care, but a couple of years ago that warning was added.

Added to the list.
Comment 2 Darren Tucker 2013-06-03 01:59:30 AEST
Applied, thanks.
Comment 3 Damien Miller 2015-08-11 23:02:47 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1