tensorflow: Build error in tensorflow lite minimal example

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

2.16.2

Custom code

No

OS platform and distribution

Linux Ubuntu 22.04

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/compiler version

11.4.0

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

Following guide at https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/examples/minimal

Did not modify any files. The build step (5) fails with an undefined reference error (see log outputs). Building standalone tensorflow lite with cmake following https://www.tensorflow.org/lite/guide/build_cmake works just fine.

Standalone code to reproduce the issue

sudo apt-get install cmake
wget http://es.archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi7_3.3-4_amd64.deb
sudo dpkg -i libffi7_3.3-4_amd64.deb
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir minimal_build
cd minimal_build
cmake ../tensorflow_src/tensorflow/lite/examples/minimal
cmake --build . -j

Relevant log output

[100%] Built target tensorflow-lite
[100%] Building CXX object CMakeFiles/minimal.dir/minimal.cc.o
[100%] Linking CXX executable minimal
/usr/bin/ld: tensorflow-lite/libtensorflow-lite.a(fully_connected.cc.o): in function `tflite::ops::builtin::fully_connected::EvalHybridDense4Bit(TfLiteContext*, TfLiteNode*, TfLiteFullyConnectedParams*, tflite::ops::builtin::fully_connected::OpData*, TfLiteTensor const*, TfLiteTensor const*, TfLiteTensor const*, TfLiteTensor*, TfLiteTensor*, TfLiteTensor*, TfLiteTensor*, TfLiteTensor*)':
fully_connected.cc:(.text+0x3d02): undefined reference to `tflite::optimized_4bit::ReferenceBatchQuantizeFloats4Bit(float const*, int, int, signed char*, float*, int, int, int*)'
/usr/bin/ld: fully_connected.cc:(.text+0x3d50): undefined reference to `tflite::optimized_4bit::ReferenceAssignBiasAndComputeOffsets(int const*, float const*, float const*, float const*, float*, int, int)'
/usr/bin/ld: fully_connected.cc:(.text+0x3db9): undefined reference to `void tflite::optimized_4bit::ReferenceRunKernel<4, 1, 32>(unsigned char const*, signed char const*, int*, int, int, int, int, int, int)'
/usr/bin/ld: fully_connected.cc:(.text+0x3ded): undefined reference to `void tflite::optimized_4bit::ReferenceUnpack<4, 1>(float*, int const*, int, int, float const*, float const*, int, int)'
/usr/bin/ld: fully_connected.cc:(.text+0x3ff6): undefined reference to `tflite::optimized_4bit::ReferencePrepack(unsigned char*, signed char const*, int, int, int, int, int, int)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/minimal.dir/build.make:186: minimal] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1372: CMakeFiles/minimal.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @pkgoogle, if we can establish a corporate CLA I will create a PR.