Skip to content

Linking error: "undefined reference to" - using CMSIS NN #41821

@Sixaxis9

Description

@Sixaxis9

@tensorflow/micro

System information

  • Host OS Platform and Distribution (e.g., Linux Ubuntu 16.04): make with Linux Ubuntu 20.04, complied on Atmel Studio on Windows 10, Python 3.7.7
  • TensorFlow installed from (source or binary): downloaded from master
  • Tensorflow version (commit SHA if source): 2.3.0, e544dce
  • Target platform (e.g. Arm Mbed OS, Arduino Nano 33 etc.): Atmel SAMD51 - Atmel Studio

Describe the problem
I have made the projects as described on the tflite for microcontroller webpage specifying TAGS=cmsis-nn to use the optimized backend. I have then moved the files from magic wand project to my project on Atmel Studio, making sure to add all the directories in a correct manner and compiled the project. Compilation is succesfull but I get a bunch of errors when trying to link:

Severity	Code	Description	Project	File	Line
Error		recipe for target 'TFLite_SAMD51.elf' failed	TFLite_SAMD51	Debug\Makefile	1314
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\reference\conv.h	69
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\reference\conv.h	149
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\reference\integer_ops\conv.h	72
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\reference\integer_ops\pooling.h	122
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\reference\pooling.h	118
Error		undefined reference to `tflite::micro::GetEvalInput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	390
Error		undefined reference to `tflite::micro::GetEvalOutput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	390
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	390
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	391
Error		undefined reference to `tflite::micro::GetEvalInput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	391
Error		undefined reference to `tflite::micro::GetEvalOutput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	391
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	391
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\kernels\internal\types.h	392
Error		undefined reference to `tflite::micro::GetEvalInput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\conv.cpp	308
Error		undefined reference to `tflite::micro::GetEvalOutput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\conv.cpp	308
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	178
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	178
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	202
Error		undefined reference to `tflite::micro::GetEvalInput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	228
Error		undefined reference to `tflite::micro::GetEvalOutput(TfLiteContext const*, TfLiteNode const*, int)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	228
Error		undefined reference to `tflite::micro::GetTensorShape(TfLiteEvalTensor const*)'	TFLite_SAMD51	tensorflow\lite\micro\kernels\fully_connected.cpp	228

I have adapted the magic wand project made without the CMSIS-NN tag and it runs smoothly.
The working non-cmsis can be found here: https://github.com/Sixaxis9/TFLite-SAMD51

Please provide the exact sequence of commands/steps when you ran into the problem
make -f tensorflow/lite/micro/tools/make/Makefile TAGS=cmsis-nn generate_projects
go to tensorflow/lite/micro/tools/make/gen/linux_x86_64/prj/magic_wand/tensorflow_lite/src and copy the tensorflow and third_parties folders into an Atmel studio project
Added ./ to the directory in compiler settings
Used the same main as the non cmsis variant I have been using succesfully until now (derived anyway from the example).

Metadata

Metadata

Assignees

Labels

comp:microRelated to TensorFlow Lite Microcontrollersstat:awaiting responseStatus - Awaiting response from authortype:bugBug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions