I am trying to build a model using tflite micro but it is not working. All the files I have added but linking is not working. Can anyone help in this?
Makebuild files. txt
GNU nano 7.2 build_files.txt
tflite-micro/tensorflow/lite/core/c/common.cc
tflite-micro/tensorflow/lite/kernels/internal/quantization_util.cc
tflite-micro/tensorflow/lite/kernels/internal/tensor_utils.cc
tflite-micro/tensorflow/lite/kernels/internal/portable_type_to_tflitetype.cc
tflite-micro/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.>
tflite-micro/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.cc
tflite-micro/tensorflow/lite/micro/micro_context.cc
tflite-micro/tensorflow/lite/micro/memory_helpers.cc
tflite-micro/tensorflow/lite/micro/micro_utils.cc
tflite-micro/tensorflow/lite/micro/debug_log.cc
tflite-micro/tensorflow/lite/micro/kernels/kernel_util.cc
tflite-micro/tensorflow/lite/micro/kernels/micro_tensor_utils.cc
tflite-micro/tensorflow/lite/micro/kernels/softmax_common.cc
tflite-micro/tensorflow/lite/micro/kernels/softmax.cc
tflite-micro/tensorflow/lite/micro/kernels/reshape_common.cc
tflite-micro/tensorflow/lite/micro/kernels/reshape.cc
After running these commands:
# 1. Clean previous object files
rm -rf build/*
# 2. Open build_files.txt and paste exactly what I wrote above
nano build_files.txt
# [Paste and Save]
# 3. Build again
./build.sh
# 4. Check symbols
./check_missing_symbols.sh
Otuput I am getting:
shubham@acl-ThinkCentre-M720t:~/stt_model_test$ # 1. Clean previous object files
rm -rf build/*
# 2. Open build_files.txt and paste exactly what I wrote above
nano build_files.txt
# [Paste and Save]
# 3. Build again
./build.sh
# 4. Check symbols
./check_missing_symbols.sh
Compiling tflite-micro/tensorflow/lite/core/c/common.cc -> build/common.o
Compiling tflite-micro/tensorflow/lite/kernels/internal/quantization_util.cc -> build/quantization_util.o
Compiling tflite-micro/tensorflow/lite/kernels/internal/tensor_utils.cc -> build/tensor_utils.o
Compiling tflite-micro/tensorflow/lite/kernels/internal/portable_type_to_tflitetype.cc -> build/portable_type_to_tflitetype.o
cc1plus: fatal error: tflite-micro/tensorflow/lite/kernels/internal/portable_type_to_tflitetype.cc: No such file or directory
compilation terminated.
❌ File not found: tflite-micro/tensorflow/lite/kernels/internal/portable_type_to_tflitetype.cc
Compiling tflite-micro/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.cc -> build/portable_tensor_utils_impl.o
Compiling tflite-micro/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.cc -> build/micro_error_reporter.o
Compiling tflite-micro/tensorflow/lite/micro/micro_context.cc -> build/micro_context.o
Compiling tflite-micro/tensorflow/lite/micro/memory_helpers.cc -> build/memory_helpers.o
Compiling tflite-micro/tensorflow/lite/micro/micro_utils.cc -> build/micro_utils.o
Compiling tflite-micro/tensorflow/lite/micro/debug_log.cc -> build/debug_log.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/kernel_util.cc -> build/kernel_util.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/micro_tensor_utils.cc -> build/micro_tensor_utils.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/softmax_common.cc -> build/softmax_common.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/softmax.cc -> build/softmax.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/reshape_common.cc -> build/reshape_common.o
Compiling tflite-micro/tensorflow/lite/micro/kernels/reshape.cc -> build/reshape.o
Linking all object files...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(signed char const*, int, char const*)':
kernel_util.cc:(.text+0x4a0): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: kernel_util.cc:(.text+0x4c5): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(TfLiteEvalTensor const*, int, char const*)':
kernel_util.cc:(.text+0x509): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: kernel_util.cc:(.text+0x52d): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(TfLiteTensor const*, int, char const*)':
kernel_util.cc:(.text+0x579): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/kernel_util.o:kernel_util.cc:(.text+0x59d): more undefined references to `MicroPrintf(char const*, ...)' follow
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::MakeUnpackedInt4Tensor(TfLiteContext*, int, TfLiteEvalTensor const*)':
kernel_util.cc:(.text+0xb8f): undefined reference to `tflite::tensor_utils::UnpackDenseInt4IntoInt8(signed char const*, int, signed char*)'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(signed char const*, int, char const*)':
kernel_util.cc:(.text+0x4dc): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(TfLiteEvalTensor const*, int, char const*)':
kernel_util.cc:(.text+0x544): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/kernel_util.o: in function `tflite::micro::PrintNBytes(TfLiteTensor const*, int, char const*)':
kernel_util.cc:(.text+0x5b4): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/memory_helpers.o: in function `tflite::BytesRequiredForTensor(tflite::Tensor const&, unsigned long*, unsigned long*)':
memory_helpers.cc:(.text+0x1ad): undefined reference to `tflite::ConvertTensorType(tflite::TensorType, TfLiteType*)'
/usr/bin/ld: memory_helpers.cc:(.text+0x1e5): undefined reference to `tflite::ConvertTensorType(tflite::TensorType, TfLiteType*)'
/usr/bin/ld: build/memory_helpers.o: in function `tflite::AllocateOutputDimensionsFromInput(TfLiteContext*, TfLiteTensor const*, TfLiteTensor const*, TfLiteTensor*)':
memory_helpers.cc:(.text+0x534): undefined reference to `tflite::GetTensorShape(TfLiteTensor const*)'
/usr/bin/ld: build/micro_utils.o: in function `tflite::SignedSymmetricPerChannelQuantize(float const*, TfLiteIntArray*, int, signed char*, float*, TfLiteType)':
micro_utils.cc:(.text+0x5f4): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/softmax.o: in function `tflite::(anonymous namespace)::SoftmaxEval(TfLiteContext*, TfLiteNode*)':
softmax.cc:(.text+0x498): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/micro_context.o: in function `tflite::MicroContextReportOpError(TfLiteContext*, char const*, ...)':
micro_context.cc:(.text+0x127): undefined reference to `VMicroPrintf(char const*, __va_list_tag*)'
/usr/bin/ld: build/micro_error_reporter.o: in function `tflite::MicroErrorReporter::Report(char const*, __va_list_tag*)':
micro_error_reporter.cc:(.text+0xf): undefined reference to `VMicroPrintf(char const*, __va_list_tag*)'
/usr/bin/ld: build/micro_tensor_utils.o: in function `tflite::PortableApplyActivationToVector(float const*, int, TfLiteFusedActivation, float*)':
micro_tensor_utils.cc:(.text+0x148): undefined reference to `tflite::tensor_utils::ApplyReluToVector(float const*, int, float*)'
/usr/bin/ld: micro_tensor_utils.cc:(.text+0x158): undefined reference to `tflite::tensor_utils::ApplyRelu1ToVector(float const*, int, float*)'
/usr/bin/ld: micro_tensor_utils.cc:(.text+0x168): undefined reference to `tflite::tensor_utils::ApplyRelu6ToVector(float const*, int, float*)'
/usr/bin/ld: micro_tensor_utils.cc:(.text+0x1b8): undefined reference to `tflite::tensor_utils::ApplySignbitToVector(float const*, int, float*)'
/usr/bin/ld: build/reshape_common.o: in function `tflite::(anonymous namespace)::ReshapeOutput(TfLiteContext*, TfLiteNode*)':
reshape_common.cc:(.text+0x2c2): undefined reference to `MicroPrintf(char const*, ...)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SymmetricQuantizeFloats(float const*, int, signed char*, float*, float*, float*)':
tensor_utils.cc:(.text+0x85): undefined reference to `tflite::tensor_utils::PortableSymmetricQuantizeFloats(float const*, int, signed char*, float*, float*, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SymmetricQuantizeFloats(float const*, int, signed char*, float, float, float*)':
tensor_utils.cc:(.text+0x95): undefined reference to `tflite::tensor_utils::PortableSymmetricQuantizeFloats(float const*, int, signed char*, float, float, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, float*)':
tensor_utils.cc:(.text+0xc5): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, float*, float const*, int const*, int*, int*, bool*, tflite::CpuBackendContext*)':
tensor_utils.cc:(.text+0xd5): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, float*, float const*, int const*, int*, int*, bool*, tflite::CpuBackendContext*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, int*, float*, tflite::CpuBackendContext*)':
tensor_utils.cc:(.text+0xef): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiplyAccumulate(signed char const*, int, int, signed char const*, float const*, int, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SparseMatrixBatchVectorMultiplyAccumulate1x4(float const*, int const*, int const*, int, int, float const*, int, float*)':
tensor_utils.cc:(.text+0x105): undefined reference to `tflite::tensor_utils::PortableSparseMatrixBatchVectorMultiplyAccumulate1x4(float const*, int const*, int const*, int, int, float const*, int, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SparseMatrixBatchVectorMultiplyAccumulate(float const*, unsigned char const*, int, int, float const*, int, float*)':
tensor_utils.cc:(.text+0x115): undefined reference to `tflite::tensor_utils::PortableSparseMatrixBatchVectorMultiplyAccumulate(float const*, unsigned char const*, int, int, float const*, int, float*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SparseMatrixBatchVectorMultiplyAccumulate1x16(signed char const*, int const*, int const*, int, int, signed char const*, int const*, int, int, int, int, int const*, int const*, int, int, int, signed char*)':
tensor_utils.cc:(.text+0x125): undefined reference to `tflite::tensor_utils::PortableSparseMatrixBatchVectorMultiplyAccumulate1x16(signed char const*, int const*, int const*, int, int, signed char const*, int const*, int, int, int, int, int const*, int const*, int, int, int, signed char*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::SparseMatrixBatchVectorMultiplyAccumulate(signed char const*, unsigned char const*, int, int, signed char const*, float const*, int, float*, float const*)':
tensor_utils.cc:(.text+0x135): undefined reference to `tflite::tensor_utils::PortableSparseMatrixBatchVectorMultiplyAccumulate(signed char const*, unsigned char const*, int, int, signed char const*, float const*, int, float*, float const*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiplyAccumulate(signed char const*, int const*, signed char const*, int, int, int, int, int, int, int*, short*, tflite::CpuBackendContext*)':
tensor_utils.cc:(.text+0x145): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiplyAccumulate(signed char const*, int const*, signed char const*, int, int, int, int, int, int, int*, short*, tflite::CpuBackendContext*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiplyAccumulate(signed char const*, int const*, signed char const*, int, int, int, int, int, int, int*, signed char*, tflite::CpuBackendContext*)':
tensor_utils.cc:(.text+0x155): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiplyAccumulate(signed char const*, int const*, signed char const*, int, int, int, int, int, int, int*, signed char*, tflite::CpuBackendContext*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixScalarMultiplyAccumulate(signed char const*, int, int, int, int*)':
tensor_utils.cc:(.text+0x165): undefined reference to `tflite::tensor_utils::PortableMatrixScalarMultiplyAccumulate(signed char const*, int, int, int, int*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiply(signed char const*, int, signed char const*, int, int, int, int, int, signed char*, signed char)':
tensor_utils.cc:(.text+0x17e): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiply(signed char const*, int, signed char const*, int, int, int, int, int, signed char*, signed char)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::MatrixBatchVectorMultiply(short const*, signed char const*, int, int, int const*, int, int, int, int, signed char*)':
tensor_utils.cc:(.text+0x195): undefined reference to `tflite::tensor_utils::PortableMatrixBatchVectorMultiply(short const*, signed char const*, int, int, int const*, int, int, int, int, signed char*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::ApplyLayerNorm(short const*, short const*, int const*, int, int, int, int, int, short*)':
tensor_utils.cc:(.text+0x1a5): undefined reference to `tflite::tensor_utils::PortableApplyLayerNorm(short const*, short const*, int const*, int, int, int, int, int, short*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::ApplyLayerNormFloat(short const*, short const*, int, int, int const*, int, int, short*)':
tensor_utils.cc:(.text+0x1b5): undefined reference to `tflite::tensor_utils::PortableApplyLayerNormFloat(short const*, short const*, int, int, int const*, int, int, short*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::ApplySigmoid(short const*, int, int, short*)':
tensor_utils.cc:(.text+0x1c5): undefined reference to `tflite::tensor_utils::PortableApplySigmoid(short const*, int, int, short*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::ApplyTanh(int, short const*, int, int, short*)':
tensor_utils.cc:(.text+0x1e5): undefined reference to `tflite::tensor_utils::PortableApplyTanh(int, short const*, int, int, short*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::CwiseMul(short const*, short const*, int, int, int, int, int, signed char*)':
tensor_utils.cc:(.text+0x215): undefined reference to `tflite::tensor_utils::PortableCwiseMul(short const*, short const*, int, int, int, int, int, signed char*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::VectorBatchVectorCwiseProductAccumulate(short const*, int, short const*, int, int, int, short*)':
tensor_utils.cc:(.text+0x525): undefined reference to `tflite::tensor_utils::PortableVectorBatchVectorCwiseProductAccumulate(short const*, int, short const*, int, int, int, short*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::BatchVectorBatchVectorDotProduct(short const*, short const*, int, int, int*)':
tensor_utils.cc:(.text+0x545): undefined reference to `tflite::tensor_utils::PortableBatchVectorBatchVectorDotProduct(short const*, short const*, int, int, int*)'
/usr/bin/ld: build/tensor_utils.o: in function `tflite::tensor_utils::TwoGateSaturatingAdd(signed char const*, signed char, signed char const*, signed char, int, int, int, int, int, int, short*)':
tensor_utils.cc:(.text+0x9ac): undefined reference to `tflite::tensor_utils::PortableTwoGateSaturatingAdd(signed char const*, signed char, signed char const*, signed char, int, int, int, int, int, int, short*)'
collect2: error: ld returned 1 exit status
Checking compiled object files in ./build for required TFLM symbols...
❌ MISSING: TfLiteIntArrayGetSizeInBytes
❌ MISSING: TfLiteEvalTensorByteLength
❌ MISSING: TfLiteTypeSizeOf
❌ MISSING: TfLiteTypeGetName
❌ MISSING: BytesRequiredForTensor
❌ MISSING: SoftmaxInit
❌ MISSING: SoftmaxPrepare
❌ MISSING: PrepareReshapeReference
❌ MISSING: PortableApplyTanh
❌ MISSING: PortableApplySigmoid
❌ MISSING: PortableMatrixBatchVectorMultiply
❌ MISSING: PortableMatrixBatchVectorMultiplyAccumulate
❌ MISSING: PortableCwiseMul
❌ MISSING: PortableApplyLayerNorm
❌ MISSING: GetMicroErrorReporter
Missing 15 symbol(s). Please ensure the corresponding .cc files are added to build_files.txt or compiled manually.
shubham@acl-ThinkCentre-M720t:~/stt_model_test$ nano build_files.txt
shubham@acl-ThinkCentre-M720t:~/stt_model_test$
I am trying to build a model on ubuntu and I am able to build successfully but in the linking I am getting errors I have already tried every mehtod, but no solution.