Search code examples
androidcurlandroid-sourceandroid-build

including curl into the android AOSP


i've downloaded the curl library source code and i extracted it in the external folder of the android source the i generated the curl_config.h with the following configure command

./configure --host=arm-linux --disable-tftp --disable-sspi --disable-ipv6 --disable-ldaps --disable-ldap --disable-telnet --disable-pop3 --disable-ftp --without-ssl --disable-imap --disable-smtp --disable-pop3 --disable-rtsp --disable-ares --without-ca-bundle --disable-warnings --disable-manual --without-nss --enable-shared --without-zlib --without-random --without-libidn

But when i do an mm to build the curl module i get the following error:

external/curl/lib/connect.c:579: error: invalid 'asm': invalid operand for code 'w'

Does anyone know how to fix this error ?

Thanks in advance!


Solution

  • You're probably getting this error because of some bad includes. One of the commonest reasons this is happenning is because you are compiling cURL with your host includes.

    Check that your Makefiles does not contain hard-coded references to /usr/include or any other include paths. This is apparently a common error when people are trying to cross-compile on x86 for ARM. Your compiler is confused because he is trying to parse assembly network instructions such as the rorw (“rotate word right”) x86 instruction as the ror (“rotate right”) ARM instruction.

    Some C functions such as htons, which provides network byte order translation (ensuring that there are no endianness issues for example), are implemented as preprocessor macros that contain inline assembly. And an ARM compiler cannot understand x86 instructions, this is why you're getting this error. These kind of network translation functions are heavily used in cURL, so the odds are good that this might be your problem.

    Here is a good article that should help you port cURL on Android. The guy does not compile cURL with Android but exports cURL's functions through JNI.