Re: Building Curl from Source for Android (ARM-EABI) as JNI library
Date: Tue, 1 Dec 2009 06:52:31 -0700
Please don't use mailing lists Digests if you intend to participate on the
> mailing list. It makes hideous mail subjects and makes it very hard for all
> us to have a sensible conversation.
Sorry about that, I have switched my list setting so digest mode will be off
in the future.
My first problem was that I could not get a clean build within the Android
>> build system, but by configuring with the --without-zlib and
>> flags I was able to get the errors down to stropts.h and ifaddr.h related
> I know Android is a weirdo system, but I didn't expect that. Any chance you
> could educate us by showing the configure output when you run that on your
> system? And are you saying configure _failed_ when you didn't specify
> --without-zlib and --disable-ipv6? It is supposed to detect the absense by
> itself (as far as possible).
Would be happy to. I have modified things a lot since then (actually with
some success, see below) so I have to backtrace to reproduce. I will do
that over the next couple days and share exact traces if I can reproduce
what was happening.
My scribbles indicate that when configuring I was getting an error like
configure: WARNING: you should use --build, --host, --target
> configure: WARNING: invalid host type:
> checking whether to enable maintainer-specific portions of Makefiles...
> checking whether to enable debug build options... no
> checking whether to enable compiler optimizer... not specified (assuming
> checking whether to enable strict compiler warnings... no
> checking whether to enable curl debug memory tracking... no
> checking for sed... /bin/sed
> checking for grep... /bin/grep
> checking for egrep... /bin/grep -E
> checking for arm-linux-ar... no
> checking for ar... /usr/bin/ar> configure: WARNING: using cross tools
not prefixed with host triplet
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking for gawk... no
> checking for mawk... mawk
> checking whether make sets $(MAKE)... yes
> checking for arm-linux-strip... no
> checking for strip... strip
> checking curl version... 7.19.7
> checking build system type... config.sub: missing argument
> Try `config.sub --help' for more information.
> configure: error: /bin/bash ./config.sub failed
> ./config2: 20: : not found
But I fixed that error at some point, and then saw that configure was taking
the x86/Ubuntu availability of things like stropts.h and assuming it was
available for the cross compile to ARM. That is bad behavior, but I am
guessing it was something I did wrong, instead of the Curl configure
process, but we'll see when I reproduce and share.
Sorry my notes are not more exact. I tried a lot of things to get this to
work and I didn't log everything I attempted.
By hand modifying <curl-source>/lib/curl_config.h and commenting out all
>> related variables (eg (HAVE_STROPTS_H) for stropts and ifaddr I was able
>> get a clean build.
>> (Is it dangerous to comment out these variables, will the library be no
> Those defines only tell if those header files are existing. If you can
> fine without those defines everything is fine and they aren't needed
Awesome. Indeed, I proved this last night (since still on digest mode,
didn't know of your post), when I got libCurl into a NDK project for Android
I got a .a static library but have been unable to get it loaded into an
>> Android project without an unknown fatal error from the Android Operating
> Now my Andorid ignorance will show, but I don't know why that would happen
> what possible extra magic that might be required to get things going... Do
> other configure + libtool based projects generally work when you build them
> for Android?
I am equally ignorant when it comes to determining why that was happening.
Since I now have it working I can deduce it was my error, but I don't know
exactly what I did wrong. I suspect the problem was related to the NDK
In summary, it is posible to use libCurl on Android if you are persistent. I
will start from scratch and document my steps. I will share what works, and
if I can reproduce the bad steps, what didn't work. It might take me as
long as a week to do so. I am still wrestling with some emulator networking
issues that I have to get past before I do the backtrace.
Thanks for your help curl-library list!
More to come ...
> / daniel.haxx.se
List admin: http://cool.haxx.se/list/listinfo/curl-library
Received on 2009-12-01