Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitbaking tensorflow-lite fails with, Error: 'IsOutRange' is not a member of 'flatbuffers' #76

Open
octonout opened this issue Aug 24, 2021 · 4 comments

Comments

@octonout
Copy link

octonout commented Aug 24, 2021

Issue Description

I am trying to add tensorflow-lite to my Boot2Qt image for Jetson Nano.
My Yocto Release version is dunfell.

bitbake tensorflow-lite command builds the meta-neural-network/recipes-tensorflow/tensorflow-lite/tensorflow-lite_2.3.bb recipe. The recipe does not assign anything to SRCREV for git://github.com/tensorflow/tensorflow;destsuffix=git/;branch=r2.3;protocol=https in the SRC_URI. So, I created the following .bbappend.

unset SRC_URI
SRC_URI = " \
	git://github.com/tensorflow/tensorflow;destsuffix=git/;branch=r2.3;rev=v2.3.0;protocol=https \
	git://gitlab.com/libeigen/eigen.git;destsuffix=eigen/;branch=master;rev=cdb377d0cba4889fc909d1bbdd430b988db0db97;protocol=https \
	git://github.com/google/gemmlowp;destsuffix=gemmlowp/;branch=master;rev=2483d846ad865dd4190fe4a1a1ba2d9cfcea78e1;protocol=https \
	git://github.com/google/googletest;destsuffix=googletest/;branch=master;rev=release-1.10.0;protocol=https \
	git://github.com/abseil/abseil-cpp;destsuffix=abseil-cpp/;branch=master;rev=20190808;nobranch=1;protocol=https \
	git://github.com/intel/ARM_NEON_2_x86_SSE;destsuffix=neon_2_sse/;branch=master;rev=8dbe2461c89760ac4b204aa0eafb72413a97957d;protocol=https \
	git://github.com/google/farmhash;destsuffix=farmhash/;branch=master;rev=0d859a811870d10f53a594927d0d0b97573ad06d;protocol=https \
	git://github.com/google/flatbuffers;destsuffix=flatbuffers/;branch=master;rev=v1.11.0;protocol=https \
	https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz;md5sum=${MD5SUM_FFT};sha256sum=${SHA256SUM_FFT} \
	file://apply-modification-for-tflite-1.15-to-eigen.patch \
	file://tensorflow-lite.pc.in \
"

In the .bbappend, I have set rev=v2.3.0 for the tensorflow repo. On running the bitbake tensorflow-lite do_compile task fails with the following error:

In file included from ./tensorflow/lite/core/api/op_resolver.h:20,
                 from ./tensorflow/lite/model_builder.h:27,
                 from ./tensorflow/lite/model.h:22,
                 from ./tensorflow/lite/c/c_api_internal.h:25,
                 from tensorflow/lite/c/c_api_experimental.cc:24:
./tensorflow/lite/schema/schema_generated.h: In function 'const char* tflite::EnumNameTensorType(tflite::TensorType)':
./tensorflow/lite/schema/schema_generated.h:422:20: error: 'IsOutRange' is not a member of 'flatbuffers'

The above error is followed by the same error on many lines in the schema_generated.h where IsOutRange is used. I have pasted a link to the log file at the bottom of the post.

While looking for a solution I came across this issue on tensorflow repo. In that issue it seems the reason behind the error was IsOutRange not being available in flatbuffers v1.11.0. They seem to have solved the issue by using flatbuffers v1.12.0 as can be seen in this commit which edits the third_party_downloads.inc file.

The ${BUILDDIR}/tmp/work/aarch64-poky-linux/tensorflow-lite/2.3-r0/git/tensorflow/lite/micro/tools/make/third_party_downloads.inc file has the following contents.
FLATBUFFERS_URL is being set like so via the statement defined in else:
FLATBUFFERS_URL := "https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz"

I cannot figure out why the do_compile task throws this error. I will appreciate any help.

Update 1:
${BUILDDIR}/build-jetson-nano-qspi-sd/tmp/work/aarch64-poky-linux/tensorflow-lite/2.3-r0/flatbuffers/src/flatc.cpp has the following line: #define FLATC_VERSION "1.11.0" So the 1.11.0 version of flatbuffers is being downloaded?

Update 2:
Changed the rev for flatbuffers in SRC_URI to git://github.com/google/flatbuffers;destsuffix=flatbuffers/;branch=master;rev=v1.12.0;protocol=https and now the build fails with the following error.

Expected Result

The tensorflow-lite package should get built.

How to Reproduce

As described in the issue description.

Further Information

  • A link to an output result showing the issue: log file
  • Exact OS version: Host for Yocto: Ubuntu 20.04. Yocto Release: dunfell.
@taos-ci
Copy link
Collaborator

taos-ci commented Aug 24, 2021

:octocat: cibot: Thank you for posting issue #76. The person in charge will reply soon.

@anyj0527
Copy link
Member

@octonout The recipe tensorflow-lite_2.3.bb is incomplete. Please use tensorflow-lite_1.15.2.bb instead.
Remove the erroneous file or add following lines in your local.conf

PREFERRED_VERSION_tensorflow-lite-native = "1.15.2"
PREFERRED_VERSION_tensorflow-lite = "1.15.2"

We'll fix the recipe, or any contribution is welcome!

@octonout
Copy link
Author

@octonout The recipe tensorflow-lite_2.3.bb is incomplete. Please use tensorflow-lite_1.15.2.bb instead.
Remove the erroneous file or add following lines in your local.conf

PREFERRED_VERSION_tensorflow-lite-native = "1.15.2"
PREFERRED_VERSION_tensorflow-lite = "1.15.2"

We'll fix the recipe, or any contribution is welcome!

tensorflow-lite_1.15.2.bb builds fine with the changes suggested by you. I think I still want to use tensorflow-lite r2.3. If I make any progress I will update.

Thanks.

@anyj0527
Copy link
Member

@octonout

Please check #77 and #78. They add tensorflow-lite_2.3.0.bb with some passed tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants