Cross compiling Curl for Android - stuck at Make with missing stropt.h error

1,054 views
Skip to first unread message

tantdyalf

unread,
Nov 23, 2009, 10:58:14 PM11/23/09
to android-ndk
I am trying to cross compile Curl for Android.

I have a clean 9.10 Ubuntu build with Donut, the SDK, and the NDK
installed. I have built Android from the source with success.

Next I download the Curl source into a directory in external.

I make a custom configure script (using the --without-zlib flag) and
configure Curl with success, and without zlib support (until I disable
zlib I fail with a missing zlib.h error on make).

My next step is to make from the root Android directory.

Make fails with this error:

external/curl-7.19.7/lib/if2ip.c:51:23: error: ifaddrs.h: No such file
or directory
external/curl-7.19.7/lib/if2ip.c:54:23: error: stropts.h: No such file
or directory

I search the Android source for these header files and do not find
them.

There are also numerous warnings about include files stomping on each
other, AndroidConfig.h and curlconfig.h both define HAVE_MALLOC_H for
example. I am not sure if this is important and indicates I set
something up incorrectly.

My primary question is how do I get past the missing header file
errors and successfully make Android with Curl?

Related but less important: knowing that zlib.h is inside the bionic
source tree, how do I re-enable zlib support for Curl and make sure
the cross compiler can find the zlib header file?

If make is run with showcommands this is the command that fails:

target thumb C: libcurl <= external/curl-7.19.7/lib/if2ip.c

prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc -I system/
core/include -I hardware/libhardware/include -I hardware/
libhardware_legacy/include -I hardware/ril/include -I dalvik/
libnativehelper/include -I frameworks/base/include -I frameworks/base/
opengl/include -I external/skia/include -I out/target/product/generic/
obj/include -I bionic/libc/arch-arm/include -I bionic/libc/include -I
bionic/libstdc++/include -I bionic/libc/kernel/common -I bionic/libc/
kernel/arch-arm -I bionic/libm/include -I bionic/libm/include/arch/arm
-I bionic/libthread_db/include -I external/curl-7.19.7/include/ -I
external/curl-7.19.7 -I out/target/product/generic/obj/
STATIC_LIBRARIES/libcurl_intermediates -c -fno-exceptions -Wno-
multichar -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-
interwork -ffunction-sections -funwind-tables -fstack-protector -fno-
short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -
D__ARM_ARCH_5TE__ -include system/core/include/arch/linux-arm/
AndroidConfig.h -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -
Werror=return-type -DSK_RELEASE -DNDEBUG -g -Wstrict-aliasing=2 -
finline-functions -fno-inline-functions-called-once -fgcse-after-
reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -
mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
-Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -
Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-
equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-
labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-
headers -DHAVE_CONFIG_H -MD -o out/target/product/generic/obj/
STATIC_LIBRARIES/libcurl_intermediates/lib/if2ip.o external/
curl-7.19.7/lib/if2ip.c

Nate Tellari

unread,
Nov 26, 2009, 2:24:53 PM11/26/09
to android-ndk
Good job on getting farther than I did in this.

Please note that the Android Makefile for curl was designed for
Android 1.5, so the build environment may just not be correct, you
could correct it in the makefile, or you could try pulling cupcake and
building from there. please get back on this, I'm highly curious as
to your success or not!

When I return from break I'll attempt to find a solution for 1.6, but
it shouldn't honestly matter what release you pull from to build this
binary, as it will likely work regardless ;-)

tantdyalf

unread,
Nov 28, 2009, 5:11:53 PM11/28/09
to android-ndk
Noted. I have worked with NDK 1.5 and 1.6, I am focusing on 1.6.

I have made it past the error above by modifying <curl source>/lib/
curl_config.h

If you comment out the variables related to stropt and ifaddr you can
get a clean build in the external folder. I am not sure if that will
work in the long run, but at least it builds.

I am focusing on using curl as a shared library in a JNI application
now. Still using Ubuntu 9.10 / Android-platflorm-1.5 (3) / NDK 1.6.

I have been unable to achieve this to date.

If anyone has, please say its possible and provide some guidance if
you would be so kind.

On Nov 26, 12:24 pm, Nate Tellari <rik...@gmail.com> wrote:
> Good job on getting farther than I did in this.
>
> Please note that the Android Makefile forcurlwas designed for
Reply all
Reply to author
Forward
0 new messages