I am trying to build boringssl for Android's armeabi-v7a. I looked at the boringssl git document and built it.
//termanal
cmake -DANDROID_ABI=armeabi-v7a \
-DANDROID_PLATFORM=android-21 \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake \
-DBUILD_SHARED_LIBS=1 \
-GNinja -B build
ninja -C build
When you run the above command in the terminal, the boringssl/build directory is created and .so and build files are created inside the directory.
I put libcrypto.so, libssl.so in app/opensslSO/libs in android project. Header files are placed in app/opensslSO/include.
I wrote CMakeLists.txt for library linking.
cmake_minimum_required(VERSION 3.18.1)
# OpenSSL 라이브러리 경로 설정
set(OPENSSL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/opensslSO/include")
set(OPENSSL_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/opensslSO/libs")
include_directories(
${OPENSSL_INCLUDE_DIR}
)
add_library(crypto SHARED IMPORTED)
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIBRARY_DIR}/libcrypto.so)
add_library(ssl SHARED IMPORTED)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIBRARY_DIR}/libssl.so)
add_library(pki SHARED IMPORTED)
set_target_properties(pki PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIBRARY_DIR}/libpki.so)
add_library(decrepit SHARED IMPORTED)
set_target_properties(decrepit PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIBRARY_DIR}/libdecrepit.so)
add_library( score_printer
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
my_native_file_path
)
target_link_libraries( native_lib
crypto
ssl
pki
decrepit
android
log
EGL
GLESv1_CM
)
I thought it would work fine, but I get an error.
/opensslSO/libs/libcrypto.so: error adding symbols: File in wrong format
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

abiFiltersin your gradle script so that your other native code also is built only for armeabi-v7a? Also, what isnative_lib? Did you meanscore_printer?