Building libtensorflow-lite.a on BeagleBone AI

241 views
Skip to first unread message

Matt Anderson

unread,
Apr 28, 2020, 6:52:20 PM4/28/20
to TensorFlow Lite
Hi all,


I've been attempting to build the TF Lite library on my BeagleBone AI (32-bit ARMv7 MCU) for several days now, to no avail.

I was hoping to use the `build_bbb_lib.sh` script found in tensorflow/tensorflow/lite/tools/make, but I get some compiler errors when it runs, and eventually the process comes to a halt. I've attached the shell output and traceback.

Can someone help me decipher what is going on with this build script? I figured using a script for the BeagleBone Black wouldn't be so different from the BBAI, but I could be wrong.

Is there an alternate method I should try in order to link my project with the relevant TF Lite interpreter files for running inference in C++? Any help is appreciated - thank you!


-Matt


build_bbb_lib_out.txt
build_bbb_lib_traceback.txt

Jared Duke

unread,
May 5, 2020, 1:37:24 PM5/5/20
to Matt Anderson, TensorFlow Lite
Hey Matt,

Is it a requirement that you compile the library on your BeagleBone? Would cross-compilation from a generic Linux host work for your needs?

Jared

--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/d49437b3-67d0-48ed-b6ca-828acaa14184%40tensorflow.org.

Matt Anderson

unread,
May 5, 2020, 2:55:09 PM5/5/20
to TensorFlow Lite, matthewda...@gmail.com
Hi Jared,

I suppose that's not a bad idea. Which packages would I have to install on a Ubuntu VM, and which environment variables would I need to worry about? Sorry if these are naive questions, but I have not attempted to cross-compile something like this before.

Kindly,
Matt



On Tuesday, May 5, 2020 at 10:37:24 AM UTC-7, Jared Duke wrote:
Hey Matt,

Is it a requirement that you compile the library on your BeagleBone? Would cross-compilation from a generic Linux host work for your needs?

Jared

On Tue, Apr 28, 2020 at 3:52 PM Matt Anderson <matthewda...@gmail.com> wrote:
Hi all,


I've been attempting to build the TF Lite library on my BeagleBone AI (32-bit ARMv7 MCU) for several days now, to no avail.

I was hoping to use the `build_bbb_lib.sh` script found in tensorflow/tensorflow/lite/tools/make, but I get some compiler errors when it runs, and eventually the process comes to a halt. I've attached the shell output and traceback.

Can someone help me decipher what is going on with this build script? I figured using a script for the BeagleBone Black wouldn't be so different from the BBAI, but I could be wrong.

Is there an alternate method I should try in order to link my project with the relevant TF Lite interpreter files for running inference in C++? Any help is appreciated - thank you!


-Matt


--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfl...@tensorflow.org.

Terry Heo (Woncheol)

unread,
May 6, 2020, 1:01:45 AM5/6/20
to Matt Anderson, TensorFlow Lite
Hi, Matt.

If you want to build TFLite library natively, you just need to run this command.
$ make -f tensorflow/lite/tools/make/Makefile

BTW, I can also see the cross build failure with `build_bbb_lib.sh`. Let me check it.

Regarding the using TFLite library, you can refer this part of the Makefile.

Thanks.
Terry

To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/c585e123-0231-400d-b6e9-0e1a41c2e0dc%40tensorflow.org.

Terry Heo (Woncheol)

unread,
May 6, 2020, 3:37:23 AM5/6/20
to Matt Anderson, TensorFlow Lite
CIL

On Wed, May 6, 2020 at 2:01 PM Terry Heo (Woncheol) <terr...@google.com> wrote:
Hi, Matt.

If you want to build TFLite library natively, you just need to run this command.
$ make -f tensorflow/lite/tools/make/Makefile

BTW, I can also see the cross build failure with `build_bbb_lib.sh`. Let me check it.
I needed to run download_dependencies.sh. I don't have any cross build issues with build_bbb_lib.sh script now. (With the master branch)
Let me know if you still have the issue.

Matt Anderson

unread,
May 6, 2020, 2:59:49 PM5/6/20
to TensorFlow Lite, matthewda...@gmail.com
Hi Terry,

I tried the first command you sent, but got an error again. See attached.

Can you confirm that `build_bbb_lib.sh` works on the BeagleBone AI version of the BeagleBone lineup? After pulling the most recent master branch and running download_dependencies.sh followed by the BBB build script, it still hangs (going on 1 hour now trying to compile `activations.o`).

-Matt
CIL

make_tflitelib_traceback.txt
make_tflitelib.txt

Terry Heo (Woncheol)

unread,
May 6, 2020, 8:19:57 PM5/6/20
to Matt Anderson, TensorFlow Lite
I don't have any BeagleBone devices so I can't verify native build flow.
BTW, the error log "g++: internal compiler error: Killed (program cc1plus)" looks like compiler has an issue. Can you get an updated gcc?

I strongly recommend to use cross compiling since building TFLite requires lots of RAM. I think 1G ram + swap could work but it's slow.

Terry

To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/01ca5eec-dbb4-49be-9167-4e098f8fa9e4%40tensorflow.org.

Leah Pillsbury

unread,
Apr 11, 2021, 4:30:26 PM4/11/21
to TensorFlow Lite, Terry (Woncheol) Heo, TensorFlow Lite, matthewda...@gmail.com, Leah Pillsbury
Hi Terry/Matthew,
I'm wondering if you ever got this working successfully on the BeagleBone AI? I'm considering making a Google Summer of Code project out of making it straightforward to use Tensorflow Lite on BeagleBone AI.  I wanted to first understand 1) why it doesn't work natively for people and 2) if this is something that can be solved with an additional library or plugin on the BeagleBone AI side. (The project would be through BeagleBoard.org)  Of course I see you were having this issue a year ago, and if it's already been solved, no need to reinvent the wheel. I just know it seems necessary for an AI SBC to be able to use TensorflowLite, and that I too would like to be able to do so easily.
Thanks
Leah

Terry Heo (Woncheol)

unread,
Apr 11, 2021, 9:02:32 PM4/11/21
to Leah Pillsbury, TensorFlow Lite, matthewda...@gmail.com, Leah Pillsbury
Hi, Leah.

If you're talking about the native building (building BeagleBone binary on BeagleBone), you need to make sure you have enough RAM installed.
As I said, 1G ram + swap could work but it would be slow.

That's why I recommend using cross compilation.
I don't think we have a known issue for ARM cross compilation now.

FYI, CMake support was added recently.
For ARM cross compilation with CMake. you may want to check the following page.
I think ARMv7 NEON (armhf) binary will work nicely with BeagleBone AI.
But please let me know if you have any issues with it.

Thanks.
Terry
Reply all
Reply to author
Forward
0 new messages