# Optional: Build TensorFlow Lite Runtime

Source: [https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html](https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html)

Note: TensorFlow Lite Runtime and its libraries are built as part of
            the Qualcomm Linux build along with the Qualcomm Intelligent Multimedia Product (QIMP)
            SDK. Therefore, building Qualcomm Linux is an optional step. You can build Qualcomm
            Linux in some situations such as when you want to change the TensorFlow Lite Runtime
            library version.

You can recompile TensorFlow Lite as part of the Qualcomm Linux build along with the QIMP
            SDK. For instructions, see [Qualcomm Linux Build Guide](bundle/publicresource/topics/80-70015-254).

## Build Qualcomm Linux

Source: [https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html](https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html)

You can build Qualcomm Linux using any of the following methods:

- Platform eSDK
- GUI-based Qualcomm^®^ Software Center (QSC) Launcher
- QSC CLI
- GitHub workflow

All the build methods require you to select a product ID and distribution. Based on the
            selected product ID and distribution, TensorFlow Lite Runtime is built as part of the
            QIMP SDK.

### Build with Platform eSDK

For instructions, see [Download and install the Platform eSDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-15B/compile-app-esdk.html#download-and-install-the-platform-esdk).
                The Platform eSDK is an installer generated from the Qualcomm Linux image. It
                provides a complete Yocto environment that allows you to synchronize, modify,
                compile, and install applications and open-source plug-ins.

### Build with GUI-based QSC Launcher

For instructions, see [Build with QSC Launcher](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/build_from_source_qsc_gui_intro.html). Based on your
                access level, download one of the following distributions to compile TensorFlow
                Lite:

Table : Distribution based on user access level

| Access level | Distribution to use |
| --- | --- |
| Public developer (unregistered) | Qualcomm\_Linux.SPF.1.0|TEST|DEVICE|PB\_QIMPSDK |
| Licensed developer with authorized access | Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|NM\_QIMPSDK |

### Build with QSC CLI

For instructions, see [Build with QSC CLI](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/build_from_source_QSC_CLI.html). Based on your access
                level, download one of the following distributions to compile TensorFlow Lite:

Table : Distribution based on user access level

| Access level | Distribution to use |
| --- | --- |
| Public developer (unregistered) | Qualcomm\_Linux.SPF.1.0|TEST|DEVICE|PB\_QIMPSDK |
| Licensed developer with authorized access | Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|NM\_QIMPSDK |

### Build with GitHub workflow

For instructions, see [GitHub workflow](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/build_from_source_github_intro.html). The instructions help you
                to do the following:

- Set up an environment on the host machine to build Qualcomm Linux.
- Clone the Qualcomm Linux code.
- Set up the build environment and compile Qualcomm Linux.

To synchronize the Qualcomm Linux code and clone the QIMP SDK and TensorFlow Lite
                sources along with it, do the following:

1. To synchronize the Qualcomm Linux code, do the following:
    1. Get the release ID from the [Qualcomm manifest](https://github.com/quic-yocto/qcom-manifest). For example,
                                `qcom-6.6.38-QLI.1.2-Ver.1.0_qim-product-sdk-1.1.1.xml`.
    2. Use the release ID to run the repo init command as
                            shown in the following
                            example:

            # cd to directory where you have sufficient storage to create your workspaces
            mkdir <WORKSPACE DIR>
            cd <WORKSPACE DIR>Copy to clipboard

            repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-kirkstone -m qcom-6.6.38-QLI.1.2-Ver.1.0_qim-product-sdk-1.1.1.xmlCopy to clipboard
    3. To fetch the release from the Qualcomm manifest, run the following
                            command:

            repo syncCopy to clipboard
2. Before compiling the Qualcomm Linux build, add EXTRALAYERS to add the QIMP SDK.
                    The QIMP SDK includes TensorFlow Lite. To add EXTRALAYERS, run the following
                    commands:

        export EXTRALAYERS="meta-qcom-qim-product-sdk"Copy to clipboard

        MACHINE=<machine> DISTRO=qcom-wayland QCOM_SELECTED_BSP=<override> source setup-environmentCopy to clipboard

        MACHINE=<machine> DISTRO=qcom-wayland QCOM_SELECTED_BSP=<override> source setup-environment
        # Example, MACHINE=qcs6490-rb3gen2-vision-kit DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        # source setup-environment: Sets the environment, creates the build directory build-qcom-wayland,
        # and enters into build-qcom-wayland directory.Copy to clipboard

        bitbake qcom-multimedia-imageCopy to clipboard

        # To build just Qualcomm IM Product SDK
        bitbake qcom-qim-product-sdk
        Copy to clipboard

These commands build the TensorFlow Lite libraries as part of the QIMP SDK. All
                TensorFlow Lite libraries and binaries are packaged into a zip file in the
                    `.ipk` format and are available with the system images to be
                flashed onto the device.

## Install TensorFlow Lite Runtime

Source: [https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html](https://docs.qualcomm.com/doc/80-70015-54/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html)

To install TensorFlow Lite Runtime, flash the images. The flashing process installs
        user space images, QIMP SDK, TensorFlow Lite Runtime artifacts, and
        dependencies.

For flashing instructions, see [Flash images](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/flash_images.html).

The flashing process installs the following:

- All user space images along with QIMP SDK
- The following TensorFlow Lite Runtime artifacts:
    - libtensorflowlite\_c.so
    - multimodel\_label\_image
    - label\_image
    - inf\_diff\_run\_eval
    - image\_classify\_run\_eval
    - benchmark\_model
    - object\_detect\_run\_eval
- TensorFlow Lite Runtime dependencies, such as Qualcomm AI Engine direct SDK
                libraries and binaries

By default, TensorFlow Lite Runtime compiles the following delegates:

- XNNPACK delegate
- GPU delegate
- QNN delegate

Last Published: Oct 09, 2024

[Previous Topic
Sample applications](https://docs.qualcomm.com/bundle/publicresource/80-70015-54/topics/sample-applications.md) [Next Topic
References](https://docs.qualcomm.com/bundle/publicresource/80-70015-54/topics/references.md)