Undefined Reference Errors with libssl and libcrypto

2.4k views Asked by At

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.

1

There are 1 answers

0
Kanglai On

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/