Tancho . | 4 Jul 2012 19:53
Picon
Gravatar

Porting libcurl on Android with SSL Support

Hey guys,


I have tried to port libcurl to android but ran into some issues, and would appreciate the help you could provide
so, I have successfully configured libcurl and it's compilable  without SSL support, but when I link to OpenSSL I get the following errors : 

Compile thumb  : curl <= curl_ntlm_core.c
Compile thumb  : curl <= curl_ntlm_msgs.c
Prebuilt       : libssl.so <= jni/include/precompiled/libssl/lib/
StaticLibrary  : libcurl.a
Executable     : curly
jni/src/tool_paramhlp.c:321: error: undefined reference to 'getpass_r'
jni/lib/ssluse.c:395: error: undefined reference to 'ENGINE_ctrl'
jni/lib/ssluse.c:402: error: undefined reference to 'ENGINE_ctrl_cmd'
jni/lib/ssluse.c:554: error: undefined reference to 'ENGINE_load_private_key'
jni/lib/ssluse.c:1629: error: undefined reference to 'SSL_CTX_set_srp_username'
jni/lib/ssluse.c:1633: error: undefined reference to 'SSL_CTX_set_srp_password'
jni/lib/ssluse.c:697: error: undefined reference to 'ENGINE_load_builtin_engines'
jni/lib/ssluse.c:724: error: undefined reference to 'ENGINE_cleanup'
jni/lib/ssluse.c:774: error: undefined reference to 'ENGINE_by_id'
jni/lib/ssluse.c:790: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:791: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:794: error: undefined reference to 'ENGINE_init'
jni/lib/ssluse.c:797: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:817: error: undefined reference to 'ENGINE_set_default'
jni/lib/ssluse.c:818: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:822: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_first'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_next'
jni/lib/ssluse.c:843: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:991: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:992: error: undefined reference to 'ENGINE_free'
collect2: ld returned 1 exit status

and the reason is that OpenSSL was build with the macro OPENSSL_NO_ENGINE
so I tried to enable the engine support but there were loads of 
#ifdef ANDROID
#define NO_ENGINE
#endif
so I thought it was best if I don't mess with it. 

so my question: 
Is it possible to build libcurl for Android with openssl which was built wit the OPENSSL_NO_ENGINE macro defined?

thanks

Tancho

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 5 Jul 2012 03:14

Re: Porting libcurl on Android with SSL Support

Hi,
Am 04.07.2012 19:53, schrieb Tancho .:
> I have tried to port libcurl to android but ran into some issues, and
there's no porting needed - it runs out-of-the-box when you configure a 
cross-compile, see f.e. here were I have a bunch of autobuilds, and also 
with OpenSSL support:
http://curl.haxx.se/dev/builds.html

> so, I have successfully configured libcurl and it's compilable  without
> SSL support, but when I link to OpenSSL I get the following errors :
>
> Compile thumb  : curl <= curl_ntlm_core.c
> Compile thumb  : curl <= curl_ntlm_msgs.c
> Prebuilt       : libssl.so <= jni/include/precompiled/libssl/lib/
> StaticLibrary  : libcurl.a
> Executable     : curly
> jni/src/tool_paramhlp.c:321: error: undefined reference to 'getpass_r'
> jni/lib/ssluse.c:395: error: undefined reference to 'ENGINE_ctrl'
> jni/lib/ssluse.c:402: error: undefined reference to 'ENGINE_ctrl_cmd'
> jni/lib/ssluse.c:554: error: undefined reference to
> 'ENGINE_load_private_key'
> jni/lib/ssluse.c:1629: error: undefined reference to
> 'SSL_CTX_set_srp_username'
> jni/lib/ssluse.c:1633: error: undefined reference to
> 'SSL_CTX_set_srp_password'
> jni/lib/ssluse.c:697: error: undefined reference to
> 'ENGINE_load_builtin_engines'
> jni/lib/ssluse.c:724: error: undefined reference to 'ENGINE_cleanup'
> jni/lib/ssluse.c:774: error: undefined reference to 'ENGINE_by_id'
> jni/lib/ssluse.c:790: error: undefined reference to 'ENGINE_finish'
> jni/lib/ssluse.c:791: error: undefined reference to 'ENGINE_free'
> jni/lib/ssluse.c:794: error: undefined reference to 'ENGINE_init'
> jni/lib/ssluse.c:797: error: undefined reference to 'ENGINE_free'
> jni/lib/ssluse.c:817: error: undefined reference to 'ENGINE_set_default'
> jni/lib/ssluse.c:818: error: undefined reference to 'ENGINE_get_id'
> jni/lib/ssluse.c:822: error: undefined reference to 'ENGINE_get_id'
> jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_first'
> jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_next'
> jni/lib/ssluse.c:843: error: undefined reference to 'ENGINE_get_id'
> jni/lib/ssluse.c:991: error: undefined reference to 'ENGINE_finish'
> jni/lib/ssluse.c:992: error: undefined reference to 'ENGINE_free'
> collect2: ld returned 1 exit status
>
> and the reason is that OpenSSL was build with the macro OPENSSL_NO_ENGINE
> so I tried to enable the engine support but there were loads of
> #ifdef ANDROID
> #define NO_ENGINE
> #endif
> so I thought it was best if I don't mess with it.
is this an OpenSSL build which ships with some Android version? If so I 
would strongly recommend that you build self a recent version from 
OpenSSL source; what Android ships is usually 1.0.0a which is more than 
2.5 years old and lacks of a bunch of important security fixes; so if 
you are a serious coder and want to support SSL in terms of *secure* 
then you have to build a recent OpenSSL and link that statically.

