I am currently facing a build problem using openssl.
First, I built libssl.soand libcrypto.soshared librairies with ndk-build project for a guardian.
As a second step, I integrated libs with my android project by doing the following as described in this thread :
1) Create a jni folder
2) In this new folder, I created the include folder and copied the openssl subfolder (from the openssl package) containing the header files
3) Create a precompiled folder in which I copied the files libssl.so and libcrypto.so
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) Then I wrote the source file called security.c and containing the openssl initialization function
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
void init_openssl(void){
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
}
5) ndk-build, libsecurity.so
, , :
fatal error: openssl/bio.h: No such file or directory
- mk?