C++ compiler errors TFlite
Show older comments
Good afternoon,
I have been trying to deploy a tflite model onto my raspberry pi using MATLAB 2024a.
To start i am using:
- Example code (SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample).
- Mex code setup i am using 'Microsoft Visual C++ 2022'
- Built Tensorflow 2.15 on Windows with Bazel 6.10
- Downloaded and setup Raspberry pi Matlab config
- Raspberry pi 32 bit bullseye (python 3.9.2)
- created all of the paths accordingly as stated in Prerequisites for Deep Learning with TensorFlow Lite Models
When i run the code it has no errors. The problem starts once i run:
- codegen -config cfg tflite_semantic_predict -args ones(257,257,3,'single')
The error is as follows:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,'single')
------------------------------------------------------------------------
Error executing command "touch -c /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/bmblaylock42/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="" -C /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict LC_ALL=C". Details:
STDERR: In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp:15:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:398: tflite_semantic_predict.cpp.o] Error 1
STDOUT: make: Entering directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
g++ -c -MMD -MP -MF"tflite_semantic_predict_data.cpp.dep" -MT"tflite_semantic_predict_data.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_data.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_data.cpp"
make: Leaving directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
make: Entering directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
g++ -c -MMD -MP -MF"tflite_semantic_predict_terminate.cpp.dep" -MT"tflite_semantic_predict_terminate.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_terminate.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_terminate.cpp"
make: Leaving directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
make: Entering directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
g++ -c -MMD -MP -MF"tflite_semantic_predict_initialize.cpp.dep" -MT"tflite_semantic_predict_initialize.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_initialize.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_initialize.cpp"
make: Leaving directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
make: Entering directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
g++ -c -MMD -MP -MF"invokeinterpreter.cpp.dep" -MT"invokeinterpreter.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "invokeinterpreter.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp"
make: Leaving directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
make: Entering directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
g++ -c -MMD -MP -MF"tflite_semantic_predict.cpp.dep" -MT"tflite_semantic_predict.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp"
make: Leaving directory '/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict'
------------------------------------------------------------------------
Build error: C++ compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
Error using codegen

Thank you so much i have tried to download the flatbuffers by CMake and bazel but i had no luck since they are 64 bit codes and mine is a 32bit aarch64.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with GPU Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!