안녕하세요

 

안드로이드에서 openssl사용하기 위해서

다운받은 소스를 가지고 openssl사용을 위한 static library 를 생성하였습니다.

 

cygwin을 이용하였구요

 

StaticLibrary  : libcrypto-static.a
StaticLibrary  : libssl-static.a
Executable     : openssl
Install        : openssl => libs/armeabi/openssl

2개의 파일 만드는데 성공했습니다.

 

만든 라이브러리를 다른 c파일에서 사용하기 위해

mk파일을 아래와 같이 만들어서 ndk-build를 했는데요

 

//////////////////////////////////////////////////////////////////////////////////

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)


LOCAL_C_INCLUDES := /cygdrive/d/android-openssl/jni/include


LOCAL_MODULE    := ndk-test
LOCAL_SRC_FILES := test.c


LOCAL_STATIC_LIBRARIES := libcrypto-static
LOCAL_LDLIBS += -ldl

 

include $(BUILD_SHARED_LIBRARY)

////////////////////////////////////////////////////////////////////////////////////

 

 

$ /cygdrive/d/android/android-ndk/ndk-build -B
Compile thumb  : ndk-test <= test.c
SharedLibrary  : libndk-test.so
D:/android/Workspace/NdkTest/obj/local/armeabi/objs/ndk-test/test.o: In function `use_ssl':
D:/android/Workspace/NdkTest/jni/test.c:93: undefined reference to `SSL_load_error_strings'
D:/android/Workspace/NdkTest/jni/test.c:94: undefined reference to `SSL_library_init'
D:/android/Workspace/NdkTest/jni/test.c:96: undefined reference to `SSLv3_method'
D:/android/Workspace/NdkTest/jni/test.c:97: undefined reference to `SSL_CTX_new'
D:/android/Workspace/NdkTest/jni/test.c:127: undefined reference to `RAND_screen'
D:/android/Workspace/NdkTest/jni/test.c:130: undefined reference to `SSL_new'
D:/android/Workspace/NdkTest/jni/test.c:136: undefined reference to `SSL_set_fd'
D:/android/Workspace/NdkTest/jni/test.c:137: undefined reference to `SSL_connect'
D:/android/Workspace/NdkTest/jni/test.c:144: undefined reference to `SSL_get_current_cipher'
D:/android/Workspace/NdkTest/jni/test.c:144: undefined reference to `SSL_CIPHER_get_name'
D:/android/Workspace/NdkTest/jni/test.c:148: undefined reference to `SSL_get_peer_certificate'
D:/android/Workspace/NdkTest/jni/test.c:159: undefined reference to `X509_get_subject_name'
D:/android/Workspace/NdkTest/jni/test.c:159: undefined reference to `X509_NAME_oneline'
D:/android/Workspace/NdkTest/jni/test.c:168: undefined reference to `X509_get_issuer_name'
D:/android/Workspace/NdkTest/jni/test.c:168: undefined reference to `X509_NAME_oneline'
D:/android/Workspace/NdkTest/jni/test.c:179: undefined reference to `X509_free'
D:/android/Workspace/NdkTest/jni/test.c:182: undefined reference to `SSL_write'
D:/android/Workspace/NdkTest/jni/test.c:190: undefined reference to `SSL_read'
D:/android/Workspace/NdkTest/jni/test.c:201: undefined reference to `SSL_shutdown'
D:/android/Workspace/NdkTest/jni/test.c:203: undefined reference to `closesocket'
D:/android/Workspace/NdkTest/jni/test.c:204: undefined reference to `SSL_free'
D:/android/Workspace/NdkTest/jni/test.c:205: undefined reference to `SSL_CTX_free'
collect2: ld returned 1 exit status
make: *** [/cygdrive/d/android/Workspace/NdkTest/obj/local/armeabi/libndk-test.so] 오류 1

 

 

 

 

http://choizak.tistory.com/63 에 있는 걸 따라했습니다.

 

링크가 잘못된거 같은데요.... ㅠㅠ

라이브러리는 컴파일하는 위치에다가 가져다놨습니다.

 

어떤 부분이 잘못된건가요???