karthickai/tflite

Failed when testing on xnnpack

Closed this issue · 2 comments

Hi Karthick, thank you for your sharing. I added code to check xnnpack in https://github.com/Gaozhongpai/tflite/blob/master/04_Linux_Installation_xnnpack/main.cpp. It failed. Errors are as followed:

/usr/bin/ld: CMakeFiles/TFLiteCheck.dir/main.cpp.o: in function main:
main.cpp:(.text+0x23): undefined reference to TfLiteModelCreateFromFile
/usr/bin/ld: main.cpp:(.text+0x2c): undefined reference to TfLiteInterpreterOptionsCreate
/usr/bin/ld: main.cpp:(.text+0x35): undefined reference to TfLiteXNNPackDelegateOptionsDefault
/usr/bin/ld: main.cpp:(.text+0x44): undefined reference to TfLiteXNNPackDelegateCreate
/usr/bin/ld: main.cpp:(.text+0x5b): undefined reference to TfLiteInterpreterOptionsAddDelegate
/usr/bin/ld: main.cpp:(.text+0x6e): undefined reference to TfLiteInterpreterCreate
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/TFLiteCheck.dir/build.make:98: TFLiteCheck] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/TFLiteCheck.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I see that those functions are included under the ${CMAKE_CURRENT_SOURCE_DIR}/../tflite-dist/include/. I don't know what is the error. Thank you very much.

I rebuilt the TensorFlow Lite as:

bazel build --define tflite_with_xnnpack=true -c opt //tensorflow/lite:libtensorflowlite.so

It still shows errors as:

/usr/bin/ld: CMakeFiles/TFLiteCheck.dir/main.cpp.o: in function main:
main.cpp:(.text+0x23): undefined reference to TfLiteModelCreateFromFile
/usr/bin/ld: main.cpp:(.text+0x2c): undefined reference to TfLiteInterpreterOptionsCreate
/usr/bin/ld: main.cpp:(.text+0x5c): undefined reference to TfLiteInterpreterOptionsAddDelegate
/usr/bin/ld: main.cpp:(.text+0x6f): undefined reference to TfLiteInterpreterCreate
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/TFLiteCheck.dir/build.make:98: TFLiteCheck] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/TFLiteCheck.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I have solved this problem by adding:

bazel build --define -c opt //tensorflow/lite/c:libtensorflowlite_c.so