Error Trying to compile with hardware acceleration RPi4

I am getting the following error when trying to compile the edge impulse linux standalone camera example using c++ and hardware acceleration flags "
APP_CAMERA=1 TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 CC=clang CXX=clang++ make -j3". EON is OFF and using float32 model:

/usr/bin/ld: tflite-model/tflite_learn_5_compiled.o: in function (anonymous namespace)::EonMicroContext::~EonMicroContext()': /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1232: undefined reference to tflite::MicroContext::~MicroContext()’
/usr/bin/ld: tflite-model/tflite_learn_5_compiled.o: in function tflite_learn_5_init(void* (*)(unsigned long, unsigned long))': /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1234: undefined reference to tflite::MicroContext::MicroContext(tflite::MicroAllocator*, tflite::Model const*, tflite::MicroGraph*)’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1299: undefined reference to tflite::Register_CONV_2D()' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1300: undefined reference to tflite::Register_DEPTHWISE_CONV_2D()’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1301: undefined reference to tflite::Register_PAD()' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1302: undefined reference to tflite::Register_ADD()’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1303: undefined reference to tflite::Register_SOFTMAX()' /usr/bin/ld: tflite-model/tflite_learn_5_compiled.o:(.data.rel.ro+0x40): undefined reference to tflite::MicroContext::AllocateTempInputTensor(TfLiteNode const*, int)’
/usr/bin/ld: tflite-model/tflite_learn_5_compiled.o:(.data.rel.ro+0x48): undefined reference to tflite::MicroContext::AllocateTempOutputTensor(TfLiteNode const*, int)' /usr/bin/ld: tflite-model/tflite_learn_5_compiled.o:(.data.rel.ro+0x50): undefined reference to tflite::MicroContext::AllocateTempIntermediateTensor(TfLiteNode const*, int)’
/usr/bin/ld: tflite-model/tflite_learn_5_compiled.o:(.data.rel.ro+0x78): undefined reference to typeinfo for tflite::MicroContext' /usr/bin/ld: source/camera.o: in function inference_tflite_setup(ei_learning_block_config_tflite_graph_t*, unsigned long*, TfLiteTensor**, TfLiteTensor**, TfLiteTensor**, TfLiteTensor**, tflite::MicroInterpreter**, std::unique_ptr<void, void ()(void)>&) [clone .constprop.0]β€˜:
/home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:120: undefined reference to tflite::AllOpsResolver::AllOpsResolver()' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:125: undefined reference to tflite::MicroInterpreter::MicroInterpreter(tflite::Model const*, tflite::MicroOpResolver const&, unsigned char*, unsigned long, tflite::MicroResourceVariables*, tflite::MicroProfilerInterface*)’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:130: undefined reference to tflite::MicroInterpreter::AllocateTensors(bool)' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:137: undefined reference to tflite::MicroInterpreter::input(unsigned long)’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:138: undefined reference to tflite::MicroInterpreter::output(unsigned long)' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:141: undefined reference to tflite::MicroInterpreter::output(unsigned long)’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:142: undefined reference to tflite::MicroInterpreter::output(unsigned long)' /usr/bin/ld: source/camera.o: in function run_nn_inference_from_dsp(ei_learning_block_config_tflite_graph_t*, ei::ei_signal_t*, ei::ei_matrix*)β€˜:
/home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:251: undefined reference to tflite::MicroInterpreter::Invoke()' /usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:262: undefined reference to tflite::MicroInterpreter::~MicroInterpreter()’
/usr/bin/ld: source/camera.o: in function run_nn_inference(ei_impulse const*, ei::ei_matrix*, ei_impulse_result_t*, void*, bool)': /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:177: undefined reference to tflite::MicroInterpreter::Invoke()’
/usr/bin/ld: source/camera.o: in function inference_tflite_run': /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:179: undefined reference to tflite::MicroInterpreter::~MicroInterpreter()’
/usr/bin/ld: /home/tstacey00/example-standalone-inferencing-linux/./edge-impulse-sdk/classifier/inferencing_engines/tflite_micro.h:197: undefined reference to `tflite::MicroInterpreter::~MicroInterpreter()’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:187: runner] Error 1

Any ideas would be appreciated.

Hi @tstacey00,

Checking your logs it looks like EON Compiler is enabled:

/home/tstacey00/example-standalone-inferencing-linux/tflite-model/tflite_learn_5_compiled.cpp:1232: undefined reference to tflite::MicroContext::~MicroContext()’

compiled.cpp files are specific to EON compiled projects. Can you double check/rebuild the library with EON disabled? Or point me out to your project ID?

Aurelien

Project ID: 301157.

@aurel Thank you so much for your help! I think I know what might have been happening, based on your response. First I built an EON compiled version, and copied the folders into my directory. Compiled it without acceleration flags. Next I went back to studio, and built a non EON compiled version. Then I copied those folders into the directory, instead of deleting the old folders first. It asked if I wanted to overwrite the duplicate files, which is fine except the EON compiled version contains files that aren’t shared by the non EON compiled version. So copying wont get rid of these unnecessary files! This time i deleted the folders, and did a fresh copy. It worked!

1 Like