> so my question:
> Is it possible to build libcurl for Android with openssl which was built
> wit the OPENSSL_NO_ENGINE macro defined?
yes.

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 5 Jul 2012 10:46
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Please find my responce is inline ...  

Tancho



On Thu, Jul 5, 2012 at 3:14 AM, Guenter <lists <at> gknw.net> wrote:
Hi,
Am 04.07.2012 19:53, schrieb Tancho .:

I have tried to port libcurl to android but ran into some issues, and
there's no porting needed - it runs out-of-the-box when you configure a cross-compile, see f.e. here were I have a bunch of autobuilds, and also with OpenSSL support:
http://curl.haxx.se/dev/builds.html


so, I have successfully configured libcurl and it's compilable  without
SSL support, but when I link to OpenSSL I get the following errors :

Compile thumb  : curl <= curl_ntlm_core.c
Compile thumb  : curl <= curl_ntlm_msgs.c
Prebuilt       : libssl.so <= jni/include/precompiled/libssl/lib/
StaticLibrary  : libcurl.a
Executable     : curly
jni/src/tool_paramhlp.c:321: error: undefined reference to 'getpass_r'
jni/lib/ssluse.c:395: error: undefined reference to 'ENGINE_ctrl'
jni/lib/ssluse.c:402: error: undefined reference to 'ENGINE_ctrl_cmd'
jni/lib/ssluse.c:554: error: undefined reference to
'ENGINE_load_private_key'
jni/lib/ssluse.c:1629: error: undefined reference to
'SSL_CTX_set_srp_username'
jni/lib/ssluse.c:1633: error: undefined reference to
'SSL_CTX_set_srp_password'
jni/lib/ssluse.c:697: error: undefined reference to
'ENGINE_load_builtin_engines'
jni/lib/ssluse.c:724: error: undefined reference to 'ENGINE_cleanup'
jni/lib/ssluse.c:774: error: undefined reference to 'ENGINE_by_id'
jni/lib/ssluse.c:790: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:791: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:794: error: undefined reference to 'ENGINE_init'
jni/lib/ssluse.c:797: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:817: error: undefined reference to 'ENGINE_set_default'
jni/lib/ssluse.c:818: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:822: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_first'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_next'
jni/lib/ssluse.c:843: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:991: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:992: error: undefined reference to 'ENGINE_free'
collect2: ld returned 1 exit status

and the reason is that OpenSSL was build with the macro OPENSSL_NO_ENGINE
so I tried to enable the engine support but there were loads of
#ifdef ANDROID
#define NO_ENGINE
#endif
so I thought it was best if I don't mess with it.
is this an OpenSSL build which ships with some Android version? If so I would strongly recommend that you build self a recent version from OpenSSL source; what Android ships is usually 1.0.0a which is more than 2.5 years old and lacks of a bunch of important security fixes; so if you are a serious coder and want to support SSL in terms of *secure* then you have to build a recent OpenSSL and link that statically.

The version is not the stock version, but it's not the latest one, I believe it's a few months old, I just decided to use that one since it already had all the stuff inplace for android (the guy that made the repo copied all the google changes to make it compatible with android's build) but even compiling it from source is not an issue.. And I agree that this a static build is the way to go. 

so my question:
Is it possible to build libcurl for Android with openssl which was built
wit the OPENSSL_NO_ENGINE macro defined?
yes.
Please share your thoughts, I was more interested in the how rather than the if in this question :)
How do I disable OpenSSL engine support in curl and still be able to make https calls?
 

Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 5 Jul 2012 12:18

Re: Porting libcurl on Android with SSL Support

