# Genie Sample Code Tutorial

Warning

Genie source code examples are subject to change without notice.

## Prerequisites

- Building *libGenie.so* has three external dependencies:
    - 1. clang compiler
2. ndk-build (for Android targets only)
3. RUST

If the clang compiler is not available in your system **PATH**, the script
**${QNN\_SDK\_ROOT}/bin/check-linux-dependency.sh** provided with the SDK
can be used to install and prepare your environment. Alternatively, you could install these
dependencies and make them available in your PATH.

Command to automatically install required dependencies:

sudo bash ${QNN_SDK_ROOT}/bin/check-linux-dependency.sh
    Copy to clipboard

For the second dependency to be satisfied, ndk-build needs to be set, which you can check with:

${QNN_SDK_ROOT}/bin/envcheck -n
    Copy to clipboard

*Note: libGenie.so has been verified to work with Android NDK version r26c and clang14.*

For the third dependency, RUST, run the following command in a terminal:

export RUSTUP_HOME=</path/for/rustup>
    mkdir -p ${RUSTUP_HOME}
    export CARGO_HOME=</path/for/cargo>
    mkdir -p ${CARGO_HOME}
    curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
    source ${CARGO_HOME}/env
    rustup target add aarch64-linux-android
    Copy to clipboard

To install RUST on Windows, please download & execute the installer from the official website of RUST. The first installation only installs the standard library for your host platform - that is, the architecture and operating system you are presently running.
To compile to other platforms you must install other target platforms.
For example, if you want to build for ARM64, run the following command in the developer command prompt for VS:

rustup target add aarch64-pc-windows-msvc
    Copy to clipboard

## Building the Genie library

**x86**

cd ${SDK_ROOT}/examples/Genie/Genie
    make x86
    Copy to clipboard

After executing make as shown above, you should be able to see libGenie.so in lib/x86\_64-linux-clang

**Android**

cd ${SDK_ROOT}/examples/Genie/Genie
    make android
    Copy to clipboard

After executing make as shown above, you should be able to see libGenie.so in lib/aarch64-android
You can now proceed to link this library to your app and call APIs exposed by libGenie.so

**Windows**

Open the **Developer Command Prompt for Visual Studio** and run the following commands:

cd ${SDK_ROOT}/examples/Genie/Genie
    
    # If you wish to build for Windows ARM64 platform...
    rustup target add aarch64-pc-windows-msvc
    
    mkdir build & cd build
    cmake ../ -A <x64, ARM64>
    cmake --build ./ --config Release
    Copy to clipboard

You should now be able to see *Genie.dll* in lib/Release

Last Published: Jun 04, 2026

[Previous Topic
Source Code Examples](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/source_code_examples.md) [Next Topic
genie-t2t-run](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/source_code_examples_genie-t2t-run.md)