Bug 2085 - fd_mask and howmany are not defined in Android
Summary: fd_mask and howmany are not defined in Android
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 6.2p1
Hardware: All Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_6_3
  Show dependency treegraph
 
Reported: 2013-04-05 05:16 AEDT by Nathan Osman
Modified: 2015-08-11 23:05 AEST (History)
3 users (show)

See Also:


Attachments
adds appropriate definitions when cross-compiling for Android (566 bytes, patch)
2013-04-05 05:16 AEDT, Nathan Osman
no flags Details | Diff
adds appropriate definitions when cross-compiling for Android [fixed] (538 bytes, patch)
2013-04-05 05:35 AEDT, Nathan Osman
no flags Details | Diff
adds appropriate definitions when cross-compiling for Android [fixed again] (543 bytes, patch)
2013-04-05 10:18 AEDT, Nathan Osman
no flags Details | Diff
adds appropriate definitions when cross-compiling for Android [fixed yet again] (544 bytes, patch)
2013-04-05 10:26 AEDT, Nathan Osman
no flags Details | Diff
add real configure tests for NFDBITS, howmany and fd_mask (2.86 KB, patch)
2013-05-30 09:34 AEST, Darren Tucker
djm: ok+
Details | Diff
tests for NFDBITS, howmany and fd_mask take 2 (2.81 KB, patch)
2013-05-30 14:55 AEST, Tim Rice
no flags Details | Diff
tests for NFDBITS, howmany and fd_mask take 3 (2.74 KB, patch)
2013-05-30 14:59 AEST, Tim Rice
no flags Details | Diff
Fixes improper definition names in config.h.in (407 bytes, patch)
2013-06-01 17:19 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-04-05 05:16:23 AEDT
Created attachment 2230 [details]
adds appropriate definitions when cross-compiling for Android

This is the first of a few patches that I will be submitting - I am attempting to get OpenSSH to cross-compile for the Android platform.

Android does not define fd_mask or howmany - and therefore channels.c:2143 and channels.c:2145 cause compilation to fail with errors:

  channels.c: In function 'channel_prepare_select':
  channels.c:2143:2: warning: implicit declaration of function 'howmany' [-Wimplicit-function-declaration]
  channels.c:2145:45: error: 'fd_mask' undeclared (first use in this function)

The attached patch adds a couple of definitions that will work around this problem.
Comment 1 Nathan Osman 2013-04-05 05:35:23 AEDT
Created attachment 2231 [details]
adds appropriate definitions when cross-compiling for Android [fixed]

Sorry, there was a formatting bug with the original patch - this one replaces it.
Comment 2 Nathan Osman 2013-04-05 10:18:44 AEDT
Created attachment 2235 [details]
adds appropriate definitions when cross-compiling for Android [fixed again]

Sorry, I'm having a bad day. I forgot the ';;' at the end of the androideabi section. This corrected patch should fix everything (I hope).
Comment 3 Nathan Osman 2013-04-05 10:26:45 AEDT
Created attachment 2236 [details]
adds appropriate definitions when cross-compiling for Android [fixed yet again]

This is terribly embarrassing - but this time I've started from a completely clean copy of the source code and applied the patch. I've gone to great lengths to ensure you won't see any errors this time around.

THIS ONE SHOULD WORK.

Sorry for being a nuisance.
Comment 4 Darren Tucker 2013-05-10 14:05:29 AEST
Thanks, we'll put this on the list for the 6.3 release.
Comment 5 Darren Tucker 2013-05-30 09:34:03 AEST
Created attachment 2276 [details]
add real configure tests for NFDBITS, howmany and fd_mask

Rather than continuing to propagate these platform-specific settings I think we should make them real tests so that we don't have to do this again.  Does this work for you? (note you'll need to run "autoreconf" to rebuild configure before running it).
Comment 6 Tim Rice 2013-05-30 14:55:57 AEST
Created attachment 2278 [details]
tests for NFDBITS, howmany and fd_mask take 2

A good start.
I needed to add sysmacros.h to find howmany on SVR5 platforms.
fd_mask is a typedef so we need to use AC_CHECK_TYPES

Other than that, it's OK
Comment 7 Tim Rice 2013-05-30 14:59:49 AEST
Created attachment 2279 [details]
tests for NFDBITS, howmany and fd_mask take 3

Opps, uploaded the wrong one before.
Comment 8 Nathan Osman 2013-06-01 15:49:36 AEST
I tried applying your patch but now I get undefined reference to 'howmany' errors again:

  in function ssh_connect:sshconnect.c:270: error: undefined reference to 'howmany'
  in function ssh_exchange_identification:sshconnect.c:468: error: undefined reference to 'howmany'
  in function channel_prepare_select:channels.c:2143: error: undefined reference to 'howmany'
  in function packet_write_wait:packet.c:1734: error: undefined reference to 'howmany'
Comment 9 Nathan Osman 2013-06-01 17:18:28 AEST
I think I found the source of the problem. In config.h.in, the definition names missed getting updated. I am attaching a supplementary patch that fixes this.
Comment 10 Nathan Osman 2013-06-01 17:19:32 AEST
Created attachment 2282 [details]
Fixes improper definition names in config.h.in
Comment 11 Tim Rice 2013-06-02 06:46:43 AEST
(In reply to Nathan Osman from comment #10)
> Created attachment 2282 [details]
> Fixes improper definition names in config.h.in

As Darren mentioned in comment 5, you need to run autoreconf.
config.h.in is regenerated with the new bits by autoreconf.
Comment 12 Nathan Osman 2013-06-02 06:57:50 AEST
Sorry for the mixup - I was running 'autoconf' instead of 'autoreconf'. Tim's patch works as-is now and you can ignore my supplementary patch.
Comment 13 Darren Tucker 2013-06-02 07:59:23 AEST
Patch applied, thanks.
Comment 14 Damien Miller 2015-08-11 23:05:15 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1