Hi Tancho,
Am 05.07.2012 10:46, schrieb Tancho .:
> Please share your thoughts, I was more interested in the how rather than
> the if in this question :)
hehe ...
The way I go for compiling is described in ./docs/INSTALL ...

> How do I disable OpenSSL engine support in curl and still be able to
> make https calls?
I dont think such is required; configure detects this self afaik ...
go to the curl download page and fetch the Android build, and tell me if 
it works for ya; I can provide the OpenSSL build which I did directly 
from unmodified OpenSSL sources; so I dont know what changes others or 
Google do to OpenSSL, but I'm curious to get aware of any requirements; 
my Android build works for me with https on 2.3.1, 3.2 and 4.0.3 ...
maybe there were requirements in the past with older NDKs, but with NDK 
7c and 8 compiling (lib)curl and its dependencies works without hassle 
for me ...

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 5 Jul 2012 13:34
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Woow.. Guenter dude, 

is it possible that you share the three static libs? like.. libssl, libcrypro and libcurl (compiled with ssl)?
It would mean so much if you would :)
by the way, I already tried configuring curl (latest official  version), and I did, but the configure script did not disable the openssl engine stuff.. 
that's actually my problem... 
so can you share the libs?

Tancho



On Thu, Jul 5, 2012 at 12:18 PM, Guenter <lists <at> gknw.net> wrote:
Hi Tancho,
Am 05.07.2012 10:46, schrieb Tancho .:

Please share your thoughts, I was more interested in the how rather than
the if in this question :)
hehe ...
The way I go for compiling is described in ./docs/INSTALL ...


How do I disable OpenSSL engine support in curl and still be able to
make https calls?
I dont think such is required; configure detects this self afaik ...
go to the curl download page and fetch the Android build, and tell me if it works for ya; I can provide the OpenSSL build which I did directly from unmodified OpenSSL sources; so I dont know what changes others or Google do to OpenSSL, but I'm curious to get aware of any requirements; my Android build works for me with https on 2.3.1, 3.2 and 4.0.3 ...
maybe there were requirements in the past with older NDKs, but with NDK 7c and 8 compiling (lib)curl and its dependencies works without hassle for me ...


Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 5 Jul 2012 14:13

Re: Porting libcurl on Android with SSL Support

