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.
OpenCV version = 3.1.0
Dlib version = 19.1
Android NDK version = r21
I would like to build lib.so file for Android Studio by using Android NDK. However, it failed in the SharedLibrary and OpenCV involved in all errors. I checked my directory path and it does not have any mistake. Can anyone tell help me?
This is the tutorial that I followed: https://www.youtube.com/watch?v=ZjZHiPWBiYY&t=2192s
Application.mk:
NDK_TOOLCHAIN_VERSION := clang
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_CPPFLAGS := -std=c++11 -frtti -fexceptions
APP_PLATFORM := android-16
APP_STL := c++_static
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := dlib
LOCAL_C_INCLUDES := $(LOCAL_PATH)/dlib
LOCAL_SRC_FILES += \
../$(LOCAL_PATH)/dlib//dlib/threads/threads_kernel_shared.cpp \
../$(LOCAL_PATH)/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp \
../$(LOCAL_PATH)/dlib/dlib/base64/base64_kernel_1.cpp \
../$(LOCAL_PATH)/dlib/dlib/threads/threads_kernel_1.cpp \
../$(LOCAL_PATH)/dlib/dlib/threads/threads_kernel_2.cpp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
include $(BUILD_STATIC_LIBRARY)
TOP_LEVEL_PATH := $(abspath $(LOCAL_PATH)/..)
$(info TOP Level Path: $(TOP_LEVEL_PATH))
EXT_INSTALL_PATH = $(TOP_LEVEL_PATH)/third_party
OPENCV_PATH = $(EXT_INSTALL_PATH)/opencv/jni
OPENCV_INCLUDE_DIR = $(OPENCV_PATH)/include
include $(CLEAR_VARS)
OpenCV_INSTALL_MODULES := on
OPENCV_CAMERA_MODULES := off
OPENCV_LIB_TYPE := STATIC
include $(OPENCV_PATH)/OpenCV.mk
LOCAL_MODULE := MyLibs
LOCAL_C_INCLUDES += \
$(OPENCV_INCLUDE_DIR)
LOCAL_SRC_FILES := com_example_opencvdlib_NativeClass.cpp
LOCAL_LDLIBS += -lm -llog -ldl -lz -ljnigraphics
LOCAL_CPPFLAGS += -fexceptions -frtti -std=c++11
LOCAL_STATIC_LIBRARIES += dlib
include $(BUILD_SHARED_LIBRARY)
Errors:
C:\Users\leech\Desktop\AndroidApp\generateLibs>ndk-build
TOP Level Path: C:/Users/leech/Desktop/AndroidApp/generateLibs
TOP Level Path: C:/Users/leech/Desktop/AndroidApp/generateLibs
TOP Level Path: C:/Users/leech/Desktop/AndroidApp/generateLibs
TOP Level Path: C:/Users/leech/Desktop/AndroidApp/generateLibs
[armeabi-v7a] Compile++ thumb: MyLibs <= com_example_opencvdlib_NativeClass.cpp
jni/com_example_opencvdlib_NativeClass.cpp:6:2: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
[armeabi-v7a] Compile++ thumb: dlib <= threads_kernel_shared.cpp
[armeabi-v7a] Compile++ thumb: dlib <= entropy_decoder_kernel_2.cpp
[armeabi-v7a] Compile++ thumb: dlib <= base64_kernel_1.cpp
[armeabi-v7a] Compile++ thumb: dlib <= threads_kernel_1.cpp
[armeabi-v7a] Compile++ thumb: dlib <= threads_kernel_2.cpp
[armeabi-v7a] StaticLibrary : libdlib.a
[armeabi-v7a] SharedLibrary : libMyLibs.so
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_imgproc.a(drawing.cpp.o):drawing.cpp:function std::vector<cv::PolyEdge, std::allocator<cv::PolyEdge> >::reserve(unsigned int): error: undefined reference to 'std::__throw_length_error(char const*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_imgproc.a(drawing.cpp.o):drawing.cpp:function std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >::_M_fill_insert(__gnu_cxx::__normal_iterator<cv::Point_<int>*, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > >, unsigned int, cv::Point_<int> const&): error: undefined reference to 'std::__throw_length_error(char const*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_imgproc.a(drawing.cpp.o):drawing.cpp:function std::vector<CvSeq, std::allocator<CvSeq> >::_M_fill_insert(__gnu_cxx::__normal_iterator<CvSeq*, std::vector<CvSeq, std::allocator<CvSeq> > >, unsigned int, CvSeq const&): error: undefined reference to 'std::__throw_length_error(char const*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_imgproc.a(drawing.cpp.o):drawing.cpp:function std::vector<CvSeqBlock, std::allocator<CvSeqBlock> >::_M_fill_insert(__gnu_cxx::__normal_iterator<CvSeqBlock*, std::vector<CvSeqBlock, std::allocator<CvSeqBlock> > >, unsigned int, CvSeqBlock const&): error: undefined reference to 'std::__throw_length_error(char const*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(system.cpp.o):system.cpp:function _GLOBAL__sub_I_system.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(system.cpp.o):system.cpp:function _GLOBAL__sub_I_system.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.39]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf(): error: undefined reference to 'vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf(): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<float>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<double>(cv::Mat const&): error: undefined reference to 'std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<double>(cv::Mat const&): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<double>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<double>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<double>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<unsigned short>(cv::Mat const&): error: undefined reference to 'std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<unsigned short>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<unsigned short>(cv::Mat const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<unsigned short>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'std::ios_base::~ios_base()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'std::ostream::operator<<(short)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::string cv::ocl::kerToStr<short>(cv::Mat const&): error: undefined reference to 'vtable for std::basic_ios<char, std::char_traits<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::setMaxReservedSize(unsigned int): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::setMaxReservedSize(unsigned int): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::kernelToStr(cv::_InputArray const&, int, char const*): error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::Kernel::set(int, cv::ocl::Image2D const&): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::vector<std::string, std::allocator<std::string> >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, std::string const&): error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::vector<std::string, std::allocator<std::string> >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, std::string const&): error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::vector<std::string, std::allocator<std::string> >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, std::string const&): error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::vector<std::string, std::allocator<std::string> >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, std::string const&): error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::ios_base::ios_base()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned int, unsigned int)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'VTT for std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::split(std::string const&, char, std::vector<std::string, std::allocator<std::string> >&): error: undefined reference to 'vtable for std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/android-ndk-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../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
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::_Rb_tree<cv::ocl::Context::Impl::HashKey, std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program>, std::_Select1st<std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> >, std::less<cv::ocl::Context::Impl::HashKey>, std::allocator<std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> > >::_M_insert_unique(std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> const&): error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function std::_Rb_tree<cv::ocl::Context::Impl::HashKey, std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program>, std::_Select1st<std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> >, std::less<cv::ocl::Context::Impl::HashKey>, std::allocator<std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> > >::_M_insert_unique(std::pair<cv::ocl::Context::Impl::HashKey const, cv::ocl::Program> 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&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function int cv::ocl::getStringInfo<int (*)(_cl_platform_id*, unsigned int, unsigned int, void*, unsigned int*), _cl_platform_id*>(int (*)(_cl_platform_id*, unsigned int, unsigned int, void*, unsigned int*), _cl_platform_id*, unsigned int, std::string&) [clone .constprop.272]: error: undefined reference to 'std::string::_M_mutate(unsigned int, unsigned int, unsigned int)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function int cv::ocl::getStringInfo<int (*)(_cl_platform_id*, unsigned int, unsigned int, void*, unsigned int*), _cl_platform_id*>(int (*)(_cl_platform_id*, unsigned int, unsigned int, void*, unsigned int*), _cl_platform_id*, unsigned int, std::string&) [clone .constprop.272]: error: undefined reference to 'std::string::assign(char const*, unsigned int)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_findAndRemoveEntryFromReservedList(cv::ocl::CLBufferEntry&, unsigned int): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::Context::Impl::setDefault(): error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::Context::Impl::setDefault(): error: undefined reference to 'std::string::find(char const*, unsigned int, unsigned int) const'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function cv::ocl::OpenCLBufferPoolImpl::_allocateBufferEntry(cv::ocl::CLBufferEntry&, unsigned int): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function _GLOBAL__sub_I_ocl.cpp: error: undefined reference to 'std::ios_base::Init::Init()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../libs/armeabi-v7a/libopencv_core.a(ocl.cpp.o):ocl.cpp:function _GLOBAL__sub_I_ocl.cpp: error: undefined reference to 'std::ios_base::Init::~Init()'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function tbb::internal::handle_perror(int, char const*): error: undefined reference to 'std::runtime_error::runtime_error(std::string const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function tbb::internal::throw_exception_v4(tbb::internal::exception_id): error: undefined reference to 'std::runtime_error::runtime_error(std::string const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function tbb::internal::throw_exception_v4(tbb::internal::exception_id): error: undefined reference to 'std::runtime_error::runtime_error(std::string const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function tbb::internal::throw_exception_v4(tbb::internal::exception_id): error: undefined reference to 'std::runtime_error::runtime_error(std::string const&)'
C:/Users/leech/Desktop/AndroidApp/generateLibs/third_party/opencv/jni/../3rdparty/libs/armeabi-v7a/libtbb.a(tbb_misc.cpp.o):tbb_misc.cpp:function tbb::internal::throw_exception_v4(tbb::internal::exception_id): error: undefined reference to 'std::invalid_argument::invalid_argument(std::string const&)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [C:/android-ndk-r21/build//../build/core/build-binary.mk:725: obj/local/armeabi-v7a/libMyLibs.so] Error 1
Can anyone tell me what have I did wrong?
So I'm trying to build tesseract (using tess-two) and opencv for android. I'm able to build opencv and tess-two separately, but I want to be able to build them alongside.
For that I'm using the same build file as given in tess-two. Here all sub directory Android.mk files are called which works without a problem. As soon as I want to include the opencv library as well, and I want to compile files which are dependent on tesseract and opencv I get following errors.
Build command failed.
Error while executing process /home/alexander/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/pathtoapp/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/pathtoapp/app/src/main/cpp/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-24 NDK_OUT=/pathtoapp/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/pathtoapp/app/build/intermediates/ndkBuild/debug/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING:/pathtoapp/app/src/main/cpp/com_googlecode_tesseract_android/Android.mk:tess: non-system libraries in linker flags: -latomic
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
I'm not really sure, why this error happens. As mentioned I'm able to build the libraries separately. So the problem must be bringing them together.
Here is my makefile:
Android.mk:
LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
LIBJPEG_PATH := $(LOCAL_PATH)/libjpeg
LIBPNG_PATH := $(LOCAL_PATH)/libpng
# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles)
####################################################################################
LOCAL_PATH := $(call my-dir)
PROJECT_ROOT:= $(call my-dir)/../../../../..
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES:=on
LIBOPENCV_PATH := /pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/OpenCV.mk
include $(LIBOPENCV_PATH)
LOCAL_MODULE := libopencv_ndk
LOCAL_CFLAGS := -Werror -Wno-write-strings -std=c++11
LOCAL_SRC_FILES := native-lib.cpp \
CV_Main.cpp \
Native_Camera.cpp \
Image_Reader.cpp
LOCAL_LDLIBS := -llog -landroid -lcamera2ndk -lmediandk
LOCAL_SHARED_LIBRARIES := libtess liblept
include $(BUILD_SHARED_LIBRARY)
My current build directory looks as following:
- com_googlecode_leptonica_android
- com_googlecode_tesseract_android
- libjpeg
- libpng
- opencv
Is there something that I'm doing wrong? The error message is saying, that I'm using a non-system libraries in linker flags: -latomic , but this seems to be not the true error.
Can anyone help me?
Edit:
I found out, what the eror was. It was no rule to make target native_lib.cpp. So I wasn't able to build the following cpp file. I fixed it by creating a temporary variable of my $(LOCAL_PATH).
LOCAL_PATH := $(call my-dir)
MY_PATH := $(LOCAL_PATH)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
LIBJPEG_PATH := $(LOCAL_PATH)/libjpeg
LIBPNG_PATH := $(LOCAL_PATH)/libpng
include $(call all-subdir-makefiles)
####################################################################################
include $(CLEAR_VARS)
LOCAL_PATH = $(MY_PATH)
OPENCV_INSTALL_MODULES := on
include /home/alexander/ownCloud/master/fuckarmy/MaritLage/app/src/main/cpp/opencv/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := libopencv_ndk
LOCAL_CFLAGS := -Werror -Wno-write-strings -std=c++11
LOCAL_SRC_FILES := native-lib.cpp \
CV_Main.cpp \
Native_Camera.cpp \
Image_Reader.cpp
LOCAL_LDLIBS := -llog -landroid -lcamera2ndk -lmediandk
LOCAL_SHARED_LIBRARIES := libtess liblept
include $(BUILD_SHARED_LIBRARY)
Now, I'm running into a new problem.
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `~Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:739: undefined reference to `cv::fastFree(void*)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:548: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:561: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::operator=(cv::Mat&&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1416: undefined reference to `cv::fastFree(void*)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::detectCard(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:287: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:289: undefined reference to `cv::GaussianBlur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:291: undefined reference to `cv::adaptiveThreshold(cv::_InputArray const&, cv::_OutputArray const&, double, int, int, int, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:296: undefined reference to `cv::findContours(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:299: undefined reference to `cv::Mat::zeros(cv::Size_<int>, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:305: undefined reference to `cv::arcLength(cv::_InputArray const&, bool)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:305: undefined reference to `cv::approxPolyDP(cv::_InputArray const&, cv::_OutputArray const&, double, bool)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:307: undefined reference to `cv::isContourConvex(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:316: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:316: undefined reference to `cv::RotatedRect::boundingRect() const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:357: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:360: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:363: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:366: undefined reference to `cv::fitLine(cv::_InputArray const&, cv::_OutputArray const&, int, double, double, double)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:380: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:381: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:382: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:383: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:408: undefined reference to `cv::putText(cv::_InputOutputArray const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::drawActiveTrader(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:472: undefined reference to `cv::rectangle(cv::_InputOutputArray const&, cv::Rect_<int>, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `compareContour(std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >, std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:142: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:143: undefined reference to `cv::minAreaRect(cv::_InputArray const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat<cv::Point_<int> >':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:615: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `project_image(cv::Mat, std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:217: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:218: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:220: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:220: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:221: undefined reference to `cv::Mat::cross(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:222: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:222: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:224: undefined reference to `cv::operator*(double, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:224: undefined reference to `cv::operator-(cv::MatExpr const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:225: undefined reference to `cv::operator*(double, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:225: undefined reference to `cv::operator-(cv::MatExpr const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:243: undefined reference to `cv::getPerspectiveTransform(cv::Point_<float> const*, cv::Point_<float> const*, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:245: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:252: undefined reference to `cv::Mat::t() const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:253: undefined reference to `cv::Mat::inv(int) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:254: undefined reference to `cv::Mat::inv(int) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::operator*(cv::Mat const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::operator*(cv::Mat const&, cv::MatExpr const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:255: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::operator*(cv::Mat const&, cv::Mat const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::operator*(cv::Mat const&, cv::MatExpr const&)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:256: undefined reference to `cv::Mat::dot(cv::_InputArray const&) const'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:272: undefined reference to `cv::getPerspectiveTransform(cv::Point_<float> const*, cv::Point_<float> const*, int)'
/pathtoapp/app/src/main/cpp/CV_Main.cpp:274: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `drawLine(cv::Mat*, cv::Vec<double, 4>, int, cv::Scalar_<double>)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:282: undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `Mat':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:538: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `CV_Main::detectCardTitleImage(cv::Mat&)':
/pathtoapp/app/src/main/cpp/CV_Main.cpp:454: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::release()':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:851: undefined reference to `cv::Mat::deallocate()'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::create(int, int, int)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:831: undefined reference to `cv::Mat::create(int, int const*, int)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `MatConstIterator':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2621: undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::MatConstIterator::operator++()':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2716: undefined reference to `cv::MatConstIterator::seek(long, bool)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat_<double>::operator=(cv::Mat const&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1709: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1711: undefined reference to `cv::error(int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, char const*, char const*, int)'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:1712: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat::operator=(cv::Mat const&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:760: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/opencv_ndk/CV_Main.o: In function `cv::Mat_<double>::operator=(cv::Mat&&)':
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2086: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
/pathtoapp/app/src/main/cpp/opencv/sdk/native/jni/include/opencv2/core/mat.inl.hpp:2090: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/pathtoapp/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libopencv_ndk.so] Error 1
Now while it seems to not be able to find the compiled opencv library. What is the problem? Thanks for the help!
I build (static and dynamic)the AWS SDK CPP library on my PC for Android Applications. After that, I developped an Android Application with Qt 5.10 using this AWS CPP librairy but at the end, during the link, I have many errors. I tried on MacOS and Windows 10 but I have the same errors and I used the ANDROID NDK 12 because is the only working to build the AWS SDK CPP library.
I tried to solve it during 2 weeks. Please Someone could help me ?
Here is my command of the linker and the result :
C:\Android_aws_sdk_cpp\android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Android_aws_sdk_cpp\android-ndk-r12b/platforms/android-16/arch-arm/ -isystem C:\Android_aws_sdk_cpp\android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Android_aws_sdk_cpp\android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -DANDROID -DANDROID_NDK -DAWS_CUSTOM_MEMORY_MANAGEMENT -fPIC -fexceptions -O2 -Os -mthumb -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../crio_Source -I. -I../aws-sdk-cpp/aws_build_android/build_static/include -I../../../../Qt/5.10.1/android_armv7/include -I../../../../Qt/5.10.1/android_armv7/include/QtQuick -I../../../../Qt/5.10.1/android_armv7/include/QtCharts -I../../../../Qt/5.10.1/android_armv7/include/QtWidgets -I../../../../Qt/5.10.1/android_armv7/include/QtGui -I../../../../Qt/5.10.1/android_armv7/include/QtQml -I../../../../Qt/5.10.1/android_armv7/include/QtNetwork -I../../../../Qt/5.10.1/android_armv7/include/QtCore -I. -I../../../../Qt/5.10.1/android_armv7/mkspecs/android-g++ -o moc_listSensorModel.obj moc_listSensorModel.cpp
C:\Android_aws_sdk_cpp\android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Android_aws_sdk_cpp\android-ndk-r12b/platforms/android-16/arch-arm/ -Wl,-soname,libcrio_Android.so -Wl,-rpath=C:/Qt/5.10.1/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libcrio_Android.so emailaddress.obj mimeattachment.obj mimecontentformatter.obj mimefile.obj mimehtml.obj mimeinlinefile.obj mimemessage.obj mimemultipart.obj mimepart.obj mimetext.obj quotedprintable.obj smtpclient.obj controleur.obj listGroupModel.obj listSensorModel.obj main.obj sensorInformation.obj qrc_qml.obj moc_emailaddress.obj moc_mimeattachment.obj moc_mimecontentformatter.obj moc_mimefile.obj moc_mimehtml.obj moc_mimemultipart.obj moc_mimepart.obj moc_quotedprintable.obj moc_smtpclient.obj moc_controleur.obj moc_listGroupModel.obj moc_listSensorModel.obj -LC:\Android_aws_sdk_cpp\android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/android_aws_sdk_cpp/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LC:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib -laws-cpp-sdk-core -laws-cpp-sdk-lambda -laws-cpp-sdk-cognito-identity -laws-cpp-sdk-cognito-idp -laws-cpp-sdk-identity-management -LC:/Qt/5.10.1/android_armv7/lib -lQt5Quick -Lc:\utils\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/utils/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.9 -LC:\Qt\5.10.1\android_armv7/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc**
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::AmazonStreamingWebServiceRequest::~AmazonStreamingWebServiceRequest(): error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::AmazonStreamingWebServiceRequest::~AmazonStreamingWebServiceRequest(): error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Utils::Stream::DefaultResponseStreamFactoryMethod(): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::__shared_weak_count::__add_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::__shared_weak_count::__add_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::locale::locale()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::locale::~locale()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::InitAPI(Aws::SDKOptions const&): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Utils::Logging::InitializeAWSLogging(std::__ndk1::shared_ptr<Aws::Utils::Logging::LogSystemInterface> const&): error: undefined reference to 'std::__ndk1::__shared_weak_count::__add_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function std::__ndk1::basic_ostringstream<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> >::~basic_ostringstream(): error: undefined reference to 'std::__ndk1::locale::~locale()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function std::__ndk1::basic_ostringstream<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> >::~basic_ostringstream(): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::AWSAuthV4Signer(std::__ndk1::shared_ptr<Aws::Auth::AWSCredentialsProvider> const&, char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy, bool): error: undefined reference to 'std::__ndk1::__shared_weak_count::__add_shared()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::mutex::lock()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::locale::locale()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::locale::locale()'
C:/Users/Benjamin/OneDrive/aws-sdk-cpp/aws_build_android/build_static/lib/libaws-cpp-sdk-core.a(ub_core.cpp.o):C:\Android_aws_sdk_cpp\aws-cpp-sdk-core\ub_core.cpp:function Aws::Client::AWSAuthV4Signer::ComputeLongLivedHash(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, Aws::Allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::locale::locale()'
...
...
...
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [libcrio_Android.so] Error 1
Makefile:154: recipe for target 'libcrio_Android.so' failed
15:50:30: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project crio_Android (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7))
When executing step "Make"
I'm building an integration with the V8 library. This builds works fine for ARM (armeabi, armeabi-v7a) targets.
I want to add x86 support. Today is the first time I've tried this.
I built V8 for x86 via make ia32.release.
My Application.mk is as follows:
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-14
APP_STL := stlport_static
and Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_libbase
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_libbase.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_base
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_base.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_nosnapshot
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_nosnapshot.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_platform
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_libplatform.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := v8jsevaluator
LOCAL_SRC_FILES := v8jsevaluator.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_LDLIBS := -llog -landroid
LOCAL_STATIC_LIBRARIES := v8_base v8_nosnapshot v8_libbase v8_platform
LOCAL_CPP_FEATURES += exceptions
LOCAL_CFLAGS += -std=c++11
include $(BUILD_SHARED_LIBRARY)
The build fails in the x86 component with a lot of errors relating to STL.
12:13:39 **** Incremental Build of configuration Default for project v8jsevaluator ****
"C:\\Development\\android-ndk-r10d\\ndk-build.cmd" all
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
[armeabi] Install : libv8jsevaluator.so => libs/armeabi/libv8jsevaluator.so
[armeabi-v7a] Install : libv8jsevaluator.so => libs/armeabi-v7a/libv8jsevaluator.so
[x86] SharedLibrary : libv8jsevaluator.so
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.30]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::ostream& std::ostream::_M_insert<void const*>(void const*)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): 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*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): 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*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): 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*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(bootstrapper.o):bootstrapper.cc:function std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned int): error: undefined reference to 'std::__throw_length_error(char const*)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.32]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: 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*, int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: error: undefined reference to 'std::ostream::operator<<(int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CodeStub::PrintBaseName(std::ostream&) const: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
<snipped for brevity>
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::FPrint(_IO_FILE*, char const*, ...): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VFPrint(_IO_FILE*, char const*, char*): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::SNPrintF(char*, int, char const*, ...): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VSNPrintF(char*, int, char const*, char*): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libplatform.a(default-platform.o):default-platform.cc:function void std::deque<v8::Task*, std::allocator<v8::Task*> >::_M_push_back_aux<v8::Task* const&>(v8::Task* const&): error: undefined reference to 'std::__throw_bad_alloc()'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/x86/libv8jsevaluator.so] Error 1
12:13:41 Build Finished (took 1s.821ms)
As I said, without the attempt to build x86, this is all OK.
Please can anyone point me at where I'm going wrong? Thanks!
I upgraded my source of V8 from 4.1.0.22 to 4.9.385.30 and - after solving a lot of other issues - this problem went away.