Skip to content

undefined reference to `tflite::DefaultErrorReporter()' #36661

@ashishmagar600

Description

@ashishmagar600

System information:
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
TensorFlow installed from (source or binary): source
TensorFlow version (use command below): v1.4.0-19-ga52c8d9 1.4.1
Python version: 2.7.12
Bazel version (if compiling from source): 0.8.1
GCC/Compiler version (if compiling from source): g++ 5.4.0
CUDA/cuDNN version: none
GPU model and memory: none
Exact command to reproduce:

g++ -I../tensorflow -Llib -ltensorflow_cc -Llib -ltensorflowlite test.cpp -o exec

Describe the problem
I used this tutorial to build tensorflow link. Also this link

Additionally, I built tensorflow-lite with:

bazel build //tensorflow/lite:libtensorflowlite.so

I am using this code for testing tflite:

#include < cstdio >
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/tools/gen_op_registration.h"

using namespace tflite;

int main(int argc, char* argv[]) {
if (argc != 2) {
fprintf(stderr, "minimal \n");
return 1;
}
const char* filename = argv[1];

std::unique_ptrtflite::FlatBufferModel model =
tflite::FlatBufferModel::BuildFromFile(filename);
return 0;
}

Here is the error:

/tmp/ccPKK7am.o: In function main': test.cpp:(.text+0x57): undefined reference to tflite::DefaultErrorReporter()'
test.cpp:(.text+0x6d): undefined reference to tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)' /tmp/ccPKK7am.o: In function std::default_deletetflite::FlatBufferModel::operator()(tflite::FlatBufferModel*) const':
test.cpp:(.text.ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1[ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1]+0x1e): undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
collect2: error: ld returned 1 exit status

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions