[openssl-users] Android openssl linking

Onur Tuna onurtuna.lj at gmail.com
Tue Aug 9 12:03:41 UTC 2016


Dear openssl users,

I have an issue on linking libcrypto and libssl.so to my project. I'm using
Android Studio 2.2 and everything about C++ worked properly so far.

I have used the shell scripts in the following link:
https://github.com/stdchpie/android-openssl. 6 for each .so file have been
obtained as arm64-v8a, armeabi, mips, mips64, x86, x86_64. The project
structure is attached with this e-mail. I don't have an Android.mk file but
build.gradle(app). I'm trying to link these libraries, which I think
they're wrong or have missing things, using the part of the gradle script
below:

cmake {
    cppFlags "-std=c++11 -frtti -fexceptions -DWITH_NONAMESPACES -DWITH_OPENSSL"
    cppFlags.add("-I${file("src/main/include")}".toString())
    cppFlags.add("-L${file("src/main/jniLibs")}".toString())
}

The script above is enclosed inside externalNativeBuild which enclosed
inside android.

[image: Inline image 1]

The error I'm getting is as below:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> com.android.ide.common.process.ProcessException: Error while executing '/Users/onurtuna/Library/Android/sdk/cmake/bin/cmake' with arguments {--build /Users/onurtuna/AndroidStudioProjects/theProject/app/.externalNativeBuild/cmake/debug/mips64 --target service-lib}
  [1/18] Building CXX object
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/envC.cpp.o
  [2/18] Building CXX object
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/stdsoap2.cpp.o
  [3/18] Building CXX object
CMakeFiles/service-lib.dir/src/main/cpp/ServiceManagerClient.cpp.o

  .....

  .....

  [18/18] Linking CXX shared library ../obj/mips64/libservice-lib.so
  FAILED: : && /Users/onurtuna/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-gcc
 -fPIC -fexceptions -frtti -Wno-psabi
--sysroot=/Users/onurtuna/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-mips64
-fno-strict-aliasing -finline-functions -funwind-tables
-fmessage-length=0 -fno-inline-functions-called-once
-fgcse-after-reload -frerun-cse-after-loop -frename-registers
-fsigned-char -no-canonical-prefixes -fdata-sections
-ffunction-sections -Wa,--noexecstack -std=c++11 -frtti -fexceptions
-DWITH_NONAMESPACES -DWITH_OPENSSL
-I/Users/onurtuna/AndroidStudioProjects/theProject/app/src/main/include
-B/Users/onurtuna/AndroidStudioProjects/theProject/app/src/main/jniLibs
-fno-omit-frame-pointer -O0 -g -DDEBUG -D_DEBUG  -Wl,--no-undefined
-Wl,-allow-shlib-undefined -Wl,--gc-sections -Wl,-z,noexecstack
-Wl,-z,relro -Wl,-z,now -Wl,--build-id -shared
-Wl,-soname,libservice-lib.so -o ../obj/mips64/libservice-lib.so
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/envC.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/stdsoap2.cpp.o
CMakeFiles/service-lib.dir/src/main/cpp/ServiceManagerClient.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/ServiceManagerIVSOSServiceManagerProxy.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/ServiceManagerC.cpp.o
CMakeFiles/service-lib.dir/src/main/cpp/SessionManagerClient.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/SessionManagerC.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/SessionManagerIVSOSSessionManagerProxy.cpp.o
CMakeFiles/service-lib.dir/src/main/cpp/CameraManagerClient.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/CameraManagerC.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/CameraManagerIVSOSEncoderManagerProxy.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/DVR_WebServiceC.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/DVR_WebServiceinfodifDVRProxy.cpp.o
CMakeFiles/service-lib.dir/src/main/cpp/NvrManagerClient.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/NvrManagerC.cpp.o
CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/NvrManagerIVSOSNvrManagerProxy.cpp.o
CMakeFiles/service-lib.dir/src/main/cpp/SslInit.cpp.o
-L/Users/onurtuna/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/user/libs/mips64
 "/Users/onurtuna/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/libgnustl_static.a"
"/Users/onurtuna/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/libsupc++.a"
-lm && :


  CMakeFiles/service-lib.dir/Users/onurtuna/AndroidStudioProjects/Proxy/stdsoap2.cpp.o:
In function `fsend':
  /Users/onurtuna/AndroidStudioProjects/Proxy/stdsoap2.cpp:591:
undefined reference to `SSL_write'

  .....

  .....

  /Users/onurtuna/AndroidStudioProjects/theProject/app/src/main/cpp/SslInit.cpp:81:
undefined reference to `CRYPTO_num_locks'
  collect2: error: ld returned 1 exit status
  ninja: build stopped: subcommand failed.

Thank you very much in advance.

Kindly,

Onur

-- 
Onur Tuna,

Web: http://onurtuna.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20160809/6bac9249/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-08-09 at 14.50.45.png
Type: image/png
Size: 40879 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20160809/6bac9249/attachment-0001.png>


More information about the openssl-users mailing list