codeScriber
codeScriber

Reputation: 4612

compiling libcurl for android mips

i've created a script that compiles curl for android for 3 platforms, well more like 4: 1. armv5 2. armv7 3. x86 4. mips

i do it using this post in SO: enter link description here for arm and x86 everything works ok (i use ndk toolchains and openssl specific library which i compiled for those same platform beforehand). the only problematic platform is mips. i DO get the libcrul.a,la and .so BUT when trying to compile the executable curl the linkage fails:

libtool: link: mipsel-linux-android-gcc -O2 -Wno-system-headers -o .libs/curl curl-tool_binmode.o curl-tool_bname.o curl-tool_cb_dbg.o curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o curl-tool_convert.o curl-tool_dirhie.o curl-tool_doswin.o curl-tool_easysrc.o curl-tool_formparse.o curl-tool_getparam.o curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o curl-tool_homedir.o curl-tool_hugehelp.o curl-tool_libinfo.o curl-tool_main.o curl-tool_metalink.o curl-tool_mfiles.o curl-tool_msgs.o curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o curl-tool_paramhlp.o curl-tool_parsecfg.o curl-tool_setopt.o curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o curl-tool_vms.o curl-tool_writeenv.o curl-tool_writeout.o curl-tool_xattr.o ../lib/curl-strtoofft.o ../lib/curl-strdup.o ../lib/curl-rawstr.o ../lib/curl-nonblock.o ../lib/curl-warnless.o  -L/usr/local/android-ndk/platforms/android-9/arch-mips/usr/lib -L/home/eyal/devel/openssl/lib ../lib/.libs/libcurl.so -lz
/usr/local/ndk-toolchains/mipsel-linux-android-4.6/bin/../lib/gcc/mipsel-linux-android/4.6/../../../../mipsel-linux-android/bin/ld: warning: libssl.so.1.1.0, needed by ../lib/.libs/libcurl.so, not found (try using -rpath or -rpath-link)
/usr/local/ndk-toolchains/mipsel-linux-android-4.6/bin/../lib/gcc/mipsel-linux-android/4.6/../../../../mipsel-linux-android/bin/ld: warning: libcrypto.so.1.1.0, needed by ../lib/.libs/libcurl.so, not found (try using -rpath or -rpath-link)
../lib/.libs/libcurl.so: undefined reference to `RAND_load_file'
../lib/.libs/libcurl.so: undefined reference to `SSL_CTX_use_certificate'
../lib/.libs/libcurl.so: undefined reference to `X509_load_crl_file'
../lib/.libs/libcurl.so: undefined reference to `SSL_set_fd'
../lib/.libs/libcurl.so: undefined reference to `SSL_set_connect_state'
../lib/.libs/libcurl.so: undefined reference to `SSL_CTX_free'
../lib/.libs/libcurl.so: undefined reference to `X509_free'

there are more 'undefined reference' errors, i spared u... the library exists, the -L paths are ok, i checked, permission seems to be fine, and again, it works for both arm and x86 for android. i'm using --host=mipsel-linux-android which might be wrong, but seems like it's the right one, the .so and .a are built so something went alright, but ld for some reason can't locate ssl and crypt once it's requested when trying to create and executable.

Anyone has any idea ? when tryying to use the toolchain manually to compile a file using libssl i was successful!

10x.

Upvotes: 1

Views: 2058

Answers (1)

jww
jww

Reputation: 102356

../lib/.libs/libcurl.so: undefined reference to `RAND_load_file'

These are OpenSSL functions. Do you have OpenSSL cross compiled for MIPS? If so, is it available?


libtool: link: mipsel-linux-android-gcc -O2 -Wno-system-headers -o .libs/curl curl-tool_binmode.o 
curl-tool_bname.o curl-tool_cb_dbg.o curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o 
curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o curl-tool_convert.o curl-tool_dirhie.o 
curl-tool_doswin.o curl-tool_easysrc.o curl-tool_formparse.o curl-tool_getparam.o 
curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o curl-tool_homedir.o curl-tool_hugehelp.o 
curl-tool_libinfo.o curl-tool_main.o curl-tool_metalink.o curl-tool_mfiles.o curl-tool_msgs.o 
curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o curl-tool_paramhlp.o 
curl-tool_parsecfg.o curl-tool_setopt.o curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o 
curl-tool_vms.o curl-tool_writeenv.o curl-tool_writeout.o curl-tool_xattr.o ../lib/curl-strtoofft.o 
../lib/curl-strdup.o ../lib/curl-rawstr.o ../lib/curl-nonblock.o ../lib/curl-warnless.o 
 -L/usr/local/android-ndk/platforms/android-9/arch-mips/usr/lib -L/home/eyal/devel/openssl/lib 
../lib/.libs/libcurl.so -lz

OK... It looks like you specified the path to libcrypto and libssl:

-L/home/eyal/devel/openssl/lib

But it does not look like you passed in the actual libraries:

-lssl -lcrypto

I'm using --host=mipsel-linux-android which might be wrong...

This looks OK to me. Here's what the folks on the Autotools list told me to use for Android/ARM:

./configure --build=`./config.guess` --host=arm-linux-androideabi

I'd expect MIPS to use something like this because of what the Autotools folks passed on:

./configure --build=`./config.guess` --host=mipsel-linux-android

But I still think yours is OK.

Upvotes: 1

Related Questions