Setting up the tools

The following section outlines how to install and configure the tools you need to port your Qt app to BlackBerry 10.

Get your signing token and debug tokens

The first step you need to take is to get your signing token and debug tokens.

Download and install the BlackBerry 10 Native SDK

Next, you need to download and install the BlackBerry 10 Native SDK.

Download and install the BlackBerry 10 Device Simulator

If you do not have a BlackBerry 10 device, you can use the BlackBerry 10 Device Simulator to run your applications.

Download and install Qt Creator

If you're porting a Qt application, you probably already have Qt Creator installed. If you don't, you can download a binary installer from qt-project.org, or clone and build Qt Creator from qt.gitorious.org.

After you install Qt Creator, you can configure the toolchain, which allows you to begin porting your application.

Configure the Qt Creator toolchain

The following section covers configuration of the Qt Creator toolchain.

Set your environment variables and run Qt Creator

The first step in configuring the toolchain is setting your environment variables and running Qt Creator.

In Windows:

  1. Open the Start Menu and enter cmd.exe in the search box.
  2. Right-click the cmd.exe file and click Run as administrator.
  3. At the command prompt, navigate to where you installed the BlackBerry 10 Native SDK.
  4. Run the bbndk-env.bat file.

    You must run Qt Creator in the same command prompt. Do not close the command prompt after you run bbndk-env.bat.

  5. Navigate to where you installed Qt Creator.
  6. Run the qtcreator.exe file.

Screen showing the Qt Creator command prompt.

When Qt Creator is open, you are free to begin the configuration outlined below.

In Linux and Mac OS:

  1. Source the bbndk-env.sh script:
    $ source <path_to_ndk>/bbndk-env.sh
  2. Run Qt Creator in the same command prompt.

Configuring Qt Creator

After you set the environment variables and open Qt Creator, you need to configure the compiler for Qt Creator. To do this:

  1. In Qt Creator, click Tools > Options.
  2. In the left pane, click Build & Run.
  3. In the right pane, click the Compilers tab.
  4. Click Add and select GCC.
  5. In the Compiler path field, enter your compiler path. The default path to the compiler is <path_to_ndk>/host<version>/<platform>/<version>/usr/bin/qcc.<extension>.
  6. Set the Application Binary Interface (ABI) for your OS by using the drop-down lists. The default ABI for Windows is custom-arm-generic-elf-32bit.

    If you are unsure which compiler configuration you need, continue configuring the toolchain. You will have the option to view supported compiler configurations when you configure your kit.

  7. Click Apply.

Your compiler configuration should look similar to this:


Screen showing the Qt Creator compiler configuration.

The next step is to specify the version of Qt in Qt Creator. The BlackBerry 10 Native SDK comes packaged with Qt 4.8.x, so that's what you need to indicate. To do this:

  1. In Qt Creator, click Tools > Options.
  2. In the left pane, click BlackBerry.
  3. In the BlackBerry NDK Path field, type the name of the folder where you installed the BlackBerry 10 Native SDK (for example, C:\bbndk).

    If you receive any errors indicating that you don't have certain required tools, just click OK and continue with these steps. You'll configure the required tools later in this process.

  4. Click Apply.
  5. In the left pane, click Build & Run.
  6. In the right pane, click the Qt Versions tab.
  7. Click Add.
  8. Navigate to <path_to_ndk>/host<version>/<platform>/<version>/usr/bin/.

    For example, if you installed the 32-bit Windows version of the BlackBerry 10 Native SDK in the default C:\bbndk directory, your path is C:\bbndk\host<version>\win32\x86\usr\bin.

  9. Select qmake.exe and click Open.
  10. In the BlackBerry Native SDK field, ensure the path to your installation directory is correct.

At this point, you should have something similar to this:


Screen showing how to configure the Qt version in Qt Creator.

If you receive an error message stating Qt version is not properly installed, please run make install, go back and set your environment variables again and try specifying the Qt version again.

Next, you need to configure a device or simulator. To do this:

  1. Connect your device or simulator and enable development mode.
  2. In Qt Creator, click Tools > Options.
  3. In the left pane click Devices.
  4. In the right pane, click Add, select BlackBerry Device, and click Start Wizard.
  5. Name your device and enter its IP address.
    • If you are using a BlackBerry 10 device, you can find the IP address in Settings > Security and Privacy > Development Mode.

    • If you are using the BlackBerry 10 Device Simulator, you can find the IP address in the bottom left corner of the simulator window.

  6. Enter your device password and select the device type.
  7. If you are using a BlackBerry 10 device, click Browse and navigate to where you saved your debug token.
  8. Click Next.
  9. Browse to an existing SSH key, or generate one.
  10. Click Next.
  11. Click Finish.

Your screen should look similar to this once you're finished:


Screen showing how to configure your device in Qt Creator.

Finally, you need to configure a kit. To do this:

  1. In Qt Creator, click Tools > Options.
  2. In right pane, click the Kits tab.
  3. Click Add.
  4. Name your kit, and select your Device type and Device.
  5. In the Sysroot field, enter or browse to your armle-v7 directory. The default location is <path_to_ndk>\target_<version>\qnx6\armle-v7.
  6. In the Compiler drop-down list, select the compiler you configured.
  7. Next to the Debugger field, click the Manage button then click Edit.
  8. To set the binary, navigate to <path_to_ndk>\host_<version>\<platform>\<version>\user\bin.
  9. Select ntoarm-gdb.exe and click Open.
  10. Click OK.
  11. In the Qt version drop-down list, specify the version of Qt you want to use.
  12. In the Qt mkspec field, enter your default mkspecs directory.

    The default directory is <path_to_ndk>\target_<version>\qnx6\usr\share\qt4\mkspecs\default.

  13. Click Apply.

Your kit configuration should look similar to this:


Screen showing how to configure a kit in Qt Creator.

If you didn't know which compiler configuration you needed for your compiler path, Qt Creator will show you the supported configuration for your Qt version if you hover your mouse over the Qt Creator caution icon icon beside the name of your kit.


Screen showing the correct compiler configuration in Qt Creator.

Now that you're finished configuring the toolchain, you can begin using Qt Creator to port (or create) Qt applications for BlackBerry 10.

Last modified: 2013-12-21

comments powered by Disqus