Closed Bug 1092004 Opened 5 years ago Closed 4 years ago

Android NDK r10c build failure: error: implicit declaration of function 'getdtablesize'

Categories

(Core :: General, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: dougc, Assigned: toonetown)

References

Details

(Whiteboard: [ndk-r10c])

Attachments

(1 file)

unix_rand.c:738:2: error: implicit declaration of function 'getdtablesize'

Seems that getdtablesize is no longer defined in the header files since android-21.
We have a patch for this in bug 1103816 though I think the real fix is to stop using getdtablesize.
Getdtablesize is completely removed from android ndk version 11. Linking with that sdk fails
Just to be clear, the error that is being thrown now is:

27:42.47 unix_rand.c:738: error: undefined reference to 'getdtablesize'
27:42.47 collect2: error: ld returned 1 exit status
27:42.47 make[7]: *** [/gecko-dev/objdir-armv7/security/nss/lib/freebl/libfreebl3.so] Error 1

Same error is thrown when building i386.
Assignee: nobody → nathan
When building non-gonk builds, ANDROID_VERSION is not set.  Beginning with NDK 11, getdtablesize is no longer included.  This means that we should use the stub version of the function that is defined in android_stub.h for all android platforms.  This patch moves the function out of the "#if ANDROID_VERSION >=21" block so that all android code can use it.

Adding glandium as the reviewer, because he reviewed the original patch at bug 1103816.

Review commit: https://reviewboard.mozilla.org/r/39843/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/39843/
Attachment #8730409 - Flags: review?(mh+mozilla)
Can you clarify whether getdtablesize was removed from the headers only or if it was removed from devices's libc as well?
It is removed from the headers from platform 21 and higher (that is, it *does* exist in NDK 11 under the android-XX where XX is 19 and lower).  However, it does *NOT* appear to exist in libc anymore...even if I link, for example against android-15.
I do not - however, know if it exists on the *device's* libc...  I just ran the checks against the files that are distributed with the NDK itself.  The change appears to have begun with NDK 11 (which I know is not a supported NDK - so this is probably not a critical issue...just one I figured I'd look at for "fun" :) )
For example (and for reference), the check I ran was (from within the NDK root):

> toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm platforms/android-15/arch-arm/usr/lib/libc.so  | grep 'getdtablesize'

When running this on NDK r10e, I get a "getdtablesize" for every libc (for arm architecture - regardless of platform version).  On NDK r11, there is not a single "getdtablesize" for any libc (again, I only checked the arm architecture).
Google hasn't posted images for arm yet - but the x86 emulator image for Android-N *DOES* contain getdtablesize.  However, the ones that are used for linking (the ones in ${ANDROID_NDK_HOME}/platforms) do *NOT* contain entries for getdtablesize...and therefore building fails (undefined reference).  Though I would assume that binaries linked with older versions of the NDK will still execute on Android-N.
Attachment #8730409 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8730409 [details]
MozReview Request: Bug 1092004 - Use getdtablesize for non-gonk builds as well. r=glandium

https://reviewboard.mozilla.org/r/39843/#review36819

While I'm giving a r+ here, I think the right thing to do would be to modify the sole user of getdtablesize() (nss's unix_rand.c) to stop using it.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/3a99126a3b55
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
See Also: → 1293037
You need to log in before you can comment on or make changes to this bug.