I'm including OpenSSL in my Android project using david-hoze/build-openssl-android: Builds openssl 1.1.0h with android ndk r17..
This is my setup:
Android Studio 3.2
NDK version: 18.0.5002713
This is my app's build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def my_openssl_dir = getRootDir().toString() + "/build-openssl-android/openssl-lib"
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.my-company.my-app"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++17 -frtti -fexceptions"
arguments '-DANDROID_STL=c++_shared'
arguments '-DMY_OPENSSL_DIR=' + my_openssl_dir
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets {
main {
jniLibs.srcDirs = [
]
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.30'
}
This is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.4.1)
include_directories( src/main/cpp/
)
add_library( # Sets the name of the library.
my-library
SHARED
src/main/cpp/my-code.cpp
)
find_library (log-lib log)
add_library(libcrypto STATIC IMPORTED)
set_target_properties(libcrypto PROPERTIES IMPORTED_LOCATION
${MY_OPENSSL_DIR}/${ANDROID_ABI}/libcrypto.a)
add_library(libssl STATIC IMPORTED)
set_target_properties(libssl PROPERTIES IMPORTED_LOCATION
${MY_OPENSSL_DIR}/${ANDROID_ABI}/libssl.a)
target_include_directories(nativ PRIVATE
${MY_OPENSSL_DIR}/${ANDROID_ABI}/include
)
target_link_libraries( # Specifies the target library.
my-library
libcrypto
libssl
${log-lib}
)
And I'm getting these errors while compiling:
Build command failed. Error while executing process
/home/david/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments
{--build
/home/david/dev/android/MyApplication/app/.externalNativeBuild/cmake/debug/x86_64
--target my-library} [1/1] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/x86_64/libnativ.so
FAILED: : &&
/home/david/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
--target=x86_64-none-linux-android21 --gcc-toolchain=/home/david/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64
--sysroot=/home/david/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem /home/david/Android/Sdk/ndk-bundle/sysroot/usr/include/x86_64-linux-android
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -std=c++17 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /home/david/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/home/david/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86_64
-Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnativ.so -o ../../../../build/intermediates/cmake/debug/obj/x86_64/libnativ.so
CMakeFiles/my-library.dir/src/main/cpp/my-code.cpp.o
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libcrypto.a
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a
/home/david/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64/usr/lib64/liblog.so
-latomic -lm "/home/david/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so"
&& :
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
do_load_builtin_compressions_ossl_: error: undefined reference to
'COMP_get_type'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
do_load_builtin_compressions_ossl_: error: undefined reference to
'COMP_get_name'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
ssl_cipher_get_evp: error: undefined reference to 'FIPS_mode'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
ssl_cipher_get_evp: error: undefined reference to 'EVP_enc_null'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
ssl_create_cipher_list: error: undefined reference to 'FIPS_mode'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
ssl_create_cipher_list: error: undefined reference to 'FIPS_mode'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
SSL_COMP_add_compression_method: error: undefined reference to
'COMP_get_type'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_ciph.o):ssl_ciph.c:function
SSL_COMP_get_name: error: undefined reference to 'COMP_get_name'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_conf.o):ssl_conf.c:function
cmd_VerifyCAFile: error: undefined reference to
'X509_STORE_load_locations'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_conf.o):ssl_conf.c:function
cmd_ChainCAPath: error: undefined reference to
'X509_STORE_load_locations'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_conf.o):ssl_conf.c:function
cmd_ChainCAFile: error: undefined reference to
'X509_STORE_load_locations'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_conf.o):ssl_conf.c:function
cmd_VerifyCAPath: error: undefined reference to
'X509_STORE_load_locations'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_read: error: undefined reference to 'ASYNC_WAIT_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_peek: error: undefined reference to 'ASYNC_WAIT_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_write: error: undefined reference to 'ASYNC_WAIT_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_shutdown: error: undefined reference to 'ASYNC_WAIT_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_CTX_new: error: undefined reference to 'FIPS_mode'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_clear_cipher_ctx: error: undefined reference to 'COMP_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_clear_cipher_ctx: error: undefined reference to 'COMP_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_CTX_set_default_verify_dir: error: undefined reference to
'X509_LOOKUP_hash_dir'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_CTX_set_default_verify_file: error: undefined reference to
'X509_LOOKUP_file'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_free: error: undefined reference to 'ASYNC_WAIT_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get0_peer_scts: error: undefined reference to
'OCSP_response_get1_basic'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get0_peer_scts: error: undefined reference to 'OCSP_resp_count'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get0_peer_scts: error: undefined reference to 'OCSP_resp_get0'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get0_peer_scts: error: undefined reference to
'OCSP_SINGLERESP_get1_ext_d2i'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_set1_cert'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_set1_issuer'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_set_time'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
ssl_validate_ct: error: undefined reference to
'CT_POLICY_EVAL_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get_all_async_fds: error: undefined reference to
'ASYNC_WAIT_CTX_get_all_fds'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get_changed_async_fds: error: undefined reference to
'ASYNC_WAIT_CTX_get_changed_fds'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get_current_compression: error: undefined reference to
'COMP_CTX_get_method'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_get_current_expansion: error: undefined reference to
'COMP_CTX_get_method'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_lib.o):ssl_lib.c:function
SSL_CTX_set_default_verify_paths: error: undefined reference to
'X509_STORE_set_default_paths'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_use_certificate_file: error: undefined reference to
'PEM_read_bio_X509'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_use_RSAPrivateKey_file: error: undefined reference to
'PEM_read_bio_RSAPrivateKey'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_CTX_use_certificate_file: error: undefined reference to
'PEM_read_bio_X509'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_CTX_use_RSAPrivateKey_file: error: undefined reference to
'PEM_read_bio_RSAPrivateKey'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_CTX_use_certificate_chain_file: error: undefined reference to
'PEM_read_bio_X509_AUX'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_CTX_use_certificate_chain_file: error: undefined reference to
'PEM_read_bio_X509'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_use_certificate_chain_file: error: undefined reference to
'PEM_read_bio_X509_AUX'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_rsa.o):ssl_rsa.c:function
SSL_use_certificate_chain_file: error: undefined reference to
'PEM_read_bio_X509'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(statem_clnt.o):statem_clnt.c:function
ssl3_check_cert_and_algorithm: error: undefined reference to
'X509_certificate_type'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(statem_srvr.o):statem_srvr.c:function
tls_process_cert_verify: error: undefined reference to
'X509_certificate_type'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(t1_lib.o):t1_lib.c:function
ssl_get_auto_dh: error: undefined reference to
'BN_get_rfc3526_prime_3072'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(t1_lib.o):t1_lib.c:function
ssl_get_auto_dh: error: undefined reference to
'BN_get_rfc3526_prime_8192'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
SSL_srp_server_param_with_username: error: undefined reference to
'SRP_Calc_B'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
SSL_set_srp_server_param_pw: error: undefined reference to
'SRP_get_default_gN'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
SSL_set_srp_server_param_pw: error: undefined reference to
'SRP_create_verifier_BN'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_server_master_secret: error: undefined reference to
'SRP_Verify_A_mod_N'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_server_master_secret: error: undefined reference to
'SRP_Calc_u'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_server_master_secret: error: undefined reference to
'SRP_Calc_server_key'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_client_master_secret: error: undefined reference to
'SRP_Verify_B_mod_N'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_client_master_secret: error: undefined reference to
'SRP_Calc_u'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_client_master_secret: error: undefined reference to
'SRP_Calc_x'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_generate_client_master_secret: error: undefined reference to
'SRP_Calc_client_key'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
srp_verify_server_param: error: undefined reference to
'SRP_check_known_gN_param'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(tls_srp.o):tls_srp.c:function
SRP_Calc_A_param: error: undefined reference to 'SRP_Calc_A'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl3_record.o):ssl3_record.c:function
ssl3_do_uncompress: error: undefined reference to 'COMP_expand_block'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl3_record.o):ssl3_record.c:function
ssl3_do_compress: error: undefined reference to 'COMP_compress_block'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(s3_enc.o):s3_enc.c:function
ssl3_change_cipher_state: error: undefined reference to
'COMP_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(s3_enc.o):s3_enc.c:function
ssl3_change_cipher_state: error: undefined reference to 'COMP_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(s3_enc.o):s3_enc.c:function
ssl3_change_cipher_state: error: undefined reference to
'COMP_CTX_free'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(s3_enc.o):s3_enc.c:function
ssl3_change_cipher_state: error: undefined reference to 'COMP_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'UINT32_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'INT32_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'ZINT64_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'ZINT64_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'ZINT32_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'ZUINT64_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_asn1.o):ssl_asn1.c:SSL_SESSION_ASN1_seq_tt:
error: undefined reference to 'ZUINT64_it'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_cert.o):ssl_cert.c:function
SSL_add_dir_cert_subjects_to_stack: error: undefined reference to
'OPENSSL_DIR_read'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_cert.o):ssl_cert.c:function
SSL_add_dir_cert_subjects_to_stack: error: undefined reference to
'OPENSSL_DIR_end'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(ssl_cert.o):ssl_cert.c:function
ssl_build_cert_chain: error: undefined reference to
'X509_verify_cert_error_string'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(t1_enc.o):t1_enc.c:function
tls1_change_cipher_state: error: undefined reference to 'COMP_CTX_new'
/home/david/dev/android/MyApplication/build-openssl-android/openssl-lib/x86_64/libssl.a(t1_enc.o):t1_enc.c:function
tls1_change_cipher_state: error: undefined reference to 'COMP_CTX_new'
clang++: error: linker command failed with exit code 1 (use -v to see
invocation) ninja: build stopped: subcommand failed.
Would appreciate your help.
The problem was the link order, I changed the order of libssl and libcrypto in my CMakelists.txt file like so:
cmake_minimum_required(VERSION 3.4.1)
include_directories( src/main/cpp/
)
add_library( # Sets the name of the library.
my-library
SHARED
src/main/cpp/my-code.cpp
)
find_library (log-lib log)
add_library(libcrypto STATIC IMPORTED)
set_target_properties(libcrypto PROPERTIES IMPORTED_LOCATION
${MY_OPENSSL_DIR}/${ANDROID_ABI}/libcrypto.a)
add_library(libssl STATIC IMPORTED)
set_target_properties(libssl PROPERTIES IMPORTED_LOCATION
${MY_OPENSSL_DIR}/${ANDROID_ABI}/libssl.a)
target_include_directories(nativ PRIVATE
${MY_OPENSSL_DIR}/${ANDROID_ABI}/include
)
target_link_libraries( # Specifies the target library.
my-library
libssl
libcrypto
${log-lib}
)
And it compiles fine
Related
I am trying to start project:
https://mechatronicsblog.com/tensorflow-lite-integration-with-qt-and-v-play-for-multi-platform-machine-learning-apps-on-ios-and-android/
But there is an issue - Tensorflow submodule is incorrect.
I downloaded Tensorflow library from main repo by the following command:
git clone https://github.com/tensorflow/tensorflow.git
Then I updated dependencies:
tensorflow/lite/tools/make/download_dependencies.sh
Then I built the library by the following command:
bazel build --cxxopt='-D_GLIBCXX_USE_CXX11_ABI=0' -c opt --config=android_arm tensorflow/lite/java:libtensorflowlite_jni
Here's what WORKSPACE looks like:
android_sdk_repository(
name = "androidsdk",
api_level = 21,
build_tools_version = "26.0.2",
path = "/home/user/Android/SDK",
)
android_ndk_repository(
name = "androidndk",
api_level = 20,
path = "/home/user/android-ndk-r20b",
)
The result was successful.
Then I copied the library folder and pasted it in the root of the project folder.
I did not change .pro file
# TensorFlow Lite - Global
TENSORFLOW_PATH = $$PWD/tensorflow/
TFLITE_MAKE_PATH = $$TENSORFLOW_PATH/tensorflow/lite/tools/make
INCLUDEPATH += $$TENSORFLOW_PATH \
$$TFLITE_MAKE_PATH/downloads/ \
$$TFLITE_MAKE_PATH/downloads/eigen \
$$TFLITE_MAKE_PATH/downloads/gemmlowp \
$$TFLITE_MAKE_PATH/downloads/neon_2_sse \
$$TFLITE_MAKE_PATH/downloads/farmhash/src \
$$TFLITE_MAKE_PATH/downloads/flatbuffers/include
# TensorFlow Lite - Linux
linux:!android {
INCLUDEPATH += -L$$TFLITE_MAKE_PATH/gen/linux_x86_64/obj
LIBS += -L$$TFLITE_MAKE_PATH/gen/linux_x86_64/lib/ \
-ltensorflow-lite -ldl
}
# TensorFlow Lite - Android - armv7a
android {
QT += androidextras
LIBS += -L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/c \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/core/api \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/kernels \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/kernels/internal \
-L$$TENSORFLOW_PATH/bazel-bin/external/androidndk \
-L$$TENSORFLOW_PATH/bazel-bin/external/farmhash_archive \
-L$$TENSORFLOW_PATH/bazel-bin/external/fft2d \
-L$$TENSORFLOW_PATH/bazel-bin/external/flatbuffers \
-lframework -larena_planner -lsimple_memory_arena -lutil -lapi -lc_api_internal \
-lbuiltin_ops -lbuiltin_op_kernels -lkernel_util -leigen_support -lgemm_support \
-laudio_utils -lkernel_utils -ltensor_utils -lneon_tensor_utils -lquantization_util \
-llstm_eval -lstring_util -lcpufeatures -lfarmhash -lfft2d -lflatbuffers
}
# TensorFlow Lite - iOS - Universal library
ios {
LIBS += -L$$TFLITE_MAKE_PATH/gen/lib/ \
-framework Accelerate \
-ltensorflow-lite
}
Then I built it up in the following project environment:
Qt Creator 4.11.2
Android NDK 20.1.5948944
Android SDK 26.1.1
Compiler Clang Qt 5.13.2 for Android ARMv7
JVM java-8-oracle
The result was failed.
Error:
/home/user/FelgoProjects/TensorFlowLiteQtVPlay/tensorflow/tensorflow/lite/delegates/nnapi/nnapi_delegate.h:23: error: 'absl/types/optional.h' file not found
#include "absl/types/optional.h"
I would like to know how to build up and include Tensorflow library for Qt project.
EDITED:
I edited .pro file to add libraries:
# TensorFlow Lite - Global
TENSORFLOW_PATH = $$PWD/tensorflow/
TFLITE_MAKE_PATH = $$TENSORFLOW_PATH/tensorflow/lite/tools/make
INCLUDEPATH += $$TENSORFLOW_PATH \
$$TFLITE_MAKE_PATH/downloads/ \
$$TFLITE_MAKE_PATH/downloads/eigen \
$$TFLITE_MAKE_PATH/downloads/gemmlowp \
$$TFLITE_MAKE_PATH/downloads/neon_2_sse \
$$TFLITE_MAKE_PATH/downloads/farmhash/src \
$$TFLITE_MAKE_PATH/downloads/flatbuffers/include
# TensorFlow Lite - Android - armv7a
android {
QT += androidextras
LIBS += -L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/c \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/core/api \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/kernels \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/kernels/internal \
-L$$TENSORFLOW_PATH/bazel-bin/tensorflow/lite/nnapi \
-L$$TENSORFLOW_PATH/bazel-bin/external/androidndk \
-L$$TENSORFLOW_PATH/bazel-bin/external/farmhash_archive \
-L$$TENSORFLOW_PATH/bazel-bin/external/fft2d \
-L$$TENSORFLOW_PATH/bazel-bin/external/flatbuffers \
-L$$TENSORFLOW_PATH/bazel-bin/external/flatbuffers/src \
-L$$TENSORFLOW_PATH/bazel-bin/external/ruy/ruy \
-L$$TENSORFLOW_PATH/bazel-bin/external/ruy/ruy/profiler \
-lallocation.pic -larena_planner.pic -larena_planner.pic -lminimal_logging.pic \
-lsimple_memory_arena.pic -lstring_util.pic -lutil.pic \
-lapi.pic -lbuiltin_op_kernels.pic -lbuiltin_ops.pic -lcpu_backend_context.pic -lcpu_backend_gemm.pic -leigen_support.pic \
-lkernel_util.pic -llstm_eval.pic -laudio_utils.pic -lkernel_utils.pic -lneon_tensor_utils.pic \
-lportable_tensor_utils.pic -ltensor_utils.pic -lquantization_util.pic -ltranspose_utils.pic \
-lfarmhash.pic -lfft2d.pic -lflatbuffers.pic \
-lallocator.pic -lapply_multiplier.pic -lblocking_counter.pic -lblock_map.pic -lcontext.pic -lcontext_get_ctx.pic \
-lctx.pic -ldetect_arm.pic -ldetect_x86.pic -lhave_built_path_for_avx2.pic -lhave_built_path_for_avx512.pic \
-lhave_built_path_for_avxvnni.pic -lhave_built_path_for_sse42.pic -lkernel_arm.pic -lkernel_avx2.pic \
-lkernel_avx512.pic -lkernel_avxvnni.pic -lkernel_sse42.pic -lpack_arm.pic -lpack_avx2.pic -lpack_avx512.pic \
-lpack_avxvnni.pic -lpack_sse42.pic -lprepacked_cache.pic -lthread_pool.pic -ltrace.pic -ltrmul.pic \
-ltune.pic -lwait.pic -linstrumentation.pic -lnnapi_implementation.pic -lnnapi_util.pic
}
There are some errors after building.
tensorflow/lite/util.cc:47: error: undefined reference to 'TfLiteIntArrayCreate'
tensorflow/lite/util.cc:47: error: undefined reference to 'TfLiteIntArrayCreate'
tensorflow/lite/kernels/activations.cc:265: error: undefined reference to 'TfLiteIntArrayCopy'
tensorflow/lite/kernels/activations.cc:291: error: undefined reference to 'TfLiteIntArrayCopy'
tensorflow/lite/kernels/activations.cc:380: error: undefined reference to 'TfLiteIntArrayCopy'
tensorflow/lite/kernels/activations.cc:612: error: undefined reference to 'TfLiteIntArrayCopy'
tensorflow/lite/kernels/activations.cc:729: error: undefined reference to 'TfLiteTypeGetName'
tensorflow/lite/kernels/activations.cc:757: error: undefined reference to 'TfLiteTypeGetName'
tensorflow/lite/kernels/activations.cc:840: error: undefined reference to 'TfLiteTypeGetName'
tensorflow/lite/kernels/activations.cc:1084: error: undefined reference to 'TfLiteTypeGetName'
tensorflow/lite/kernels/arg_min_max.cc:40: error: undefined reference to 'TfLiteIntArrayCreate'
tensorflow/lite/kernels/arg_min_max.cc:40: error: undefined reference to 'TfLiteIntArrayCreate'
tensorflow/lite/kernels/basic_rnn.cc:104: error: undefined reference to 'TfLiteIntArrayFree'
tensorflow/lite/kernels/basic_rnn.cc:110: error: undefined reference to 'TfLiteIntArrayEqual'
tensorflow/lite/kernels/basic_rnn.cc:120: error: undefined reference to 'TfLiteIntArrayEqual'
tensorflow/lite/kernels/basic_rnn.cc:133: error: undefined reference to 'TfLiteIntArrayEqualsArray'
tensorflow/lite/kernels/basic_rnn.cc:144: error: undefined reference to 'TfLiteIntArrayEqualsArray'
tensorflow/lite/kernels/basic_rnn.cc:157: error: undefined reference to 'TfLiteIntArrayEqualsArray'
tensorflow/lite/kernels/basic_rnn.cc:168: error: undefined reference to 'TfLiteIntArrayEqualsArray'
tensorflow/lite/kernels/batch_matmul.cc:108: error: undefined reference to 'TfLiteIntArrayFree'
tensorflow/lite/kernels/bidirectional_sequence_lstm.cc:527: error: undefined reference to 'TfLiteIntArrayFree'
tensorflow/lite/kernels/bidirectional_sequence_lstm.cc:527: error: undefined reference to 'TfLiteIntArrayFree'
tensorflow/lite/kernels/bidirectional_sequence_lstm.cc:630: error: undefined reference to 'TfLiteIntArrayEqual'
tensorflow/lite/kernels/bidirectional_sequence_lstm.cc:642: error: undefined reference to 'TfLiteIntArrayEqual'
./tensorflow/lite/kernels/internal/reference/densify.h:36: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<float>::FormatConverter(std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, TfLiteSparsity const&)'
./tensorflow/lite/kernels/internal/reference/densify.h:38: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<float>::SparseToDense(float const*)'
./tensorflow/lite/kernels/internal/reference/densify.h:36: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<signed char>::FormatConverter(std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, TfLiteSparsity const&)'
./tensorflow/lite/kernels/internal/reference/densify.h:38: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<signed char>::SparseToDense(signed char const*)'
tensorflow/lite/kernels/embedding_lookup_sparse.cc:178: error: undefined reference to 'TfLiteTensorRealloc'
tensorflow/lite/kernels/expand_dims.cc:105: error: undefined reference to 'TfLiteTensorRealloc'
./tensorflow/lite/kernels/internal/reference/sparse_ops/fully_connected.h:35: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<float>::FormatConverter(std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, TfLiteSparsity const&)'
./tensorflow/lite/kernels/internal/reference/sparse_ops/fully_connected.h:37: error: undefined reference to 'tflite::optimize::sparsity::FormatConverter<float>::SparseToDense(float const*)'
tensorflow/lite/kernels/if.cc:85: error: undefined reference to 'tflite::impl::Subgraph::ResizeInputTensor(int, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'
tensorflow/lite/kernels/if.cc:92: error: undefined reference to 'tflite::impl::Subgraph::AllocateTensors()'
tensorflow/lite/kernels/if.cc:85: error: undefined reference to 'tflite::impl::Subgraph::ResizeInputTensor(int, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'
tensorflow/lite/kernels/if.cc:92: error: undefined reference to 'tflite::impl::Subgraph::AllocateTensors()'
tensorflow/lite/kernels/if.cc:155: error: undefined reference to 'tflite::impl::Subgraph::Invoke()'
tensorflow/lite/kernels/reshape.cc:156: error: undefined reference to 'TfLiteTensorRealloc'
tensorflow/lite/kernels/while.cc:152: error: undefined reference to 'tflite::impl::Subgraph::AllocateTensors()'
tensorflow/lite/kernels/while.cc:170: error: undefined reference to 'tflite::impl::Subgraph::AllocateTensors()'
tensorflow/lite/kernels/while.cc:57: error: undefined reference to 'tflite::impl::Subgraph::ResizeInputTensor(int, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'
tensorflow/lite/kernels/while.cc:267: error: undefined reference to 'tflite::impl::Subgraph::Invoke()'
tensorflow/lite/kernels/while.cc:292: error: undefined reference to 'tflite::impl::Subgraph::Invoke()'
tensorflow/lite/kernels/while.cc:57: error: undefined reference to 'tflite::impl::Subgraph::ResizeInputTensor(int, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'
tensorflow/lite/kernels/register.cc:34: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:35: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:36: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int, int)'
tensorflow/lite/kernels/register.cc:38: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:39: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int, int)'
tensorflow/lite/kernels/register.cc:41: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int, int)'
tensorflow/lite/kernels/register.cc:43: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int, int)'
tensorflow/lite/kernels/register.cc:52: error: undefined reference to 'tflite::MutableOpResolver::AddBuiltin(tflite::BuiltinOperator, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:291: error: undefined reference to 'tflite::MutableOpResolver::AddCustom(char const*, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:294: error: undefined reference to 'tflite::MutableOpResolver::AddCustom(char const*, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:295: error: undefined reference to 'tflite::MutableOpResolver::AddCustom(char const*, TfLiteRegistration const*, int)'
tensorflow/lite/kernels/register.cc:297: error: undefined reference to 'tflite::MutableOpResolver::AddCustom(char const*, TfLiteRegistration const*, int)'
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include/unordered_map:0: error: undefined reference to 'vtable for tflite::MutableOpResolver'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
./tensorflow/lite/kernels/register.h:0: error: undefined reference to 'vtable for tflite::MutableOpResolver'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/sergey/FelgoProjects/TensorFlowLiteQtVPlay/tensorflow//bazel-bin/tensorflow/lite/kernels/libbuiltin_ops.pic.a(register.pic.o):register.cc:vtable for tflite::ops::builtin::BuiltinOpResolver: error: undefined reference to 'tflite::MutableOpResolver::FindOp(tflite::BuiltinOperator, int) const'
/home/sergey/FelgoProjects/TensorFlowLiteQtVPlay/tensorflow//bazel-bin/tensorflow/lite/kernels/libbuiltin_ops.pic.a(register.pic.o):register.cc:vtable for tflite::ops::builtin::BuiltinOpResolver: error: undefined reference to 'tflite::MutableOpResolver::FindOp(char const*, int) const'
/home/sergey/FelgoProjects/TensorFlowLiteQtVPlay/tensorflow//bazel-bin/tensorflow/lite/kernels/libbuiltin_ops.pic.a(register.pic.o):register.cc:typeinfo for tflite::ops::builtin::BuiltinOpResolver: error: undefined reference to 'typeinfo for tflite::MutableOpResolver'
../../Felgo/Felgo/android_armv7/include/QtQml/qqml.h:0: error: undefined reference to 'ObjectsRecogFilter::staticMetaObject'
../../Felgo/Felgo/android_armv7/include/QtQml/qqml.h:0: error: undefined reference to 'ObjectsRecogFilter::staticMetaObject'
../TensorFlowLiteQtVPlay/auxutils.h:0: error: undefined reference to 'vtable for AuxUtils'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../Felgo/Felgo/android_armv7/include/QtCore/qmetatype.h:0: error: undefined reference to 'ObjectsRecogFilter::staticMetaObject'
../../Felgo/Felgo/android_armv7/include/QtCore/qmetatype.h:0: error: undefined reference to 'ObjectsRecogFilter::staticMetaObject'
../TensorFlowLiteQtVPlay/objectsrecogfilter.h:0: error: undefined reference to 'vtable for ObjectsRecogFilter'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflowthread.h:0: error: undefined reference to 'vtable for TensorflowThread'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflowthread.h:0: error: undefined reference to 'vtable for WorkerTF'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflow/tensorflow/lite/mutable_op_resolver.h:0: error: undefined reference to 'vtable for tflite::MutableOpResolver'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/sergey/android-ndk-r20b/sources/cxx-stl/llvm-libc++/include/memory:2339: error: undefined reference to 'tflite::FlatBufferModel::~FlatBufferModel()'
/home/sergey/android-ndk-r20b/sources/cxx-stl/llvm-libc++/include/memory:2339: error: undefined reference to 'tflite::impl::Interpreter::~Interpreter()'
main.o:main.cpp:vtable for QQmlPrivate::QQmlElement<ObjectsRecogFilter>: error: undefined reference to 'ObjectsRecogFilter::metaObject() const'
main.o:main.cpp:vtable for QQmlPrivate::QQmlElement<ObjectsRecogFilter>: error: undefined reference to 'ObjectsRecogFilter::qt_metacast(char const*)'
main.o:main.cpp:vtable for QQmlPrivate::QQmlElement<ObjectsRecogFilter>: error: undefined reference to 'ObjectsRecogFilter::qt_metacall(QMetaObject::Call, int, void**)'
main.o:main.cpp:typeinfo for QQmlPrivate::QQmlElement<ObjectsRecogFilter>: error: undefined reference to 'typeinfo for ObjectsRecogFilter'
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:16: error: undefined reference to 'ObjectsRecogFilter::initializedChanged(bool const&)'
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:0: error: undefined reference to 'vtable for ObjectsRecogFilter'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:161: error: undefined reference to 'ObjectsRecogFilter::runTensorFlow(QImage)'
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:300: error: undefined reference to 'ObjectsRecogFilter::initializedChanged(bool const&)'
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:248: error: undefined reference to 'ObjectsRecogFilter::initializedChanged(bool const&)'
../TensorFlowLiteQtVPlay/objectsrecogfilter.cpp:276: error: undefined reference to 'ObjectsRecogFilter::initializedChanged(bool const&)'
../TensorFlowLiteQtVPlay/tensorflowthread.cpp:16: error: undefined reference to 'WorkerTF::results(int, QStringList, QList<double>, QList<QRectF>, double)'
../TensorFlowLiteQtVPlay/tensorflowthread.cpp:17: error: undefined reference to 'WorkerTF::finished()'
../TensorFlowLiteQtVPlay/tensorflowthread.cpp:0: error: undefined reference to 'vtable for TensorflowThread'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflowthread.cpp:47: error: undefined reference to 'TensorflowThread::results(int, QStringList, QList<double>, QList<QRectF>, double)'
../TensorFlowLiteQtVPlay/tensorflowthread.h:0: error: undefined reference to 'vtable for WorkerTF'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:109: error: undefined reference to 'tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:118: error: undefined reference to 'tflite::impl::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:121: error: undefined reference to 'tflite::impl::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::impl::Interpreter, std::__ndk1::default_delete<tflite::impl::Interpreter> >*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:128: error: undefined reference to 'tflite::impl::Interpreter::UseNNAPI(bool)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:131: error: undefined reference to 'tflite::impl::Interpreter::SetNumThreads(int)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:136: error: undefined reference to 'tflite::impl::Interpreter::AllocateTensors()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:166: error: undefined reference to 'tflite::impl::InterpreterBuilder::~InterpreterBuilder()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:166: error: undefined reference to 'tflite::impl::InterpreterBuilder::~InterpreterBuilder()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:272: error: undefined reference to 'tflite::impl::Interpreter::Invoke()'
../TensorFlowLiteQtVPlay/tensorflow/tensorflow/lite/stderr_reporter.h:0: error: undefined reference to 'vtable for tflite::StderrReporter'
/home/sergey/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:316: error: undefined reference to 'tflite::DefaultErrorReporter()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:316: error: undefined reference to 'tflite::impl::Interpreter::Interpreter(tflite::ErrorReporter*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:321: error: undefined reference to 'tflite::impl::Interpreter::AddTensors(int, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:324: error: undefined reference to 'tflite::impl::Interpreter::AddTensors(int, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:327: error: undefined reference to 'tflite::impl::Interpreter::SetInputs(std::__ndk1::vector<int, std::__ndk1::allocator<int> >)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:328: error: undefined reference to 'tflite::impl::Interpreter::SetOutputs(std::__ndk1::vector<int, std::__ndk1::allocator<int> >)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:337: error: undefined reference to 'tflite::MutableOpResolver::FindOp(tflite::BuiltinOperator, int) const'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:340: error: undefined reference to 'tflite::impl::Interpreter::AddNodeWithParameters(std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, char const*, unsigned int, void*, TfLiteRegistration const*, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:341: error: undefined reference to 'tflite::impl::Interpreter::AllocateTensors()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:354: error: undefined reference to 'tflite::impl::Interpreter::Invoke()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:316: error: undefined reference to 'tflite::DefaultErrorReporter()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:316: error: undefined reference to 'tflite::impl::Interpreter::Interpreter(tflite::ErrorReporter*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:321: error: undefined reference to 'tflite::impl::Interpreter::AddTensors(int, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:324: error: undefined reference to 'tflite::impl::Interpreter::AddTensors(int, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:327: error: undefined reference to 'tflite::impl::Interpreter::SetInputs(std::__ndk1::vector<int, std::__ndk1::allocator<int> >)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:328: error: undefined reference to 'tflite::impl::Interpreter::SetOutputs(std::__ndk1::vector<int, std::__ndk1::allocator<int> >)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:337: error: undefined reference to 'tflite::MutableOpResolver::FindOp(tflite::BuiltinOperator, int) const'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:340: error: undefined reference to 'tflite::impl::Interpreter::AddNodeWithParameters(std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&, char const*, unsigned int, void*, TfLiteRegistration const*, int*)'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:341: error: undefined reference to 'tflite::impl::Interpreter::AllocateTensors()'
../TensorFlowLiteQtVPlay/tensorflowlite.cpp:354: error: undefined reference to 'tflite::impl::Interpreter::Invoke()'
../TensorFlowLiteQtVPlay/tensorflow/tensorflow/lite/interpreter.h:178: error: undefined reference to 'tflite::impl::Interpreter::SetTensorParametersReadWrite(int, TfLiteType, char const*, unsigned int, int const*, TfLiteQuantizationParams, bool, unsigned int, int const*)'
tensorflow/lite/string_util.cc:108: error: undefined reference to 'TfLiteTensorReset'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libTensorFlowLiteQtVPlay.so] Error 1
I am the author of this tutorial. Could you try to compile TensorFlow with libstdc++ by using this command as described in the tutorial:
bazel build --cxxopt='--std=c++11' -c opt --config=android_arm tensorflow/lite/java:libtensorflowlite_jni
Maybe your problem is related to mixing libc++ and libstdc++, Qt uses libstdc++ and you are compiling TensorFlow with libc++ in your bazel command.
Let me know if this helps.
I experience the same error as has been described here: Android NDK make. Hundreds of "undefined reference error"s
However, after we use the solution we get another type of error:
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:136: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:302: error: undefined reference to 'std::__ndk1::locale::~locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:302: error: undefined reference to 'std::__ndk1::locale::~locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:683: error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:683: error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:136: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:302: error: undefined reference to 'std::__ndk1::locale::~locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:302: error: undefined reference to 'std::__ndk1::locale::~locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:683: error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(Device.cpp.o):Device.cpp:function virtual thunk to std::__ndk1::basic_ostringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::~basic_ostringstream(): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:529: error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:529: error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:955: error: undefined reference to 'std::__ndk1::ios_base::__set_badbit_and_consider_rethrow()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:461: error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/__locale:212: error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:756: error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/__locale:212: error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:529: error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:472: error: undefined reference to 'std::__ndk1::ios_base::__set_badbit_and_consider_rethrow()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:461: error: undefined reference to 'std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:461: error: undefined reference to 'std::__ndk1::ctype<char>::id'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/istream:321: error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/__locale:212: error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:529: error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:193: error: undefined reference to 'std::__ndk1::ctype<char>::id'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/istream:713: error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/__locale:212: error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/istream:732: error: undefined reference to 'std::__ndk1::ios_base::__set_badbit_and_consider_rethrow()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/istream:730: error: undefined reference to 'std::__ndk1::num_get<char, std::__ndk1::istreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:739: error: undefined reference to 'std::__ndk1::ios_base::__set_badbit_and_consider_rethrow()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ostream:737: error: undefined reference to 'std::__ndk1::ctype<char>::id'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:690: error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:311: error: undefined reference to 'std::__ndk1::locale::locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:690: error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:311: error: undefined reference to 'std::__ndk1::locale::locale()'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:146: error: undefined reference to 'std::logic_error::logic_error(char const*)'
../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(Device.cpp.o):Device.cpp:typeinfo for std::__ndk1::basic_ios<char, std::__ndk1::char_traits<char> >: error: undefined reference to 'typeinfo for std::__ndk1::ios_base'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:136: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/ios:690: error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
/home/augustinas/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/streambuf:311: error: undefined reference to 'std::__ndk1::locale::locale()'
We have built caffe2 from source and updated our application's CMakeLists.txt as follows:
cmake_minimum_required(VERSION 3.4.1)
add_library(
native-lib
SHARED
src/main/cpp/native-lib.cpp
)
find_library(
android-lib
android
)
include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()
add_library(
caffe2
STATIC
IMPORTED
)
set_target_properties(
caffe2
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libcaffe2.a
)
add_library(
thread_pool
STATIC
IMPORTED
)
set_target_properties(
thread_pool
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libpthreadpool.a
)
add_library(
clog
SHARED
IMPORTED
)
set_target_properties(
clog
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libclog.a
)
add_library(
protobuf
SHARED
IMPORTED
)
set_target_properties(
protobuf
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libprotobuf.a
)
add_library(
NNPACK
STATIC
IMPORTED
)
set_target_properties(
NNPACK
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libnnpack.a
)
include_directories( src/main/cpp )
find_library(
log-lib
log
)
target_link_libraries(
native-lib
-Wl,--whole-archive
caffe2
-Wl,--no-whole-archive
NNPACK
thread_pool
clog
protobuf
cpufeatures
${log-lib}
${android-lib})
Please assist me for using libxml2 native-lib - XML parsing library in Android NDK using CMakeLists.txt configuration.
I found a source here. But do not know how to integrate this using CMakeLists.txt in AndroidStudio. And what need to include from this repository in my android-NDK project to use libxml2?
After some search and effort i found some solution. So i would like to answer my own question in following steps :
Clone the source from android/platform_external_libxml2 in your machine.
2.Add the required all source as well as header files at appropriate place in your project.
3.With the help of Android.bp file, i managed to configure my app/CMakeList.txt
4.Configure your app or library level build.gradle file.
Here is My CMakeLists.txt :
cmake_minimum_required(VERSION 3.4.1)
set(LIBXML2_SOURCES
src/main/cpp/libxml2/src/SAX.c
src/main/cpp/libxml2/src/entities.c
src/main/cpp/libxml2/src/encoding.c
src/main/cpp/libxml2/src/error.c
src/main/cpp/libxml2/src/parserInternals.c
src/main/cpp/libxml2/src/parser.c
src/main/cpp/libxml2/src/tree.c
src/main/cpp/libxml2/src/hash.c
src/main/cpp/libxml2/src/list.c
src/main/cpp/libxml2/src/xmlIO.c
src/main/cpp/libxml2/src/xmlmemory.c
src/main/cpp/libxml2/src/uri.c
src/main/cpp/libxml2/src/valid.c
src/main/cpp/libxml2/src/xlink.c
src/main/cpp/libxml2/src/debugXML.c
src/main/cpp/libxml2/src/xpath.c
src/main/cpp/libxml2/src/xpointer.c
src/main/cpp/libxml2/src/xinclude.c
src/main/cpp/libxml2/src/DOCBparser.c
src/main/cpp/libxml2/src/catalog.c
src/main/cpp/libxml2/src/globals.c
src/main/cpp/libxml2/src/threads.c
src/main/cpp/libxml2/src/c14n.c
src/main/cpp/libxml2/src/xmlstring.c
src/main/cpp/libxml2/src/buf.c
src/main/cpp/libxml2/src/xmlregexp.c
src/main/cpp/libxml2/src/xmlschemas.c
src/main/cpp/libxml2/src/xmlschemastypes.c
src/main/cpp/libxml2/src/xmlunicode.c
src/main/cpp/libxml2/src/xmlreader.c
src/main/cpp/libxml2/src/relaxng.c
src/main/cpp/libxml2/src/dict.c
src/main/cpp/libxml2/src/SAX2.c
src/main/cpp/libxml2/src/xmlwriter.c
src/main/cpp/libxml2/src/legacy.c
src/main/cpp/libxml2/src/chvalid.c
src/main/cpp/libxml2/src/pattern.c
src/main/cpp/libxml2/src/xmlsave.c
src/main/cpp/libxml2/src/xmlmodule.c
src/main/cpp/libxml2/src/schematron.c
)
include_directories(src/main/cpp/libxml2/include)
include_directories(src/main/cpp/libxml2/src)
add_library( # Sets the name of the library.
myexampe-native
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/my-native.cpp )
add_library( # Sets the name of the library.
mylibxml2
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
${LIBXML2_SOURCES} )
target_link_libraries( # Specifies the target library.
myexampe-native
mylibxml2
)
And Here is my app/build.gradle configuration
android { .....
defaultConfig { .....
externalNativeBuild {
cmake {
cppFlags "-std=gnu++11"
arguments '-DANDROID_PLATFORM=android-21',
'-DANDROID_STL=c++_shared','-DANDROID_ARM_MODE=arm'
}
}
Comments are welcomed for any clarification.
Thanks :-)
I tried to add xml2 and icuc libraries to Android project. icuc should be added because it is used by xml2 lib. I downloaded libicuc.so and xml2 source code.
Here I used Android.mk and Application.mk files in jni/ folder:
# Filename: Application.mk
APP_ABI=armeabi-v7a
# Filename: Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := icuuc
LOCAL_SRC_FILES := libicuuc.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/icu/icu4c/source/common
include $(PREBUILT_SHARED_LIBRARY)
# include $(CLEAR_VARS)
# LOCAL_MODULE := xml2
# LOCAL_SRC_FILES := libxml2.so
# LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/xml
# LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/xml/include
# include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := xml2
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xml
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xml/include/
LOCAL_SRC_FILES := xml/SAX.c \
xml/entities.c \
xml/encoding.c \
xml/error.c \
xml/parserInternals.c \
xml/parser.c \
xml/tree.c \
xml/hash.c \
xml/list.c \
xml/xmlIO.c \
xml/xmlmemory.c \
xml/uri.c \
xml/valid.c \
xml/xlink.c \
xml/debugXML.c \
xml/xpath.c \
xml/xpointer.c \
xml/xinclude.c \
xml/nanohttp.c \
xml/nanoftp.c \
xml/DOCBparser.c \
xml/catalog.c \
xml/globals.c \
#xml/threads.c \
xml/c14n.c \
xml/xmlstring.c \
xml/xmlregexp.c \
xml/xmlschemas.c \
xml/xmlschemastypes.c \
xml/xmlunicode.c \
xml/xmlreader.c \
xml/relaxng.c \
xml/dict.c \
xml/SAX2.c \
xml/legacy.c \
xml/chvalid.c \
xml/pattern.c \
xml/xmlsave.c \
xml/xmlmodule.c \
xml/xmlwriter.c \
xml/schematron.c
LOCAL_SHARED_LIBRARIES := icuuc
include $(BUILD_SHARED_LIBRARY)
However, I'm getting clang++ linker error and so many undefined reference error as below. I couldn't find any soulution to fix this issue.
C:\Users\user\AndroidStudioProjects\SatIP\jni>C:\Users\user\AppData\Local\Android\Sdk\ndk-bundle\ndk-bui
ld
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.
[armeabi-v7a] Install : libicuuc.so => libs/armeabi-v7a/libicuuc.so
[armeabi-v7a] Compile thumb : xml2 <= SAX.c
[armeabi-v7a] Compile thumb : xml2 <= entities.c
[armeabi-v7a] Compile thumb : xml2 <= encoding.c
[armeabi-v7a] Compile thumb : xml2 <= error.c
[armeabi-v7a] Compile thumb : xml2 <= parserInternals.c
[armeabi-v7a] Compile thumb : xml2 <= parser.c
[armeabi-v7a] Compile thumb : xml2 <= tree.c
[armeabi-v7a] Compile thumb : xml2 <= hash.c
[armeabi-v7a] Compile thumb : xml2 <= list.c
[armeabi-v7a] Compile thumb : xml2 <= xmlIO.c
[armeabi-v7a] Compile thumb : xml2 <= xmlmemory.c
[armeabi-v7a] Compile thumb : xml2 <= uri.c
[armeabi-v7a] Compile thumb : xml2 <= valid.c
[armeabi-v7a] Compile thumb : xml2 <= xlink.c
[armeabi-v7a] Compile thumb : xml2 <= debugXML.c
[armeabi-v7a] Compile thumb : xml2 <= xpath.c
[armeabi-v7a] Compile thumb : xml2 <= xpointer.c
[armeabi-v7a] Compile thumb : xml2 <= xinclude.c
[armeabi-v7a] Compile thumb : xml2 <= nanohttp.c
[armeabi-v7a] Compile thumb : xml2 <= nanoftp.c
[armeabi-v7a] Compile thumb : xml2 <= DOCBparser.c
[armeabi-v7a] Compile thumb : xml2 <= catalog.c
[armeabi-v7a] Compile thumb : xml2 <= globals.c
[armeabi-v7a] SharedLibrary : libxml2.so
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:268: error: undefined reference to 'xmlStrEqua
l'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:264: error: undefined reference to 'xmlStrEqua
l'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:272: error: undefined reference to 'xmlStrEqua
l'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:278: error: undefined reference to 'xmlStrEqua
l'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:174: error: undefined reference to 'xmlDictLoo
kup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:176: error: undefined reference to 'xmlDictLoo
kup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:178: error: undefined reference to 'xmlDictLoo
kup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:168: error: undefined reference to 'xmlStrdup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:170: error: undefined reference to 'xmlStrdup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:172: error: undefined reference to 'xmlStrdup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:181: error: undefined reference to 'xmlStrlen'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:184: error: undefined reference to 'xmlDictLoo
kup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:186: error: undefined reference to 'xmlStrndup
'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:705: error: undefined reference to 'xmlStrdup'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:597: error: undefined reference to 'xmlStrstr'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:964: error: undefined reference to 'xmlStrchr'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:111: error: undefined reference to 'xmlDictOwn
s'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:114: error: undefined reference to 'xmlDictOwn
s'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:117: error: undefined reference to 'xmlDictOwn
s'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/entities.c:119: error: undefined reference to 'xmlDictOwn
s'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:113: error: undefined reference to 'ucnv_open_
59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:119: error: undefined reference to 'ucnv_setTo
UCallBack_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:123: error: undefined reference to 'ucnv_setFr
omUCallBack_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:130: error: undefined reference to 'ucnv_open_
59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:136: error: undefined reference to 'ucnv_close
_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:139: error: undefined reference to 'UCNV_TO_U_
CALLBACK_STOP_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:139: error: undefined reference to 'UCNV_FROM_
U_CALLBACK_STOP_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:145: error: undefined reference to 'ucnv_close
_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:146: error: undefined reference to 'ucnv_close
_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:1884: error: undefined reference to 'ucnv_conv
ertEx_59'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2066: error: undefined reference to 'xmlBufUse
'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2069: error: undefined reference to 'xmlBufAva
il'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2086: error: undefined reference to 'xmlBufGro
w'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2087: error: undefined reference to 'xmlBufAva
il'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2095: error: undefined reference to 'xmlBufEnd
'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2096: error: undefined reference to 'xmlBufCon
tent'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2097: error: undefined reference to 'xmlBufShr
ink'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/encoding.c:2098: error: undefined reference to 'xmlBufAdd
Len'
...
...
...
...
undefined reference to 'xmlSaveForm
atFileTo'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3109: error: undefined reference to 'xmlRMutexL
ock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3181: error: undefined reference to 'xmlRMutexU
nlock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3092: error: undefined reference to 'xmlNewRMut
ex'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3205: error: undefined reference to 'xmlRMutexL
ock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3220: error: undefined reference to 'xmlRMutexU
nlock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3215: error: undefined reference to 'xmlRMutexU
nlock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3210: error: undefined reference to 'xmlRMutexU
nlock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3281: error: undefined reference to 'xmlRMutexL
ock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3295: error: undefined reference to 'xmlFreeRMu
tex'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:3418: error: undefined reference to 'xmlRMutexL
ock'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:2235: error: undefined reference to 'xmlIsPubid
Char_tab'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:2235: error: undefined reference to 'xmlIsPubid
Char_tab'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/catalog.c:1360: error: undefined reference to 'xmlGetThre
adId'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Intern
alSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2IsStan
dalone'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2HasInt
ernalSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2HasExt
ernalSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Resolv
eEntity'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2GetEnt
ity'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Entity
Decl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Notati
onDecl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Attrib
uteDecl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Elemen
tDecl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Unpars
edEntityDecl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2SetDoc
umentLocator'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2StartD
ocument'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2EndDoc
ument'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2StartE
lement'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2EndEle
ment'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Refere
nce'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Charac
ters'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Charac
ters'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Proces
singInstruction'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Commen
t'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2GetPar
ameterEntity'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2CDataB
lock'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXHandler: error: undefined reference to 'xmlSAX2Extern
alSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXLocator: error: undefined reference to 'xmlSAX2GetPub
licId'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXLocator: error: undefined reference to 'xmlSAX2GetSys
temId'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXLocator: error: undefined reference to 'xmlSAX2GetLin
eNumber'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:xmlDefaultSAXLocator: error: undefined reference to 'xmlSAX2GetCol
umnNumber'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Inter
nalSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2IsSta
ndalone'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2HasIn
ternalSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2HasEx
ternalSubset'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Resol
veEntity'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Entit
yDecl'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2SetDo
cumentLocator'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Start
Document'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2EndDo
cument'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Start
Element'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2EndEl
ement'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Refer
ence'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Chara
cters'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Ignor
ableWhitespace'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2Comme
nt'
C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/objs/xml2/xml/globals.o:C:/Users/user/An
droidStudioProjects/SatIP/jni/xml/globals.c:docbDefaultSAXHandler: error: undefined reference to 'xmlSAX2GetPa
rameterEntity'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:50: error: undefined reference to 'xmlNewMutex'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:61: error: undefined reference to 'xmlFreeMutex
'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:64: error: undefined reference to '__xmlGlobalI
nitMutexDestroy'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:50: error: undefined reference to 'xmlNewMutex'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:565: error: undefined reference to 'xmlSAX2GetS
ystemId'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:565: error: undefined reference to 'xmlSAX2GetC
olumnNumber'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:565: error: undefined reference to 'xmlSAX2GetL
ineNumber'
C:/Users/user/AndroidStudioProjects/SatIP/jni/xml/globals.c:565: error: undefined reference to 'xmlSAX2GetP
ublicId'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [C:/Users/user/AndroidStudioProjects/SatIP/obj/local/armeabi-v7a/libxml2.so] Error 1
I'm trying to compile and deploy ceres solver into an Android project.
I successfully compiled ceres (1.8.0 and 1.9.0, tried both), running ndk-build from the ceres jni folder.
Then, I use QtCreator to compile and deploy and Android project. It fails with the following error:
B:\Android\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=B:\Android\android-ndk-r10e/platforms/android-9/arch-arm/ -Wl,-soname,libtest_3rdparty_inprg_ceres.so -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libtest_3rdparty_inprg_ceres.so main.obj logging.obj -LB:\Android\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -LB:\Android\android-ndk-r10e/platforms/android-9/arch-arm//usr/lib -lb:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a -LC:/Qt/5.5/android_armv7/lib -lQt5Widgets -Lc:\utils\android\ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -Lc:\utils\android\ndk/platforms/android-9/arch-arm//usr/lib -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:3639: error: undefined reference to 'std::__1::__shared_weak_count::~__shared_weak_count()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4154: error: undefined reference to 'std::__1::__shared_weak_count::__add_shared()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()'
B:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/jni/../internal/ceres/solver_impl.cc:123: error: undefined reference to 'std::__1::cout'
B:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/jni/../internal/ceres/solver_impl.cc:123: error: undefined reference to 'std::__1::ctype<char>::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()'
B:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/jni/../internal/ceres/solver_impl.cc:158: error: undefined reference to 'std::__1::cout'
B:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/jni/../internal/ceres/solver_impl.cc:158: error: undefined reference to 'std::__1::ctype<char>::id'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(solver_impl.o):solver_impl.cc:vtable for std::__1::__shared_ptr_pointer<ceres::OrderedGroups<double*>*, std::__1::default_delete<ceres::OrderedGroups<double*> >, std::__1::allocator<ceres::OrderedGroups<double*> > >: error: undefined reference to 'std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:508: error: undefined reference to 'std::__1::ios_base::getloc() const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:508: error: undefined reference to 'std::__1::locale::~locale()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:520: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:520: error: undefined reference to 'std::__1::ctype<char>::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__hash_table:1944: error: undefined reference to 'std::__1::__next_prime(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__hash_table:1955: error: undefined reference to 'std::__1::__next_prime(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__hash_table:1944: error: undefined reference to 'std::__1::__next_prime(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__hash_table:1955: error: undefined reference to 'std::__1::__next_prime(unsigned int)'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(schur_eliminator.o):schur_eliminator.cc:vtable for ceres::internal::SchurEliminator<2, 4, 8>: error: undefined reference to 'ceres::internal::SchurEliminator<2, 4, 8>::~SchurEliminator()'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(schur_eliminator.o):schur_eliminator.cc:vtable for ceres::internal::SchurEliminator<2, 4, 8>: error: undefined reference to 'ceres::internal::SchurEliminator<2, 4, 8>::~SchurEliminator()'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(schur_eliminator.o):schur_eliminator.cc:vtable for ceres::internal::SchurEliminator<2, 4, 8>: error: undefined reference to 'ceres::internal::SchurEliminator<2, 4, 8>::Init(int, ceres::internal::CompressedRowBlockStructure const*)'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(schur_eliminator.o):schur_eliminator.cc:vtable for ceres::internal::SchurEliminator<2, 4, 8>: error: undefined reference to 'ceres::internal::SchurEliminator<2, 4, 8>::Eliminate(ceres::internal::BlockSparseMatrix const*, double const*, double const*, ceres::internal::BlockRandomAccessMatrix*, double*)'
b:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/lib/android_armeabi-v7a/gcc-4.8/libceres.a(schur_eliminator.o):schur_eliminator.cc:vtable for ceres::internal::SchurEliminator<2, 4, 8>: error: undefined reference to 'ceres::internal::SchurEliminator<2, 4, 8>::BackSubstitute(ceres::internal::BlockSparseMatrix const*, double const*, double const*, double const*, double*)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3077: error: undefined reference to 'std::__1::__rs_get()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:2912: error: undefined reference to 'std::__1::__rs_default::operator()()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:2912: error: undefined reference to 'std::__1::__rs_default::operator()()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3083: error: undefined reference to 'std::__1::__rs_default::~__rs_default()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3077: error: undefined reference to 'std::__1::__rs_get()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:2912: error: undefined reference to 'std::__1::__rs_default::operator()()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:2912: error: undefined reference to 'std::__1::__rs_default::operator()()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3083: error: undefined reference to 'std::__1::__rs_default::~__rs_default()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3077: error: undefined reference to 'std::__1::__rs_get()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3083: error: undefined reference to 'std::__1::__rs_default::~__rs_default()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3077: error: undefined reference to 'std::__1::__rs_get()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:3083: error: undefined reference to 'std::__1::__rs_default::~__rs_default()'
B:/dev/vobs_ext/libcpp/ceres/ceres-solver-1.9.0/jni/../internal/ceres/partitioned_matrix_view.cc:118: error: undefined reference to 'ceres::internal::PartitionedMatrixView<2, 4, 8>::PartitionedMatrixView(ceres::internal::BlockSparseMatrix const&, int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:661: error: undefined reference to 'std::__1::ios_base::~ios_base()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/streambuf:370: error: undefined reference to 'std::__1::locale::locale()'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::ctype<char>::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:728: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:676: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
B:/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:668: error: undefined reference to 'std::__1::ios_base::init(void*)'
collect2.exe: error: ld returned 1 exit status
makefile:82: recipe for target 'libtest_3rdparty_inprg_ceres.so' failed
mingw32-make: *** [libtest_3rdparty_inprg_ceres.so] Error 1
13:17:13: Le processus "C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet test_3rdparty_inprg_ceres (kit : Android for armeabi-v7a (GCC 4.9, Qt 5.5.0))
When executing step "Make"
13:17:13: Temps écoulé : 00:08.
I'm wondering if this could be due to ceres linking with c++ libraries statically, while my program links then dynamically....but have no clue how to solve this.
All libraries in your app SHOULD use the same STL runtime. But speaking about static libraries, they MUST use the same STL configuration. If you did not change cerces-solver/jni/Application.mk, it will expect APP_STL=c++_static. You can override this to use APP_STL=c++_shared, but you need a very good reason to change the way this external library is built. Much easier to switch your program to APP_STL=c++_static.
Edited by jpo38:
There are actually other things to be changed to have libceres.so be generated instead of libceres.a:
Add LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog in Android.mk
Replace include $(BUILD_STATIC_LIBRARY) by include $(BUILD_SHARED_LIBRARY) in Android.mk
Add -DCERES_BUILDING_SHARED_LIBRARY and -DCERES_RESTRICT_SCHUR_SPECIALIZATION (dunno why this second one helps, looks like Shur stuff does not like shared linkage) to LOCAL_CFLAGS in Android.mk
Then, the dynamic library is generated and may be used.
I have successfully build CSipSimple for android by make command. After that, when I try to build video support libary by calling make VideoLibs command, there is an error appears.
[armeabi] SharedLibrary : libpj_video_android.so
[armeabi-v7a] SharedLibrary : libpj_video_android.so
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1086: error: undefined reference to 'av_strerror'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1324: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1325: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1328: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1329: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1430: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1455: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1460: error: undefined reference to 'avcodec_encode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:409: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:427: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:434: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:442: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:445: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1116: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1125: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1185: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1200: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1222: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1223: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1228: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1229: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1680: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1683: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1705: error: undefined reference to 'avcodec_decode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:629: error: undefined reference to 'avcodec_register_all'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:172: error: undefined reference to 'sws_freeContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:152: error: undefined reference to 'sws_scale'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:112: error: undefined reference to 'sws_getContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:113: error: undefined reference to 'av_log_get_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:88: error: undefined reference to 'av_log_set_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:89: error: undefined reference to 'av_log_set_callback'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:90: error: undefined reference to 'av_register_all'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi/libpj_video_android.so] Error 1
make[1]: *** Waiting for unfinished jobs....
[armeabi-v7a] Install : libpjsipjni.so => ./libs/armeabi-v7a/libpjsipjni.so
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1086: error: undefined reference to 'av_strerror'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1324: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1325: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1328: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1329: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1430: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1455: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1460: error: undefined reference to 'avcodec_encode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:409: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:427: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:434: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:442: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:445: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1116: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1125: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1185: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1200: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1222: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1223: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1228: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1229: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1680: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1683: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1705: error: undefined reference to 'avcodec_decode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:629: error: undefined reference to 'avcodec_register_all'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:172: error: undefined reference to 'sws_freeContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:152: error: undefined reference to 'sws_scale'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:112: error: undefined reference to 'sws_getContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:113: error: undefined reference to 'av_log_get_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:88: error: undefined reference to 'av_log_set_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:89: error: undefined reference to 'av_log_set_callback'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:90: error: undefined reference to 'av_register_all'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi-v7a/libpj_video_android.so] Error 1
make[1]: Leaving directory `/home/alexchengalan/android/files/CSipSimple-trunk/CSipSimple'
make: *** [VideoLibs] Error 2
It would be great if anyone can help me out of this problem.
Modify jni\pjsip\android_toolchain\pjmedia\Video.mk; then, it would be ok.
# Ffmpeg codec
BASE_FFMPEG_BUILD_DIR := $(LOCAL_PATH)/../../../ffmpeg/build/ffmpeg/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_FFMPEG_BUILD_DIR)/libavcodec.a \
$(BASE_FFMPEG_BUILD_DIR)/libavformat.a \
$(BASE_FFMPEG_BUILD_DIR)/libswscale.a \
$(BASE_FFMPEG_BUILD_DIR)/libavutil.a
# Add X264
BASE_X264_BUILD_DIR := $(LOCAL_PATH)/../../../ffmpeg/build/x264/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_X264_BUILD_DIR)/libx264.a
For details, see: (https://groups.google.com/forum/#!topic/csipsimple-dev/bSauDx-hnR0)