I'm currently facing a build issue with openssl.
I first built libssl.so
and libcrypto.so
shared librairies with ndk-build the guardianproject.
As a second step, I integrated the libs with my android project by doing the following as explained in this topic:
1)Create a jni folder
2) In this new folder I created an includes folder and copy pasted the openssl folder (from the openssl package) containing the header files
3)Create a precompiled folder where I copied the libssl.so and libcrypto.so files
4)Create an Android.mk file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
c_includes := $(LOCAL_PATH)
cf_includes := include/openssl
cf_includes := $(addprefix -Ijni/,$(cf_includes))
export_c_includes := $(c_includes)
LOCAL_MODULE := security
LOCAL_SRC_FILES := security.c
LOCAL_CFLAGS += $(cf_includes)
LOCAL_EXPORT_C_INCLUDES := $(export_c_includes)
LOCAL_LDLIBS := -llog
LOCAL_LDLIBS += $(LOCAL_PATH)/precompiled/libssl.so
LOCAL_LDLIBS += $(LOCAL_PATH)/precompiled/libcrypto.so
include $(BUILD_SHARED_LIBRARY)
5) I then wrote a source file called security.c and containing a function initializing openssl
/* OpenSSL headers */
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
/* Initializing OpenSSL */
void init_openssl(void){
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
}
5) Build the whole thing with ndk-build to get a libsecurity.so file
But at this step, it seems that the compiler doesn't find the header files and I get this error:
fatal error: openssl/bio.h: No such file or directory
Did I miss something in the mk file?