Hi Tancho,
Am 05.07.2012 13:34, schrieb Tancho .:
> Woow.. Guenter dude,
> is it possible that you share the three static libs? like.. libssl,
> libcrypro and libcurl (compiled with ssl)?
> It would mean so much if you would :)
> by the way, I already tried configuring curl (latest official  version),
> and I did, but the configure script did not disable the openssl engine
> stuff..
> that's actually my problem...
> so can you share the libs?
try these:
http://svwe10.itex.at/~android/curl-android-devel.tar.bz2
provided that you created the standalone toolchain from NDK then you 
usually a path like:
[/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
there is either no folder 'local', or it is empty; just extract the 
above archive with:
tar xjf curl-android-devel.tar.bz2 -C 
[/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
the [/opt] here represents the place where you've stored the toolchain 
on your box ...
now all dependent libs should be automatically found by configure via 
pkg-config if you create the wrapper I suggested in ./docs/INSTALL ...

the archive does not contain libcurl, but I think you should now be able 
to easily build it yourself. Let me know how it works for ya.

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 5 Jul 2012 14:29
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

I will, thanks,

should report back in less than an hour.. 
Tancho



On Thu, Jul 5, 2012 at 2:13 PM, Guenter <lists <at> gknw.net> wrote:
Hi Tancho,
Am 05.07.2012 13:34, schrieb Tancho .:

Woow.. Guenter dude,
is it possible that you share the three static libs? like.. libssl,
libcrypro and libcurl (compiled with ssl)?
It would mean so much if you would :)
by the way, I already tried configuring curl (latest official  version),
and I did, but the configure script did not disable the openssl engine
stuff..
that's actually my problem...
so can you share the libs?
try these:
http://svwe10.itex.at/~android/curl-android-devel.tar.bz2
provided that you created the standalone toolchain from NDK then you usually a path like:
[/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
there is either no folder 'local', or it is empty; just extract the above archive with:
tar xjf curl-android-devel.tar.bz2 -C [/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
the [/opt] here represents the place where you've stored the toolchain on your box ...
now all dependent libs should be automatically found by configure via pkg-config if you create the wrapper I suggested in ./docs/INSTALL ...

the archive does not contain libcurl, but I think you should now be able to easily build it yourself. Let me know how it works for ya.


Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 5 Jul 2012 14:55
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

So if I understood correctly I am supposed to add stuff to the standalone NDK. 

I am using Crystax NDK v7b  (default google ndk with some extra stuff like support for wchar_t and wstring, runtime_error, C++11 support etc.. but it's completely backward compatible. )
so I extracted your zip in the following location 

$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3
the local folder was missing as you suggested, so I put it there. and also I set my Application.mk to use the 4.4.3 toolchain, next 
$./androidconfig (the exported paths with the configure script that I started this thread with) 
and I got the same error?
did I miss something?

I got the same error : 

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':
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

Tancho



On Thu, Jul 5, 2012 at 2:29 PM, Tancho . <smarkovik <at> gmail.com> wrote:
I will, thanks,
should report back in less than an hour.. 
Tancho



On Thu, Jul 5, 2012 at 2:13 PM, Guenter <lists <at> gknw.net> wrote:
Hi Tancho,
Am 05.07.2012 13:34, schrieb Tancho .:

Woow.. Guenter dude,
is it possible that you share the three static libs? like.. libssl,
libcrypro and libcurl (compiled with ssl)?
It would mean so much if you would :)
by the way, I already tried configuring curl (latest official  version),
and I did, but the configure script did not disable the openssl engine
stuff..
that's actually my problem...
so can you share the libs?
try these:
http://svwe10.itex.at/~android/curl-android-devel.tar.bz2
provided that you created the standalone toolchain from NDK then you usually a path like:
[/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
there is either no folder 'local', or it is empty; just extract the above archive with:
tar xjf curl-android-devel.tar.bz2 -C [/opt]/arm-linux-androideabi-4.4.3/sysroot/usr
the [/opt] here represents the place where you've stored the toolchain on your box ...
now all dependent libs should be automatically found by configure via pkg-config if you create the wrapper I suggested in ./docs/INSTALL ...

the archive does not contain libcurl, but I think you should now be able to easily build it yourself. Let me know how it works for ya.


Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 5 Jul 2012 15:12

Re: Porting libcurl on Android with SSL Support

Hi Tancho,
Am 05.07.2012 14:55, schrieb Tancho .:
> So if I understood correctly I am supposed to add stuff to the
> standalone NDK.
yep.
> I am using Crystax NDK v7b  (default google ndk with some extra stuff
> like support for wchar_t and wstring, runtime_error, C++11 support
> etc.. but it's completely backward compatible. )
> so I extracted your zip in the following location
>
> $NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3
> the local folder was missing as you suggested, so I put it there. and
but I hope you did put it below:
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr !
so that you get:
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr/local/include
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr/local/lib
...

> also I set my Application.mk to use the 4.4.3 toolchain, next
> $./androidconfig (the exported paths with the configure script that I
> started this thread with)
> and I got the same error?
> did I miss something?
well, nothing can change if you still use a handcrafted script; you 
should instead use the standard configure script which comes with 
libcurl sources, and invoke it in libcurl top source dir like that:
./configure --host=arm-linux-androideabi --disable-shared --with-zlib 
--enable-ipv6 --without-librtmp

optional add a --prefix=path so that you finally can call 'make install' 
to get a libcurl-devel package, and then after you got libcurl.a 
successfully compiled you can start to compile your jni ...

BTW. is that jni written by you, or is it another opensource project?

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 5 Jul 2012 15:37
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Hey dude.. 

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 :
.
|-- arm-linux-androideabi-4.4.3
|   `-- prebuilt
|       `-- linux-x86
|           |-- arm-linux-androideabi
|           |-- bin
|           |-- include
|           |-- lib
|           `-- libexec
|-- arm-linux-androideabi-4.6.3
|   |-- prebuilt
|   |   `-- linux-x86
|   |       |-- arm-linux-androideabi
|   |       |-- bin
|   |       |-- include
|   |       |-- lib
|   |       `-- libexec
|   `-- sysroot
|       `-- usr
|           `-- local
|-- x86-4.4.3
|   `-- prebuilt
|       `-- linux-x86
|           |-- bin
|           |-- i686-android-linux
|           |-- include
|           |-- lib
|           `-- libexec
`-- x86-4.6.3
    `-- prebuilt
        `-- linux-x86
            |-- bin
            |-- i686-android-linux
            |-- include
            |-- lib
            `-- libexec

is this correct?

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 
here it is : 

export A=/home/user/Development/AOSP/2.3.3 
export CC=$A/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc 
export DASH=/home/user/Development/Projects/Android/MyCurl
export NDK=/home/user/Development/Tools/sdk/android/ndk
export NDKLIBS=$NDK/platforms/android-4/arch-arm/usr/include
export SYSROOT=$A/ndk/build/platforms/android-4/arch-arm 
export CPPFLAGS="-I$A/external/openssl/include/ -I$A/external/openssl/crypto/-L$A/out/target/product/generic/obj/lib/ -I$A/system/core/include -I$A/prebuilt/ndk/android-ndk-r4/platforms/android-4/arch-arm/usr/include/ -lz -lssl -lcrypto"
export CFLAGS="-I$A/external/openssl/include/ -I$A/external/openssl/crypto/ -L$A/out/target/product/generic/obj/lib/ -fno-exceptions -Wno-multichar -mthumb -mthumb-interwork -nostdlib -lc -ldl -lm -march=armv5te -mtune=xscale -msoft-float -mandroid -lz -fPIC -mthumb-interwork -mthumb -mlong-calls -ffunction-sections -fstack-protector  -fno-short-enums -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DOS_ANDROID -D__NEW__ -D__SGI_STL_INTERNAL_PAIR_H -I$SYSROOT/usr/include -I$A/system/core/include -I$NDKLIBS -lssl -lcrypto" 
export LDFLAGS="-L$A/out/target/product/generic/obj/lib/ -L$A/out/target/product/generic/system/lib/-L$SYSROOT/usr/lib -Wl,--gc-sections -nostdlib -lz -lc -lssl -lcrypto -lm -ldl -llog -lgcc -Wl,--no-undefined,-z,nocopyreloc -Wl,-dynamic-linker,/system/bin/linker -L$NDK/out/target/product/generic/obj/lib/ -L$DASH/jni/includes/precompiled/libssl/lib/" 

./configure --host=arm-eabi --with-ssl=$A/external/openssl/include

In anycase .. the make install finished with the following result : 

libtool: link: ranlib .libs/libcurl.a
libtool: link: ( cd ".libs" && rm -f "libcurl.la" && ln -s "../libcurl.la" "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' '/usr/local/lib/libcurl.la'
libtool: install: /usr/bin/install -c .libs/libcurl.lai /usr/local/lib/libcurl.la
/usr/bin/install: cannot create regular file `/usr/local/lib/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


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


the thing is that, the static lib is built and is present, which I can see from thiese few lines: 

Compile thumb  : curl <= curl_ntlm_core.c
Compile thumb  : curl <= curl_ntlm_msgs.c
StaticLibrary  : libcurl.a
Executable     : curly

but unusable since if I include it in my build it tries to link with openSSL's Engines which are still included in curl's build.. 

And that's where it hurts :)


Tancho



On Thu, Jul 5, 2012 at 3:12 PM, Guenter <lists <at> gknw.net> wrote:
Hi Tancho,
Am 05.07.2012 14:55, schrieb Tancho .:

So if I understood correctly I am supposed to add stuff to the
standalone NDK.
yep.

I am using Crystax NDK v7b  (default google ndk with some extra stuff
like support for wchar_t and wstring, runtime_error, C++11 support
etc.. but it's completely backward compatible. )
so I extracted your zip in the following location

$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3
the local folder was missing as you suggested, so I put it there. and
but I hope you did put it below:
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr !
so that you get:
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr/local/include
$NDK_PATH/ndk/toolchains/arm-linux-androideabi-4.4.3/sysroot/usr/local/lib
...


also I set my Application.mk to use the 4.4.3 toolchain, next
$./androidconfig (the exported paths with the configure script that I
started this thread with)
and I got the same error?
did I miss something?
well, nothing can change if you still use a handcrafted script; you should instead use the standard configure script which comes with libcurl sources, and invoke it in libcurl top source dir like that:
./configure --host=arm-linux-androideabi --disable-shared --with-zlib --enable-ipv6 --without-librtmp

optional add a --prefix=path so that you finally can call 'make install' to get a libcurl-devel package, and then after you got libcurl.a successfully compiled you can start to compile your jni ...

BTW. is that jni written by you, or is it another opensource project?


Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 5 Jul 2012 19:17

Re: Porting libcurl on Android with SSL Support

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
Dan Fandrich | 5 Jul 2012 19:59
Favicon

Re: Porting libcurl on Android with SSL Support

On Thu, Jul 05, 2012 at 07:17:01PM +0200, Guenter wrote:
> Am 05.07.2012 15:37, schrieb Tancho .:
> >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 ...

If you use the standalone Android toolchain (from
make-standalone-toolchain.sh), you don't need Android.mk or the
instructions mentioned within it. I used Android.mk when creating Android
ROMs that included libcurl built-in, but you will probably also need it
when writing code using the NDK. If you can avoid it, do so, since
getting the config.h file built correctly the first time using the
instructions in Android.mk can be tricky and time consuming.  You could
also try creating config.h using the standalone toolchain, then using
the NDK and Android.mk to build libcurl. I'm not positive that the
compile and link options are the same in both environments, but the kind
of things that configure looks for ought to be.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Tancho . | 9 Jul 2012 03:00
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Okay guys, I haven't touched the code since friday, but today I must finish this.

So I guess I made the dumb error of not using the standalone toolchain.. I will try that. 
Can you (Dan or Guenter) send me any params for the configure ?
what I am doing now is the following : 
1. made a standalone toolchain and put it in opt
2. added Guenter's local folder in the toolchain
3. call the configure script like this 

export PATH=/opt/arm-linux-androideabi-4.4.3/bin:$PATH
./configure --host=arm-linux-androideabi

4. make

the configure goes OK, the make goes OK.. 
by the way is this normal? (copied from the configure output)

checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi     //???



but I have no libz or libssl support (what I noticed in the config after the configure ) and I guess it's because I don't add the support.. but how do I add the -lz in the standalone toolchaing? and how do I add the ssl support (again WITHOUT OpenSSL ENGINE support.. just https://)

thanks for your help


Tancho



On Thu, Jul 5, 2012 at 7:59 PM, Dan Fandrich <dan <at> coneharvesters.com> wrote:
On Thu, Jul 05, 2012 at 07:17:01PM +0200, Guenter wrote:
> Am 05.07.2012 15:37, schrieb Tancho .:
> >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 ...

If you use the standalone Android toolchain (from
make-standalone-toolchain.sh), you don't need Android.mk or the
instructions mentioned within it. I used Android.mk when creating Android
ROMs that included libcurl built-in, but you will probably also need it
when writing code using the NDK. If you can avoid it, do so, since
getting the config.h file built correctly the first time using the
instructions in Android.mk can be tricky and time consuming.  You could
also try creating config.h using the standalone toolchain, then using
the NDK and Android.mk to build libcurl. I'm not positive that the
compile and link options are the same in both environments, but the kind
of things that configure looks for ought to be.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 9 Jul 2012 03:08
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Update : 

I got the following config after fixing my standalone toolchain path (missed a - in the path) 

  curl version:     7.26.0
  Host setup:       arm-unknown-linux-androideabi
  Install prefix:   /usr/local
  Compiler:         arm-linux-androideabi-gcc
  SSL support:      no      (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls} )
  SSH support:      enabled (libSSH2)
  zlib support:     enabled
  krb4 support:     no      (--with-krb4*)
  GSSAPI support:   no      (--with-gssapi)
  SPNEGO support:   no      (--with-spnego)
  TLS-SRP support:  no      (--enable-tls-srp)
  resolver:         default (--enable-ares / --enable-threaded-resolver)
  ipv6 support:     no      (--enable-ipv6)
  IDN support:      no      (--with-libidn)
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   /etc/ssl/certs/ca-certificates.crt
  ca cert path:     no
  LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS support:    no      (--enable-ldaps)
  RTSP support:     enabled
  RTMP support:     no      (--with-librtmp)
  Protocols:        DICT FILE FTP GOPHER HTTP IMAP POP3 RTSP SCP SFTP SMTP TELNET TFTP

  SONAME bump:     yes - WARNING: this library will be built with the SONAME
                   number bumped due to (a detected) ABI breakage.
                   See lib/README.curl_off_t for details on this.


and ofcourse, I got a compile error because of the libssh.. no idea where it came from .. libz is there though.. 
and so.. I need to disable ssh and enable ssl... 

Getting close though :)

any assistance would be appreciated Grately..

Tancho



On Wed, Jul 4, 2012 at 7:53 PM, Tancho . <smarkovik <at> gmail.com> wrote:
Hey guys,

I have tried to port libcurl to android but ran into some issues, and would appreciate the help you could provide
so, I have successfully configured libcurl and it's compilable  without SSL support, but when I link to OpenSSL I get the following errors : 

Compile thumb  : curl <= curl_ntlm_core.c
Compile thumb  : curl <= curl_ntlm_msgs.c
Prebuilt       : libssl.so <= jni/include/precompiled/libssl/lib/
StaticLibrary  : libcurl.a
Executable     : curly
jni/src/tool_paramhlp.c:321: error: undefined reference to 'getpass_r'
jni/lib/ssluse.c:395: error: undefined reference to 'ENGINE_ctrl'
jni/lib/ssluse.c:402: error: undefined reference to 'ENGINE_ctrl_cmd'
jni/lib/ssluse.c:554: error: undefined reference to 'ENGINE_load_private_key'
jni/lib/ssluse.c:1629: error: undefined reference to 'SSL_CTX_set_srp_username'
jni/lib/ssluse.c:1633: error: undefined reference to 'SSL_CTX_set_srp_password'
jni/lib/ssluse.c:697: error: undefined reference to 'ENGINE_load_builtin_engines'
jni/lib/ssluse.c:724: error: undefined reference to 'ENGINE_cleanup'
jni/lib/ssluse.c:774: error: undefined reference to 'ENGINE_by_id'
jni/lib/ssluse.c:790: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:791: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:794: error: undefined reference to 'ENGINE_init'
jni/lib/ssluse.c:797: error: undefined reference to 'ENGINE_free'
jni/lib/ssluse.c:817: error: undefined reference to 'ENGINE_set_default'
jni/lib/ssluse.c:818: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:822: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_first'
jni/lib/ssluse.c:842: error: undefined reference to 'ENGINE_get_next'
jni/lib/ssluse.c:843: error: undefined reference to 'ENGINE_get_id'
jni/lib/ssluse.c:991: error: undefined reference to 'ENGINE_finish'
jni/lib/ssluse.c:992: error: undefined reference to 'ENGINE_free'
collect2: ld returned 1 exit status

and the reason is that OpenSSL was build with the macro OPENSSL_NO_ENGINE
so I tried to enable the engine support but there were loads of 
#ifdef ANDROID
#define NO_ENGINE
#endif
so I thought it was best if I don't mess with it. 

so my question: 
Is it possible to build libcurl for Android with openssl which was built wit the OPENSSL_NO_ENGINE macro defined?

thanks

Tancho


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 9 Jul 2012 04:00

Re: Porting libcurl on Android with SSL Support

Hi,
Am 09.07.2012 03:08, schrieb Tancho .:
> Update :
> I got the following config after fixing my standalone toolchain path
good.

> and ofcourse, I got a compile error because of the libssh.. no idea
nost likely because openssl dependency was missing ...

> where it came from .. libz is there though..
> and so.. I need to disable ssh and enable ssl...
>
> Getting close though :)
>
> any assistance would be appreciated Grately..
please re-read our previous mails; everything is said there; please read 
the 'Android' section in ./docs/INSTALL, and create the wrapper script 
for pkg-config - that will most likely solve outstanding ssl issue; and 
look at the Android autobuild logs which show you the configure options 
I use:
http://curl.haxx.se/dev/builds.html
and see 'configure --help' ...

good luck! Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 17 Jul 2012 01:08
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Hey guys, 

just to inform you ( I forgot to do it last week )
I successfully cross-compiled cUrl for Android with SSL using the standalone toolchain. 
I would suggest removing the Android.mk file which points people in the wrong direction and adding an Android.README file which will explain the process. 
I would gladly document it and provide it with detailed instructions if you want me to. 
I really believe it would help a lot of people who need it. 
I would provide the binary static lib to anyone on this list who needs it, but I doubt it would be useful since I crippled it to my needs, removed all the supported protocols except HTTP and HTTPS and also most of the other stuff which I did not need. If someone needs it please reply, I will gladly share. 

all my best,
Tancho



On Mon, Jul 9, 2012 at 4:00 AM, Guenter <lists <at> gknw.net> wrote:
Hi,
Am 09.07.2012 03:08, schrieb Tancho .:

Update :
I got the following config after fixing my standalone toolchain path
good.


and ofcourse, I got a compile error because of the libssh.. no idea
nost likely because openssl dependency was missing ...


where it came from .. libz is there though..
and so.. I need to disable ssh and enable ssl...

Getting close though :)

any assistance would be appreciated Grately..
please re-read our previous mails; everything is said there; please read the 'Android' section in ./docs/INSTALL, and create the wrapper script for pkg-config - that will most likely solve outstanding ssl issue; and look at the Android autobuild logs which show you the configure options I use:
http://curl.haxx.se/dev/builds.html
and see 'configure --help' ...

good luck! Gün.




-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Guenter | 17 Jul 2012 03:34

Re: Porting libcurl on Android with SSL Support

Hi Tancho,
Am 17.07.2012 01:08, schrieb Tancho .:
> just to inform you ( I forgot to do it last week )
> I successfully cross-compiled cUrl for Android with SSL using the
> standalone toolchain.
thanks for giving feedback!

> I would suggest removing the Android.mk file which points people in the
> wrong direction and adding an Android.README file which will explain the
> process.
there might be cases where you need such a makefile - different folks 
have different needs;
unless Dan agrees it should be removed I think we keep it;
and for those who're hasty and dont read ./docs/INSTALL to get informed 
of another possible way to go once they see an Android.mk in the root we 
can explicitely point to ./docs/INSTALL at the top of the makefile; 
wouldnt that help?

> I would gladly document it and provide it with detailed instructions if
> you want me to.
hmm, I believe the fact that I successfully run a bunch of Android 
autobuilds even with a bunch of dependency libs proofes that the way I 
did explain in the Android section in ./docs/INSTALL works fine;
so whats wrong with the Android section in ./docs/INSTALL ?
what is missing there or unclear?

> I really believe it would help a lot of people who need it.
Didnt we help you good enough here on the list?

> I would provide the binary static lib to anyone on this list who needs
> it, but I doubt it would be useful since I crippled it to my needs,
> removed all the supported protocols except HTTP and HTTPS and also most
> of the other stuff which I did not need. If someone needs it please
> reply, I will gladly share.
thats the prob: everyone has other needs, and if I would provide a devel 
package with everything in some would complain about too much stuff, 
while with a devel package with only http/https support the next comes 
and complains about missing XYZ ... ;-)

and BTW please dont top-post:
http://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Tancho . | 17 Jul 2012 11:39
Picon
Gravatar

Re: Porting libcurl on Android with SSL Support

Hey Guys


On Tue, Jul 17, 2012 at 3:34 AM, Guenter <lists <at> gknw.net> wrote:
Hi Tancho,
Am 17.07.2012 01:08, schrieb Tancho .:

just to inform you ( I forgot to do it last week )
I successfully cross-compiled cUrl for Android with SSL using the
standalone toolchain.
thanks for giving feedback!

My pleasure, you were of tremendous help!  

I would suggest removing the Android.mk file which points people in the
wrong direction and adding an Android.README file which will explain the
process.
there might be cases where you need such a makefile - different folks have different needs;
unless Dan agrees it should be removed I think we keep it;
and for those who're hasty and dont read ./docs/INSTALL to get informed of another possible way to go once they see an Android.mk in the root we can explicitely point to ./docs/INSTALL at the top of the makefile; wouldnt that help?

I personally think that it's misleading, since  it's close to impossible to compile using it. so maybe removing it is a bit too radical, but there should be a warning against it (or something) .

I would gladly document it and provide it with detailed instructions if
you want me to.
hmm, I believe the fact that I successfully run a bunch of Android autobuilds even with a bunch of dependency libs proofes that the way I did explain in the Android section in ./docs/INSTALL works fine;
so whats wrong with the Android section in ./docs/INSTALL ?
what is missing there or unclear?
Actually the ./docs/INSTALL file is quite ok but for a successful build I needed to link to the android build which Is never mentioned. The only way to avoid the SSL ENGINE problem was to compile openSSL from the AOSP and then add the headers & stuff to the exported variables. I believe more info could help people in that area.


I really believe it would help a lot of people who need it.
Didnt we help you good enough here on the list?

Your help was priceless. I couldn't have done it without you, My point was that if there is a straightforward compile manual for it people would bug you less in the list :) 
 

I would provide the binary static lib to anyone on this list who needs
it, but I doubt it would be useful since I crippled it to my needs,
removed all the supported protocols except HTTP and HTTPS and also most
of the other stuff which I did not need. If someone needs it please
reply, I will gladly share.
thats the prob: everyone has other needs, and if I would provide a devel package with everything in some would complain about too much stuff, while with a devel package with only http/https support the next comes and complains about missing XYZ ... ;-)

Exactly, my proposal was meant for the other people searching the net for the lib port etc.. I know you don't need it :)
and BTW please dont top-post:
http://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post


Gün.



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Dan Fandrich | 21 Jul 2012 21:07
Favicon

Re: Porting libcurl on Android with SSL Support

On Tue, Jul 17, 2012 at 11:39:00AM +0200, Tancho . wrote:
> On Tue, Jul 17, 2012 at 3:34 AM, Guenter <lists <at> gknw.net> wrote:
>     there might be cases where you need such a makefile - different folks have
>     different needs;
>     unless Dan agrees it should be removed I think we keep it;
>     and for those who're hasty and dont read ./docs/INSTALL to get informed of
>     another possible way to go once they see an Android.mk in the root we can
>     explicitely point to ./docs/INSTALL at the top of the makefile; wouldnt
>     that help?
> 
> I personally think that it's misleading, since  it's close to impossible to
> compile using it. so maybe removing it is a bit too radical, but there should
> be a warning against it (or something) .

That may be true for the standalone toolchain, but there's more than
one way to compile for Android. Have you ever tried compiling against
the NDK or from the full source release? You need an Android.mk when you
do that.  Unfortunately, I no longer do Android development so I can't
keep it up to date, but it worked fine for me up to a few months ago. I
think it's a great idea to point users to the INSTALL file from within
Android.mk for a more detailed discussion of the Android options.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Gmane