cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Questions on building libcurl for Android

From: Ram <ram.nw1_at_gmail.com>
Date: Thu, 30 Aug 2012 15:57:06 -0700

On Tue, Aug 28, 2012 at 7:46 PM, Guenter <lists_at_gknw.net> wrote:

> ok, just did a quick build of recent release 7.27.0 in the background on
> my W2K3 server with an older Cygwin installation, and it worked like a
> charm! See the buildlog here:
> http://svwe10.itex.at/curl/**buildlogs/curl_android_cygwin.**txt<http://svwe10.itex.at/curl/buildlogs/curl_android_cygwin.txt>
>
> I did setup this some time ago already, so I didnt remember how I did
> integrate the standalone toolchain into Cygwin - so here's the way I did it
> (assuming that your Cygwin installation is on the C root = C:\Cygwin):
> - create a new empty folder C:\Cygwin\arm-linux-**androideabi
>
>
Thank you again, Guenter, all your responses have been very helpful and
that finally helped get a working build using cygwin
Yesterday, I was able to ndk-build an Android build and verify that an app
with the curl_easy_perform API correctly made an HTTP request from within
the Android emulator.

Ultimately, you were correct in guessing that the build issues might have
been specific to NDK r8b.

When building with NDK 8b, I consistently got the same build error
(described in my prior emails) while running the configure script. This
happened with 4.4.4 compiler as well as the 4.6 compiler.
However, when I used the NDK 7c toolchain (cross-compiler), the configure
script worked fine and did its job in around 8 minutes (in cygwin).
I used *"./configure --host=arm-linux-androideabi --with-zlib --enable-ipv6*"
which you had mentioned in an earlier post
"make" took very little time and created a libcurl.a file for Android.

I then took the libcurl.a file and integrated it into the Android build (by
creating a new Android.mk file for the libcurl module).
------
Btw as an fyi - I did run into a couple of build issues which don't
directly impact my work.

1. make fails when run a second time.
When I run make a second time, I get the following errors.(make clean
doesn't eliminate the error)
*Making all in lib
make[1]: Entering directory
`/cygdrive/c/TestDir/android-ndk-r8b/sources/curllib2/lib'
.deps/libcurl_la-amigaos.Plo:1: *** multiple target patterns. Stop.
make[1]: Leaving directory
`/cygdrive/c/TestDir/android-ndk-r8b/sources/curllib2/lib'
Makefile:443: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1
*
This isn't a big issue for me, because -for now- I don't need to make code
changes or build multiple times.
I can do a rebuild on a new clean source tree.
However, I only need to build once and use the prebuilt .a file for my
Android app. So I didn't immediately search for a way to fix the problem.

2. The libcurl.so file doesn't get built. I get the following error from
make
*libtool: link: arm-linux-androideabi-gcc -g0 -O2 -Wno-system-headers -o
.libs/curl hugehelp.o tool_binmode.o tool_bname.o tool_cb_dbg.o
tool_cb_hdr.o tool_cb_prg.o tool_cb_rea.o tool_cb_see.o tool_cb_wrt.o
tool_cfgable.o tool_convert.o tool_dirhie.o tool_doswin.o tool_easysrc.o
tool_formparse.o tool_getparam.o tool_getpass.o tool_help.o tool_helpers.o
tool_homedir.o tool_libinfo.o tool_main.o tool_metalink.o tool_mfiles.o
tool_msgs.o tool_operate.o tool_operhlp.o tool_panykey.o tool_paramhlp.o
tool_parsecfg.o tool_setopt.o tool_sleep.o tool_urlglob.o tool_util.o
tool_vms.o tool_writeenv.o tool_writeout.o tool_xattr.o strtoofft.o
strdup.o rawstr.o nonblock.o ../lib/.libs/libcurl.so -lz -Wl,-rpath -
Wl,/usr/local/lib
C:/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe:../lib/.libs/libcurl.so:
file
format not recognized; treating as linker script
C:/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe:../lib/.libs/libcurl.so:1:
syntax
error
collect2: ld returned 1 exit status
Makefile:541: recipe for target `curl' failed
make[2]: *** [curl] Error 1
make[2]: Leaving directory
`/cygdrive/c/TestDir/android-ndk-r8b/sources/curllib2/src'
Makefile:479: recipe for target `all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/cygdrive/c/TestDir/android-ndk-r8b/sources/curllib2/src'
Makefile:443: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1
*

I don't plan to use the .so file. My app needs the .a static library file.
So this wasn't a priority for me, though I should probably look at this
error (and the previous one) at some later time.

---
In any case, for now, I've got the basic build working and that is great. I
now need to work on other parts of my app and will study the libcurl apis
and work on the http request portion of my app, sometime next month.
Regards Ram

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-08-31