tensorflow: TensorFlow Lite: undefined reference to `flatbuffers::ClassicLocale::instance_'
Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
- TensorFlow installed from (source or binary): source
- TensorFlow version: r1.13
- Python version: 3.5
- Installed using virtualenv? pip? conda?: virtualenv
- Bazel version (if compiling from source): N/A
- GCC/Compiler version (if compiling from source): 7.4.0
- CUDA/cuDNN version: N/A
- GPU model and memory: N/A
Describe the problem
I was following the instructions to crosscompile TensorFlow Lite for my Raspberry Pi. I got the error messages showing the undefined reference to flatbuffers.
I believe all the dependencies for Lite are downloaded by the download_dependencies.sh script, but I do not have Bazel installed. Is Bazel necessary for compiling TensorFlow Lite?
Any other info / logs
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(while.o): In function `tflite::ops::custom::while_kernel::Init(TfLiteContext*, char const*, unsigned int)':
while.cc:(.text+0x1648): undefined reference to `flatbuffers::ClassicLocale::instance_'
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(audio_spectrogram.o): In function `tflite::ops::custom::audio_spectrogram::Init(TfLiteContext*, char const*, unsigned int)':
audio_spectrogram.cc:(.text+0xe0c): undefined reference to `flatbuffers::ClassicLocale::instance_'
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(detection_postprocess.o): In function `tflite::ops::custom::detection_postprocess::Init(TfLiteContext*, char const*, unsigned int)':
detection_postprocess.cc:(.text+0x211c): undefined reference to `flatbuffers::ClassicLocale::instance_'
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(detection_postprocess.o): In function `flexbuffers::Reference::AsInt64() const':
detection_postprocess.cc:(.text._ZNK11flexbuffers9Reference7AsInt64Ev[_ZNK11flexbuffers9Reference7AsInt64Ev]+0x264): undefined reference to `flatbuffers::ClassicLocale::instance_'
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(if.o): In function `tflite::ops::custom::if_kernel::Init(TfLiteContext*, char const*, unsigned int)':
if.cc:(.text+0xf8c): undefined reference to `flatbuffers::ClassicLocale::instance_'
/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(mfcc.o):mfcc.cc:(.text+0x118c): more undefined references to `flatbuffers::ClassicLocale::instance_' follow
collect2: error: ld returned 1 exit status
tensorflow/lite/tools/make/Makefile:267: recipe for target '/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/bin/minimal' failed
make: *** [/home/user/GitRepo/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/bin/minimal] Error 1
make: *** Waiting for unfinished jobs....
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 32 (3 by maintainers)
Ok, this one for you -https://mega.nz/#!eYVSzaII!cJbqTnJa2QYotKpJtnFnLl9gaIl4z9rnAizmOn_yQQ8 (but i don’t know the country Yandex is blocked, you are the first). I will not use google drive, dropbox or any other global-spy services.
I made a patch in Makefile for this -
$(wildcard tensorflow/lite/tools/make/downloads/flatbuffers/src/util.cpp)at ther end of CORE_CC_ALL_SRC$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(TF_LITE_CC_SRCS)))))and$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(BENCHMARK_SRCS)))))$(OBJDIR)%.o: %.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@near other OBJDIR declarations.Now it builds and works.
Hi @T-Troll … Thanks for the update. I have added the workarounds mentioned in issue 26731 along with your changes to the Makefile.
Now I am successful in building the library for aarch64 architecture. Gist of the new Makefile for aarch64
@jvishnuvardhan this issue is still in the codebase. I’m not knowledgeable enough about the TF codebase to know whether this solution is a hacky workaround or a clean solution — but I don’t think the issue should be closed. Think we need a PR.
Yes, it belongs to mess in makefile or in /targets/rpi_makefile.inc
Some points. I build TF lite for custom ARM board, so i use armel, not armhf. Here are my Makefile - https://yadi.sk/d/KDQHxzSb-y5u5Q
PS: don’t forget to run
make cleanafter you change makefile!@PeterVanNostrand … Good that you can build it. But I am trying for aarch64 architecture, and there is no script for that in 1.13 branch. 😞
@T-Troll … After making the changes you have suggested, i am facing the issue
and when i checked with
./build_rpi_lib.sh, a similar error occured:Probably i am doing something wrong when editing the
Makefileas you suggested. Can you please provide the working Makefile via a gist or something .?!Many Thanks in advance …! 😃