1

I'm working on an Android platform build with android-4.4_r1 (KRT16S). I can compile the source (it's a big project) into a *.so file without any trouble.

If I try to build the source into a command line executable with include $(BUILD_EXECUTABLE) (basically just wrapping the library with a command line interface), I run into the following errors when linking:

out/target/product/flo/obj/lib/libssl.so: error: undefined reference to '__strlen_chk'
out/target/product/flo/obj/lib/libssl.so: error: undefined reference to '__strchr_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__strrchr_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__sprintf_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__strcat_chk'

I've seen reference to this problem here and here, but I'm not sure how to fix it. Do I need to build openssl differently to work in the executable?

Update

This is how I built openssl:

I didn't follow any outside directions. I just used what was provided in the repo.

Community
  • 1
  • 1
GrandAdmiral
  • 1,348
  • 2
  • 24
  • 52
  • `__strlen_chk` is part of `FORTIFY_SOURCE`. How did you build OpenSSL? Did you follow the instructions at [OpenSSL and Android](http://wiki.openssl.org/index.php/Android)? Show at least one compile command with `arm-linux-androideabi-gcc`. Are you using `ANDROID_SYSROOT`? – jww Jun 04 '14 at 22:18
  • I built the openssl that was part of android-4.4_r1. No special options, just used mmma on my project. I'm not sure whether or not I'm using ANDROID_SYSROOT (new to Android). – GrandAdmiral Jun 04 '14 at 22:21

1 Answers1

2

Try set D_FORTIFY_SOURCE=0 when building. I've solved this with libcurl, with details in the last part here http://qiankanglai.me/misc/2014/08/31/android-libcurl/

Kanglai
  • 530
  • 1
  • 6
  • 18