I have the following situation, I am porting a piece of an app using OpenSSL for AES encryption, I have everything compile, but the linker fails. The situation is the following: 1. I wrote a JNI wrapper that simply does :
private native String cipherString(String plainData, int datasize, String password, int passSize);
private native String decipherString(String cipheredData, int datasize, String password, int passSize);
next I have a c++ file which I call that has the proper JNI sintax which translates jstring to char * and all other needed transformations, and makes a call to another cpp file which actually imports openssl headers (present and accounted for) and calls openssl methods for ciphering and deciphering.
So when I call ndk-build, it builds all thumbs, so the compiler compiles them correctly. next i needed to port openssl for android, and I used this OpenSSL for Android which works like a char with a simple ndk-build (in the root of the project, ofcourse) and builds the libssl.so and libcrypto.so
So I need to connect the two.. I find it a challenge to connect the build scripts, so that one ndk-build compiles and linkes everything (I would appreciate a simple example project if someone has the time for it)
so I copied the compiled libssl and libcrypto .so files in jni/includes/prebuilt and want to include them in the project for the linker to be able to finally create the lib which I will use at the end.
I have the following Android.mk file
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/includes/build/common.mk
include $(LOCAL_PATH)/includes/build/common_includes.mk
APP_STL := gnustl_static
LOCAL_MODULE := packer
LOCAL_SRC_FILES := modules/cipher/wrapper.cpp \
... #rest of the cpp code
LOCAL_C_INCLUDES += $(LOCAL_PATH)/includes/openssl
LOCAL_SHARED_LIBRARIES := $(LOCAL_PATH)/includes/precompiled/libssl.so \
$(LOCAL_PATH)/includes/precompiled/libcrypto.so
LOCAL_SHARED_MODULES := sslx cryptox
include $(BUILD_SHARED_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sslx
LOCAL_SRC_FILES := $(LOCAL_PATH)/includes/precompiled/libssh.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cryptox
LOCAL_SRC_FILES := $(LOCAL_PATH)/includes/precompiled/libssh.so
include $(PREBUILT_SHARED_LIBRARY)
And when calling ndk-build I get a dissapointing
sslx: LOCAL_SRC_FILES points to a missing file. Check that /home/user/Development/Tools/sdk/android/ndk/build/core//home/user/Development/Tools/sdk/android/ndk/build/core/includes/precompiled/libssh.so exists or that its path is correct. Aborting . Stop.
as you can already guess the path is totally wrong, and what confuses me is that ${LOCAL_PATH} returns correct path for the first batch of includes and a completely wrong one for the .so files ... Any help would be really appreciated!