# Optional: Build LiteRT

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

Note: LiteRT 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 optional. You can build Qualcomm Linux in certain scenarios,
            such as when you want to change the LiteRT library version.

To recompile LiteRT as part of the Qualcomm Linux build along with the QIMP SDK, see
                [Qualcomm Linux Build Guide](bundle/publicresource/topics/80-70017-254).

## Build Qualcomm Linux

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

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

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

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

### Build with eSDK

For instructions, see [Download and install eSDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-51/install-sdk.html#download-and-install-esdk). The eSDK is an
                installer generated from the Qualcomm Linux image. It provides a complete Yocto
                environment that helps 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-70017-254/build_from_source_qsc_gui_intro.html). Based on your
                access level, download one of the following distributions to compile LiteRT.

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-70017-254/build_from_source_QSC_CLI.html). Based on your access
                level, download one of the following distributions to compile LiteRT.

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-70017-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 LiteRT 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 include the QIMP
                    SDK, which contains LiteRT. 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

        export LC_ALL="en_US.UTF-8"Copy to clipboard

Note: If the `diffstat chrpath` and
                            `liblz4-tool`packages are not preinstalled, run the
                        following commands to install them:
    - sudo apt install diffstat chrpathCopy to clipboard
    - sudo apt install -y zstd liblz4-toolCopy 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 LiteRT libraries as part of the QIMP SDK. All the LiteRT
                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 LiteRT

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

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

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

The flashing process installs the following:

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

By default, LiteRT compiles the following delegates:

- XNNPACK delegate
- GPU delegate
- QNN delegate

Last Published: Jan 06, 2025

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