ftw support in arm-eabi-4.4.3

406 views
Skip to first unread message

sam gsmith

unread,
Apr 13, 2012, 1:42:19 AM4/13/12
to android-ndk
I am new to NDK development for embedded platforms. Currently I am
trying to use the usbtest tool and it includes ftw.h and needs to be
linked with glibc library which supports it. However the prebuilt tool
chain in my arm-eabi-4.4.3 does not support ftw.

Reading the man page of ftw, it was obsolete in POSIX 2008 which arm-
eabi-4.4.3 is compliant to. However linux-usb.org contains the same
source code referring to ftw.h.

Can someone please confirm if arm-eabi-4.4.3 supports ftw.h ? Also if
so, how can I pull it into my setup. Do I need to get the tool chain
source code and build it. Any link with detailed instructions of how
to get git source for the tool chain will be greatly appreciated.

Thanks.

Ray Donnelly

unread,
Apr 13, 2012, 7:05:31 PM4/13/12
to andro...@googlegroups.com
Hi,

The Android ARM Application Binary Interface is called arm-linux-androideabi.

arm-eabi-4.4.3 sounds to me like a specific compilation/version
(4.4.3) of GCC that targets some embedded arm; not necessarily
anything to do with Android.

POSIX compliance requires more than a 'compliant' ABI, mainly C
standard library support. Android uses bionic rather than a variant of
glibc:

For a quick overview of bionic see the text at the bottom of
https://github.com/android/platform_bionic/tree/master/libc (I'd also
recommend browsing around the source code at that page too)

Building you own version of the NDK toolchain wouldn't help you out
with ftw. Very few things a coder wants to do with Android require
building custom toolchains. NDK toolchains are always built against
bionic. bionic doesn't implement ftw.c/h. To find out if a specific
feature/header is supplied as a part of bionic, you can do:

find android-ndk-r7c/platforms/android-9/arch-arm/usr/include -name ftw.h

..from a Linux shell prompt, OS X terminal or Windows MSYS prompt. In
this case, ftw.h isn't found.

You could of course code your own version of ftw. AFAIK, it's a fairly
small bit of code built on top of opendir and readdir. For a reference
implementation, you can check a BSD variant (or even mostly just use
one, provided you follow the license of course), a search turned up:

http://www.koders.com/c/fid2471DB66761F1FAD94B27154D6A108D9CBA40ED0.aspx?s=ftp#L3

I'd also refer to something like
http://pubs.opengroup.org/onlinepubs/7908799/xsh/ftw.h.html while
implementing your own versions of ftw.

if you need to discover whether the functions used by ftw.c are
provided on Android and which header you need to include, you can do
e.g.:

grep -r readdir android-ndk-r7c/platforms/android-9/arch-arm/usr/include

(or you can use an IDE of course!)

For an overview of native Android development, this seems quite good
(if a little old):

http://www.slideshare.net/ramesh130/advance-android-application-development-9258160

Good luck.

Ray.

> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>

Reply all
Reply to author
Forward
0 new messages