Почему я все еще получаю неопределенные ошибки ссылок, связывающих статическую библиотеку с CMake в Android NDK? - PullRequest
0 голосов
/ 04 октября 2018

При создании следующего проекта Android-NDK я получаю десятки неопределенных ошибок ссылок относительно отсутствующих стандартных функций библиотеки.Я следовал некоторым базовым примерам связывания статических библиотек и перезапускал этот проект с нуля 3 раза, но все еще не могу найти проблему.Я пытаюсь использовать библиотеку lib_seal, скомпилированную с использованием -std=c++1z.(https://www.microsoft.com/en-us/research/project/simple-encrypted-arithmetic-library/).

Ошибки, которые я получаю, указывают на то, что библиотека связана правильно, но по многим ссылкам в Интернете она не может найти -lstdc++ (Один пример, рекомендующий это здесь: неопределенная ссылка на`std :: ios_base :: Init :: Init () '). Я добавил это в свой файл CMakeLists.txt под target_link_libraries, и я попытался отредактировать файл Gradle, чтобы включить cppFlags = "-std=c++1z", "-std=c++11", "-lstdc++" и т. Д. Я также попытался добавить arguments "-DANDROID_STL=c++_shared".

Ниже приведено самое близкое к нему, что я могу получить для компиляции и ссылки:

CMakeLists.txt:

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

add_library(lib_seal STATIC IMPORTED)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
        native-lib

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        src/main/cpp/native-lib.cpp)

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

set_target_properties(lib_seal PROPERTIES IMPORTED_LOCATION
        ${CMAKE_SOURCE_DIR}/libs/seal/${ANDROID_ABI}/lib/libseal.a)

target_include_directories(native-lib PRIVATE
        ${CMAKE_SOURCE_DIR}/libs/seal/${ANDROID_ABI}/include)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries(native-lib
        stdc++
        lib_seal
        ${log-lib})

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.wyoumans.sealapp"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++1z"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
    splits {
        abi {
            enable true
            reset()
            include "x86_64"
            universalApk false
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
}

native-lib.cpp:

#include <jni.h>
#include <string>

#include "seal/seal.h"

extern "C" JNIEXPORT jstring JNICALL
Java_com_example_wyoumans_sealapp_MainActivity_stringFromJNI(
        JNIEnv *env,
        jobject /* this */) {
    seal::EncryptionParameters params;
    std::string hello = "Set params!";
    return env->NewStringUTF(hello.c_str());
}

Сообщение об ошибке:

Build command failed.
Error while executing process /home/wyoumans/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/wyoumans/AndroidStudioProjects/SEALApp/app/.externalNativeBuild/cmake/debug/x86_64 --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
[2/2] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/x86_64/libnative-lib.so
FAILED: : && /home/wyoumans/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=x86_64-none-linux-android21 --gcc-toolchain=/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64 --sysroot=/home/wyoumans/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem /home/wyoumans/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++1z -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /home/wyoumans/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/home/wyoumans/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,libnative-lib.so -o ../../../../build/intermediates/cmake/debug/obj/x86_64/libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o  -lstdc++ ../../../../libs/seal/x86_64/lib/libseal.a /home/wyoumans/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64/usr/lib64/liblog.so -latomic -lm "/home/wyoumans/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a" "/home/wyoumans/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++abi.a" && :
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::save(std::ostream&) const: error: undefined reference to 'std::ostream::write(char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::save(std::ostream&) const: error: undefined reference to 'std::ostream::write(char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::save(std::ostream&) const: error: undefined reference to 'std::ostream::write(char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::alias(int, int, unsigned long*): error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::alias(int, int, unsigned long*): error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::alias(int, int, unsigned long*): error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::alias(int, int, unsigned long*): error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::operator=(seal::BigPoly const&): error: undefined reference to 'std::out_of_range::out_of_range(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::operator=(seal::BigPoly const&): error: undefined reference to 'std::out_of_range::out_of_range(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::load(std::istream&): error: undefined reference to 'std::istream::read(char*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::load(std::istream&): error: undefined reference to 'std::istream::read(char*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::load(std::istream&): error: undefined reference to 'std::istream::read(char*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::BigPoly::load(std::istream&): error: undefined reference to 'std::istream::read(char*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function std::vector<seal::BigUInt, std::allocator<seal::BigUInt> >::_M_default_append(unsigned long): error: undefined reference to 'std::__throw_length_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::__throw_length_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::ios_base::ios_base()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::locale::locale()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::locale::~locale()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::ios_base::~ios_base()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::ostream::operator<<(int)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::locale::~locale()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
/home/wyoumans/Android/Sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::ios_base::~ios_base()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::__throw_logic_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::__throw_logic_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::__throw_length_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function seal::util::poly_to_hex_string[abi:cxx11](unsigned long const*, int, int): error: undefined reference to 'std::__throw_length_error(char const*)'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function _GLOBAL__sub_I_bigpoly.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
../../../../libs/seal/x86_64/lib/libseal.a(bigpoly.cpp.o):bigpoly.cpp:function _GLOBAL__sub_I_bigpoly.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
../../../../libs/seal/x86_64/lib/libseal.a(biguint.cpp.o):biguint.cpp:function seal::BigUInt::save(std::ostream&) const: error: undefined reference to 'std::ostream::write(char const*, long)'
../../../../libs/seal/x86_64/lib/libseal.a(biguint.cpp.o):biguint.cpp:function _GLOBAL__sub_I_biguint.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
../../../../libs/seal/x86_64/lib/libseal.a(biguint.cpp.o):biguint.cpp:function _GLOBAL__sub_I_biguint.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
../../../../libs/seal/x86_64/lib/libseal.a(encryptionparams.cpp.o):encryptionparams.cpp:function _GLOBAL__sub_I_encryptionparams.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
../../../../libs/seal/x86_64/lib/libseal.a(encryptionparams.cpp.o):encryptionparams.cpp:function _GLOBAL__sub_I_encryptionparams.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
../../../../libs/seal/x86_64/lib/libseal.a(smallmodulus.cpp.o):smallmodulus.cpp:function _GLOBAL__sub_I_smallmodulus.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
../../../../libs/seal/x86_64/lib/libseal.a(smallmodulus.cpp.o):smallmodulus.cpp:function _GLOBAL__sub_I_smallmodulus.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
../../../../libs/seal/x86_64/lib/libseal.a(globals.cpp.o):globals.cpp:function std::map<int, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> >, std::less<int>, std::allocator<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > > >::map(std::initializer_list<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > >, std::less<int> const&, std::allocator<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > > const&): error: undefined reference to 'std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
../../../../libs/seal/x86_64/lib/libseal.a(globals.cpp.o):globals.cpp:function std::map<int, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> >, std::less<int>, std::allocator<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > > >::map(std::initializer_list<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > >, std::less<int> const&, std::allocator<std::pair<int const, std::vector<seal::SmallModulus, std::allocator<seal::SmallModulus> > > > const&): error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
../../../../libs/seal/x86_64/lib/libseal.a(mempool.cpp.o):mempool.cpp:function seal::util::MemoryPoolMT::alloc_uint64_count() const [clone .localalias.53]: error: undefined reference to 'std::__throw_system_error(int)'
../../../../libs/seal/x86_64/lib/libseal.a(mempool.cpp.o):mempool.cpp:function seal::util::MemoryPoolMT::~MemoryPoolMT(): error: undefined reference to 'std::__throw_system_error(int)'
../../../../libs/seal/x86_64/lib/libseal.a(mempool.cpp.o):mempool.cpp:function seal::util::MemoryPoolMT::get_for_uint64_count(long): error: undefined reference to 'std::__throw_system_error(int)'
../../../../libs/seal/x86_64/lib/libseal.a(mempool.cpp.o):mempool.cpp:function seal::util::MemoryPoolMT::pool_count() const: error: undefined reference to 'std::__throw_system_error(int)'
../../../../libs/seal/x86_64/lib/libseal.a(uintarith.cpp.o):uintarith.cpp:function seal::util::divide_uint_uint_inplace(unsigned long*, seal::util::Modulus const&, int, unsigned long*, seal::util::MemoryPool&): error: undefined reference to 'std::__throw_bad_function_call()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Всего парапримечания: мне нужно использовать -std=c++1z, чтобы использовать библиотеку SEAL (или -std=gnu++1z), и ближе к концу файла Gradle я специально разрешаю только архитектуру x86_64, так как не хочу беспокоиться о кросс-компиляции чего-либо доЯ получаю это работает.

1 Ответ

0 голосов
/ 04 октября 2018

Похоже, что libseal был построен с более старым NDK с использованием GNU libstdc ++ (gnustl на языке NDK).Libstdc ++ GNU больше не включен в NDK r18.Вам нужно либо пересобрать libseal с помощью libc ++, либо понизить ваш NDK.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...