# 编译并安装示例程序

此示例演示了编译 `gst-ai-classification` 示例应用程序的步骤。

> 
> 
> `$ESDK_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer-sample-apps/` 目录包含可用的 AI 示例应用程序。

所有 AI 示例应用程序均命名为 `qcom-gst-ai-*`。

在接下来的步骤中将 `gst-ai-classification` 替换为用户选择的示例应用程序。

1. 搭建环境：

cd $ESDK_ROOT
        Copy to clipboard

source environment-setup-armv8-2a-qcom-linux
        Copy to clipboard
2. 下载示例程序源代码。

cd $ESDK_ROOT
        Copy to clipboard

devtool modify qcom-gst-ai-classification
        Copy to clipboard

    其中 `qcom-gst-ai-classification` 是下载参考应用程序源代码的 bitbake recipe。

NOTE: Starting bitbake server...
        Loading cache: 100% |######################################| Time: 0:00:00
        Loaded 9814 entries from dependency cache.
        Parsing recipes: 100% |####################################| Time: 0:00:01
        Parsing of 6704 .bb  files complete (6674 cached, 30 parsed). 9842 targets, 842 skipped, 0 masked, 0 errors.
        NOTE: Resolving any missing task queue dependencies
        Initialising tasks: 100% |#################################| Time: 0:00:55
        Sstate summary: Wanted 10 local 0 mirrors 0 Missed 10 Current 10 (0% match, 50% complete)
        NOTE: Executing Tasks
        NOTE: Tasks Summary: Attempted 93 tasks of which 90 didn't need to be rerun and all succeeded.
        INFO: Source tree extracted to /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gst-ai-classification
        Copy to clipboard

    参考应用程序源代码将下载到 `$ESDK_ROOT/workspace/sources/qcom-gst-ai-classification`。

[/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gst-ai-classification]$ ls
        CMakeLists.txt main.c
        [/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gst-ai-classification]$
        Copy to clipboard
3. 定制完成后，使用以下命令重新编译示例程序。

devtool build qcom-gst-ai-classification
        Copy to clipboard

NOTE: Starting bitbake server...
        Loading cache: 100% |################################################| Time: 0:00:00
        Loaded 9814 entries from dependency cache.
        Parsing recipes: 100% |##############################################| Time: 0:00:01
        Parsing of 6704 .bb  files complete (6674 cached, 30 parsed). 9842 targets, 842 skipped, 0 masked, 0 errors.
        NOTE: Resolving any missing task queue dependencies
        Initialising tasks: 100% |###########################################| Time: 0:00:55
        Checking sstate mirror object availability: 100% |###################| Time: 0:01:06
        Sstate Summary: Wanted 391 Local 0 Mirrors 0 Missed 391 Current 381 (0% match, 49% complete)
        NOTE: Executing Tasks
        NOTE: qcom-gst-ai-classification: compiling from external source tree /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gst-ai-classification
        Copy to clipboard
4. 生成应用程序安装程序 (`.ipk`) 以在设备上安装应用程序。

devtool package qcom-gst-ai-classification
        Copy to clipboard

    确认可安装软件包已位于以下路径。

ls $ESDK_ROOT/tmp/deploy/ipk/armv8-2a | grep qcom-gst-ai-classification
        qcom-gst-ai-classification_1.0-r0_armv8-2a.ipk
        qcom-gst-ai-classification_dbg_1.0-r0_armv8-2a.ipk
        qcom-gst-ai-classification_dev_1.0-r0_armv8-2a.ipk
        qcom-gst-ai-classification_src_1.0-r0_armv8-2a.ipk
        [/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gst-ai-classification]$
        Copy to clipboard
5. 将 `qcom-gst-ai-classification_1.0-r0_armv8-2a.ipk` 复制至 RB3Gen2 设备以安装编译的参考应用程序。
6. 通过 SSH shell 连接到设备：

ssh root@<IP addr of the target device>
        Copy to clipboard

Note

如果出现提示，请输入 `oelinux123` 作为 SSH shell 的密码。
7. 在目标设备上运行以下命令。

mount -o remount,rw /
        exit
        Copy to clipboard
8. 在主机上运行以下命令：

cd $ESDK_ROOT/tmp/deploy/ipk/armv8-2a/
        Copy to clipboard

scp qcom-gst-ai-classification_1.0-r0_armv8-2a.ipk root@<IP addressof the target device>:/opt/
        Copy to clipboard
9. 通过 SSH shell 连接到设备：

ssh root@<IP addr of the target device>
        Copy to clipboard
10. 在目标设备上运行以下命令：

opkg --force-depends --force-reinstall --force-overwrite install /opt/qcom- gst-ai-classification_1.0-r0_armv8-2a.ipk
        Copy to clipboard
11. 如下图所示，验证是否安装成功：

Installing qcom-gst-ai-classification (1.0) on root
        Configuring qcom-gst-ai-classification.
        sh-5.1#
        Copy to clipboard

    现在，从终端启动修改后的应用程序即可运行。

    **例如：**

    1. 运行以下命令，以启用显示屏。

export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1
            Copy to clipboard
    2. 使用以下命令来运行应用程序

/usr/bin/gst-ai-classification
            Copy to clipboard

Last Published: Jan 25, 2026

[Previous Topic
下载并安装 eSDK 平台](https://docs.qualcomm.com/bundle/publicresource/80-70017-15BY/topics/download-install-platform-esdk.md) [Next Topic
编译并安装 Qualcomm IM SDK 插件](https://docs.qualcomm.com/bundle/publicresource/80-70017-15BY/topics/compile-install-imsdk-plugins.md)