> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ubuntu platform

This section explains how to compile QIMSDK plugins for Ubuntu platform.

<Tabs>
  <Tab title="On-device Compilation">
    This section explains how to compile QIMSDK plugins directly on the **target device** running Ubuntu.

    ## Prerequisites

    Before you begin, ensure the following:

    * You have access to a Qualcomm development kit running Ubuntu Linux.
    * You have administrative privileges (sudo access) for installing packages.
    * Internet connectivity for downloading packages and source code.

    ## Steps to Compile and Install

    To download the source code and compile the sample applications, run the following commands on the Qualcomm development kit.

    <Steps>
      <Step title="Update user permissions for your session">
        ```bash theme={null} theme={null}
        sudo su
        ```
      </Step>

      <Step title="Configure Ubuntu package manager to download source code">
        ```bash theme={null} theme={null}
        apt-add-repository -s ppa:ubuntu-qcom-iot/qcom-ppa
        ```
      </Step>

      <Step title="Build the dependencies">
        ```bash theme={null} theme={null}
        apt build-dep gst-plugins-qti-oss
        ```
      </Step>

      <Step title="Install the base development package">
        ```bash theme={null} theme={null}
        apt install libgstreamer1.0-plugins-qcom-base-dev
        ```
      </Step>

      <Step title="Change directory to home folder">
        ```bash theme={null} theme={null}
        cd /home/ubuntu
        ```
      </Step>

      <Step title="Download the sources of the QIM Package">
        ```bash theme={null} theme={null}
        apt source gst-plugins-qti-oss
        ```
      </Step>

      <Step title="Go to QIM root folder">
        For example:

        ```bash theme={null} theme={null}
        cd gst-plugins-qti-oss-1.0.r1.06800
        ```
      </Step>

      <Step title="Create and go to the build directory">
        ```bash theme={null} theme={null}
        mkdir build; cd build
        ```
      </Step>

      <Step title="Run CMake to generate the Makefile">
        ```bash theme={null} theme={null}
        cmake \
           -DCMAKE_INSTALL_PREFIX=/usr \
           -DCMAKE_BUILD_TYPE=None \
           -DCMAKE_INSTALL_SYSCONFDIR=/etc \
           -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON \
           -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON \
           "-GUnix Makefiles" \
           -DCMAKE_VERBOSE_MAKEFILE=ON \
           -DCMAKE_INSTALL_LIBDIR=lib/aarch64-linux-gnu \
           -DGST_VERSION_REQUIRED=1.20.1 \
           -DSYSROOT_INCDIR=/usr/include \
           -DSYSROOT_LIBDIR=/usr/lib \
           -DGST_PLUGINS_QTI_OSS_INSTALL_BINDIR=/usr/bin \
           -DGST_PLUGINS_QTI_OSS_INSTALL_LIBDIR=/usr/lib/aarch64-linux-gnu \
           -DGST_PLUGINS_QTI_OSS_INSTALL_INCDIR=/usr/include \
           -DGST_PLUGINS_QTI_OSS_INSTALL_CONFIG=/etc/configs \
           -DGST_PLUGINS_QTI_OSS_LICENSE=BSD \
           -DGST_PLUGINS_QTI_OSS_VERSION=2.0.0 \
           -DGST_PLUGINS_QTI_OSS_PACKAGE=gstreamer1.0-plugins-qcom-oss \
           "-DGST_PLUGINS_QTI_OSS_SUMMARY=Qualcomm open-source GStreamer Plug-ins" \
           -DGST_PLUGINS_QTI_OSS_ORIGIN=http://www.qualcomm.com \
           -DGST_IMAGE_MAX_WIDTH=5184 \
           -DGST_IMAGE_MAX_HEIGHT=3880 \
           -DGST_VIDEO_MAX_WIDTH=5184 \
           -DGST_VIDEO_MAX_HEIGHT=3880 \
           -DGST_VIDEO_MAX_FPS=120/1 \
           -DCAMERA_METADATA_VERSION=1.0 \
           -DGST_VIDEO_TYPE_SUPPORT=TRUE \
           -DEIS_MODES_ENABLE=TRUE \
           -DVHDR_MODES_ENABLE=TRUE \
           -DFEATURE_OFFLINE_IFE_SUPPORT=TRUE \
           ..
        ```
      </Step>

      <Step title="Build and install sample-app-utils">
        ```bash theme={null} theme={null}
        make -C gst-sample-apps/gst-sample-apps-utils -j"$(nproc)"
        make -C gst-sample-apps/gst-sample-apps-utils install
        ```
      </Step>

      <Step title="Build and install plugins and sample-apps">
        ```bash theme={null} theme={null}
        make
        make install
        ```
      </Step>
    </Steps>

    <Note>
      After modifying any part of the source code, re-run step 11 to rebuild and reinstall your changes.
    </Note>

    ## Steps to build custom application

    Go through the steps in [Steps to Compile and Install](#steps-to-compile-and-install) section before starting this.

    <Steps>
      <Step title="Create a subdirectory in gst-sample-apps">
        ```bash theme={null} theme={null}
        cd gst-plugins-qti-oss-1.0.r1.06800/gst-sample-apps && mkdir gst-<your_sample_app>
        ```
      </Step>

      <Step title="Update CMakeLists.txt in gst-sample-apps">
        ```bash theme={null} theme={null}
        #Add your subdirectory to build.
        add_subdirectory(gst-<your_sample_app>)
        ```
      </Step>

      <Step title="Generate Makefile for the application">
        Goto [Steps to Compile and Install](#steps-to-compile-and-install) section and follow step 9: "Run CMake to generate the Makefile"
      </Step>

      <Step title="Build and install the application">
        ```bash theme={null} theme={null}
        make -C gst-sample-apps/gst-<your_sample_app> -j"$(nproc)"
        make -C gst-sample-apps/gst-<your_sample_app> install
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="On-host Compilation">
    <Note>
      On-host compilation for Ubuntu is not yet available in this documentation. Please refer to the on-device compilation instructions.
    </Note>
  </Tab>
</Tabs>
