Failure building TensorFlow Lite Library with Flex Delegate

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Failure building TensorFlow Lite Library with Flex Delegate

Jump to solution
1,117 Views
itaychq
Contributor II

Hi all,

In the "i.MX Machine Learning User's Guide" (UG10166) section 2.6.2 there are detailed instructions for building the TensorFlow Lite Library with the Flex Delegate for i.MX Linux platforms. I need this to execute inference in a TF model containing processing nodes named FlexErf. Unfortunately the build is failing for me, even though the instructions are based on a Docker that includes the entire build environment and is not supposed to be affected by the environment on which it's running. I have tried this on Ubuntu 20.04, Ubuntu 22.04 and Linux Mint 22.1 systems with the same error.

Here are the commands I am entering. On Ubuntu 20 I had to add '--network host' to the docker run line.

$ git clone https://github.com/nxp-imx/tensorflow-imx.git -b lf-6.12.3_1.0.0
$ cd tensorflow-imx
$ docker pull tensorflow/build:2.18-python3.12
$ docker run -e "no_proxy=localhost,127.0.0.1" -it -w /tensorflow -v /`pwd`:/tensorflow -e HOST_PERMS="\\((id -u):\\)(id -g)" tensorflow/build:2.18-python3.12
tf-docker /tensorflow > ./configure # accepted all defaults
tf-docker /tensorflow > bazel --output_base=/tensorflow/docker-build/ build --config=monolithic --config=elinux_aarch64 -c opt --cxxopt='--std=c++17' --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //tensorflow/lite/delegates/flex/test:benchmark_model_plus_flex_full

The error I am receiving is:
ERROR: /tensorflow/docker-build/external/icu/BUILD.bazel:33:11: Compiling icu4c/source/common/brkiter.cpp failed: (Exit 1): aarch64-none-linux-gnu-gcc failed: error executing command (from target @icu//:icuuc) /tensorflow/docker-build/external/aarch64_linux_toolchain/bin/aarch64-none-linux-gnu-gcc -fstack-protector -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -isystem ... (remaining 50 arguments skipped)
In file included from external/icu/icu4c/source/common/brkiter.cpp:27:
external/icu/icu4c/source/common/unicode/rbbi.h:263:19: error: conflicting return type specified for 'virtual UBool icu_70::RuleBasedBreakIterator::operator==(const icu_70::BreakIterator&) const'
263 | virtual UBool operator==(const BreakIterator& that) const;
| ^~~~~~~~
In file included from external/icu/icu4c/source/common/unicode/rbbi.h:30,
from external/icu/icu4c/source/common/brkiter.cpp:27:
/usr/include/unicode/brkiter.h:127:18: note: overridden function is 'virtual bool icu_70::BreakIterator::operator==(const icu_70::BreakIterator&) const'
127 | virtual bool operator==(const BreakIterator&) const = 0;
| ^~~~~~~~
Target //tensorflow/lite/delegates/flex/test:benchmark_model_plus_flex_full failed to build

Since both the version of tensorflow-imx and of the docker are specified according to the versions recommend in the document, and the commands I typed are exactly as described, I would have expected this to work. Does anyone have an idea what I may be doing wrong? Thanks.

0 Kudos
Reply
1 Solution
977 Views
itaychq
Contributor II

Thanks to support from another person at NXP I have overcome the issue.

The problem is due to a discrepancy between the /usr/include/unicode/brkiter.h file inside the docker container and the tensorflow-imx/docker-build/external/icu/icu4c/source/common/unicode/brkiter.h file that Bazel fetches.

The workaround is to rename the /usr/include/unicode folder to something else, before starting the bazel build.

Thanks.

View solution in original post

0 Kudos
Reply
4 Replies
978 Views
itaychq
Contributor II

Thanks to support from another person at NXP I have overcome the issue.

The problem is due to a discrepancy between the /usr/include/unicode/brkiter.h file inside the docker container and the tensorflow-imx/docker-build/external/icu/icu4c/source/common/unicode/brkiter.h file that Bazel fetches.

The workaround is to rename the /usr/include/unicode folder to something else, before starting the bazel build.

Thanks.

0 Kudos
Reply
1,063 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

It appear that the issue is with the toolchain, please check it, since everything works well on my side with the instruction on the document.

Regards

0 Kudos
Reply
1,058 Views
itaychq
Contributor II

Hey, thanks for responding. The toolchain is entirely contained within the docker image that I downloaded according to the instructions, if there is anything wrong with it then it would be failing for you as well. Since the instructions are working for you, can you please try starting from a fresh state and copy-paste the commands I quoted in my original question? Since I tried this sequence on three different machines with different Linux flavors and all failed, the only thing that could be wrong is that I didn't follow the instructions correctly and that something in the commands I am using is wrong. Thanks again.

0 Kudos
Reply
1,056 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

No, you need install the toolchain as the machine learning guide section 2.5.1

regards

0 Kudos
Reply