cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Porting libcurl on Android with SSL Support

From: Guenter <lists_at_gknw.net>
Date: Thu, 05 Jul 2012 19:17:01 +0200

Hi,
Am 05.07.2012 15:37, schrieb Tancho .:
> The NDK is an opensource project,you can check it out at :
> http://www.crystax.net/en/android/ndk
> It's quite cool actually..
>
> so back to the build stuff..
> 1. I the folder $NDK/toolchains I have the following tree structure :
> is this correct?
hmm, that looks similar to how the structure is when you download the
NDK from Google:
http://developer.android.com/tools/sdk/ndk/index.html
but at least for the original one from above link it turned out for me
that it is not directly usable but instead you have to create the
'standalone toolchain' with the provided script
./build/tools/make-standalone-toolchain.sh
see http://curl.haxx.se/docs/install.html (or .docs/INSTALL in libcurl
source reee).

> 2. the script I'm using is actually just setting the environment and
> then calling the curl config script, it's based on the explanations in
> the Android.mk file comments by the dev team
you mean the Android.mk in libcurl source tree? Then sorry, I cant
comment on this one since I never used it; but if you wait a bit I'm
sure that Dan will comment on this ...

> In anycase .. the make install finished with the following result :
>
> libtool: link: ranlib .libs/libcurl.a
> libtool: link: ( cd ".libs" && rm -f "libcurl.la <http://libcurl.la>" &&
> ln -s "../libcurl.la <http://libcurl.la>" "libcurl.la <http://libcurl.la>" )
> make[2]: Entering directory
> `/home/user/Development/Projects/MyCurl/external/libcurl/jni/lib'
> test -z "/usr/local/lib" || mkdir -p -- "/usr/local/lib"
> /bin/bash ../libtool --mode=install /usr/bin/install -c 'libcurl.la
> <http://libcurl.la>' '/usr/local/lib/libcurl.la <http://libcurl.la>'
> libtool: install: /usr/bin/install -c .libs/libcurl.lai
> /usr/local/lib/libcurl.la <http://libcurl.la>
> /usr/bin/install: cannot create regular file `/usr/local/lib/libcurl.la
> <http://libcurl.la>': Permission denied
> make[2]: *** [install-libLTLIBRARIES] Error 1
> make[2]: Leaving directory
> `/home/tanco/Development/Projects/MyCurl/external/libcurl/jni/lib'
> make[1]: *** [install-am] Error 2
> make[1]: Leaving directory
> `/home/tanco/Development/Projects/MyCurl/external/libcurl/jni/lib'
> make: *** [install-recursive] Error 1
yes, looks good; and permission error is because of insufficient rights
which is normal if you want to install stuff into '/usr/local/lib' as
non-root; and good that you were stopped by this since that doesnt sound
for the right location! As I said before you should use --prefix, f.e.:
--prefix=/tmp/curl-7.x.y-android-devel
or something like that.

> from what I can see, if I reached the cannot "create regular file
> `/usr/local/lib/libcurl.la <http://libcurl.la>': Permission denied"
> that I have a successful compile, and everything is in place, but when I
yes.

> do an ndk-build, it fails with the same linker error as previously
>
>
> Compile thumb : curl <= curl_gssapi.c
> Compile thumb : curl <= curl_ntlm.c
> Compile thumb : curl <= curl_ntlm_wb.c
> In file included from libcurl/jni/lib/curl_ntlm_wb.c:37:
> /home/tanco/Development/Tools/sdk/android/ndk/platforms/android-14/arch-arm/usr/include/unistd.h:
> In function 'getpagesize':
> /home/tanco/Development/Tools/sdk/android/ndk/platforms/android-14/arch-arm/usr/include/unistd.h:171:
> warning: nested extern declaration of '__page_size'
> /home/tanco/Development/Tools/sdk/android/ndk/platforms/android-14/arch-arm/usr/include/unistd.h:
> In function '__getpageshift':
> /home/tanco/Development/Tools/sdk/android/ndk/platforms/android-14/arch-arm/usr/include/unistd.h:175:
> warning: nested extern declaration of '__page_shift'
these look unusual, and I assume either your NDK version is strange
here, or again this is an issue because of not having created the
standalone toolchain.

> Compile thumb : curl <= curl_ntlm_core.c
> Compile thumb : curl <= curl_ntlm_msgs.c
> StaticLibrary : libcurl.a
> Executable : curly
> libcurl/obj/local/armeabi/objs/curly/src/tool_paramhlp.o: In function
> `checkpasswd':
> libcurl/jni/src/tool_paramhlp.c:321: undefined reference to `getpass_r'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `Curl_ossl_close_all':
thats even more strange:
1) although it seems you did build everything fine above, now you build
again here
2)even more strange that you try to build curl although you shouldnt
need it since you're after the lib only for linking your jni, or?
3) this build seems to use either a handcrafted or a wrong curl_config.h
- configure detects if `getpass_r' is available or not and sets a define
in curl_config.h acordingly.

> libcurl/jni/lib/ssluse.c:991: undefined reference to `ENGINE_finish'
> libcurl/jni/lib/ssluse.c:992: undefined reference to `ENGINE_free'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `Curl_ossl_engines_list':
> libcurl/jni/lib/ssluse.c:842: undefined reference to `ENGINE_get_first'
> libcurl/jni/lib/ssluse.c:842: undefined reference to `ENGINE_get_next'
> libcurl/jni/lib/ssluse.c:843: undefined reference to `ENGINE_get_id'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `Curl_ossl_set_engine_default':
> libcurl/jni/lib/ssluse.c:817: undefined reference to `ENGINE_set_default'
> libcurl/jni/lib/ssluse.c:818: undefined reference to `ENGINE_get_id'
> libcurl/jni/lib/ssluse.c:822: undefined reference to `ENGINE_get_id'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `Curl_ossl_set_engine':
> libcurl/jni/lib/ssluse.c:774: undefined reference to `ENGINE_by_id'
> libcurl/jni/lib/ssluse.c:790: undefined reference to `ENGINE_finish'
> libcurl/jni/lib/ssluse.c:791: undefined reference to `ENGINE_free'
> libcurl/jni/lib/ssluse.c:794: undefined reference to `ENGINE_init'
> libcurl/jni/lib/ssluse.c:797: undefined reference to `ENGINE_free'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `Curl_ossl_cleanup':
> libcurl/jni/lib/ssluse.c:724: undefined reference to `ENGINE_cleanup'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function `Curl_ossl_init':
> libcurl/jni/lib/ssluse.c:697: undefined reference to
> `ENGINE_load_builtin_engines'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function `cert_stuff':
> libcurl/jni/lib/ssluse.c:395: undefined reference to `ENGINE_ctrl'
> libcurl/jni/lib/ssluse.c:402: undefined reference to `ENGINE_ctrl_cmd'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `ossl_connect_step1':
> libcurl/jni/lib/ssluse.c:1629: undefined reference to
> `SSL_CTX_set_srp_username'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function `cert_stuff':
> libcurl/jni/lib/ssluse.c:554: undefined reference to
> `ENGINE_load_private_key'
> libcurl/obj/local/armeabi/libcurl.a(ssluse.o): In function
> `ossl_connect_step1':
> libcurl/jni/lib/ssluse.c:1633: undefined reference to
> `SSL_CTX_set_srp_password'
> collect2: ld returned 1 exit status
since we see that you use above a wrong curl_config.h which was not
properly created by configure then certainly these errors are of same
reason.

> the thing is that, the static lib is built and is present, which I can
> see from thiese few lines:
that doesnt matter since a static lib has its dependencies as well, and
these are *not* resolved at creation time, but you need to provide the
dependend libs finally when the app (or jni) is linked.

> And that's where it hurts :)
1) lets wait what Dan says about Android.mk if you prefer this way.
2) I might later build a version since I anyway want to test something -
but that will be from GIT repo, and is not an official release! This I
can provide to you.
3) you can provide your jni, and if I find some time I can try to build
it (but might last few days ...)

Gün.

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