Developers: RIM has Published JsonCpp for BlackBerry 10 Platform on GitHub

RIM is continuing to make progress with and for the Blackberry 10, you can see from the approach that when this platform is finallized it will be ready to take on many challenges as well as critics and other platforms. JsonCpp project development platform on the BlackBerry will use compatible code for Blackberry 10, RIM has published JsonCpp for BlackBerry 10 Platform Code on GitHub to developers by making things more useful and easier by making it open source and using the new BB10 framework.

JsonCpp for BlackBerry 10 Platform


This project is a port of the open source JsonCpp project to the BlackBerry 10 platform. JsonCpp, as is, does not support building for the BlackBerry 10 platform. The port consists of the following:

  • minor changes to the source code of JsonCpp, to make the code compatible with the BlackBerry 10 platform NDK (Native Development Kit), henceforth referred to as BBNDK
  • additional build-related files, to allow building under the BBNDK

Project structure

The project contains the following top-level directories:


the source distribution of the JsonCpp project, but with changes to some 

source files


a source directory structure in the style of BBNDK Makefile-based 


jsoncpp-src-0.5.0, the source distribution of JsonCpp, has only very minor, non-functional changes, so that the code would be able to compile under the BBNDK. The directory structure is not changed, and the distribution can be built and tested as usual under Linux (verified; other platforms, e.g., Microsoft Visual Studio, are not yet verified). The distribution has, however, a limited set of platforms on which it can be built. That set includes Linux, Windows, and some other unixes, but does not include the BlackBerry 10 platform.

The documentation for JsonCpp suggests that it would be easy to add another platform to the build. The BlackBerry 10 platform is, however, more complicated in the following ways:

  • BlackBerry 10 platform supports multiple OS/CPU combinations, currently QNX6/ARM and QNX6/X86
  • Builds involve cross-compilation. The build runs on a host platform, such as Linux, Mac, or Windows, and targets usually two or more OS/CPU target platforms, such as QNX6/ARM and QNX6/x86.
  • Compilation and linking are fine-tuned to suit the particular needs of a mobile platform.
  • A high level of consistency of builds is desired across all libraries and applications that run on the BlackBerry 10 platform.

qnx-product-root, the BBNDK-style source directory, supports building of JsonCpp for the BlackBerry 10 platform. There are two aspects to this directory:

  • The structure of directories and the build-controlling files in those directories follow exactly the pattern for a BBNDK Makefile-based build. This type of build is the general QNX style for projects with recursive Makefiles.
  • All source code files are symbolic links to actual files in the jsoncpp-src-0.5.0, i.e., in the source distribution of JsonCpp.

qnx-product-root, in QNX terminology, is a product directory. A product directory contains multiple projects, which can be built separately. A project is generally the smallest unit of source code that can be built separately. qnx-product-root contains the following project directories:


builds an executable to process files containing JSON data for testing 

purposes; has build dependency on lib_json


builds the JsonCpp shared library, the fundamental product of JsonCpp 


builds an executable for unit testing of lib_json; has build dependency 

on lib_json

How to work in the BBNDK IDE

The BBNDK has an IDE, which is based on QNX Momentics, which is based on Eclipse:

  • Install, as necessary, BBNDK on a suitable platform, e.g., Linux, Mac, or Windows.
  • Start the IDE with the provided shell script in the root of the BBNDK installation ( or bbndk.bat) or an icon if available.
  • On the menu, do File -> Import -> General -> Existing Projects into workspace. Select the directory qnx-product-root/lib_json. This project has a .project file already, i.e., is an Eclipse project. Alternatively, do File -> Import -> BlackBerry Tablet OS -> Existing Code as BlackBerry Tablet OS C/C++ Makefile Project. This will create an Eclipse project from a QNX recursive Makefile project.

Source code can be browsed, and the project can be built, all in the IDE.

How to build from the command line

A command-line build can be done interactively or by a server process:

  • Install, as necessary, BBNDK on a suitable platform, e.g., Linux, Mac, or Windows.
  • Open an interactive shell window, e.g., bash on Linux or cmd on Windows.
  • Source the or bbndk-env.bat script/batch file. In Linux type . bbndk-env.bat; on Windows type bbndk-env.bat
  • Change to the qnx-product-root directory and type make. This should run the make executable that is provided in the BBNDK installation.
  • To clean up, type make clean

Build notes

The expected result of a build is shown in this directory tree representation. That shows the symbolic linking to source files in the JsonCpp source distribution. It shows also the various build artifacts, including executables, .a, and .so files for the various CPUs and variants. Artifacts with _g in the name are specifically for use in debugging.

Representative command-line output is here.

Please note that the base name of the shared object is jsoncpp. The base name and also the soname version are specified in the qnx-product- root/lib_json/ file, as:

 ID=jsoncpp SO_VERSION=0 #change as necessary 

This is discussed in the QNX document on projects with recursive Makefiles. See also this reference on the distinction between soname, linker name, and real name in regard to shared libraries. The soname version should be incremented or changed when there is a non-backwardly compatible change to the shared library.

The JsonCpp library is currently at a beta version of 0.5.0. If a non- backwardly compatible change were to occur while still at a major revision number of 0, then the soname version could be changed from 0 to 0a, or something similar, so as to keep it in step with the numerical major revision number of 0.

Installation notes

An executable that is linked at build time against the file will have a run time link dependency on, where n is the soname version. That is, the dependence will be on the soname, not the real file name. The soname version is recorded inside the file and is used during build time linking. Build time linking does not use the real file name. You can use the Linux or QNX ldd utility, as applicable, on the dependent library or executable, in order to see the list of soname dependencies.

When packaging the shared object file in a BlackBerry ARchive (BAR) file, the name of the packaged shared object file may need to be changed to its soname, e.g., from to This is so that dependent libraries and executables will be able to link at run time.

Usage notes

Be aware that JsonCpp throws C++ exceptions. Some documentation exists on theproject documentation page.

  • where is the source to this project? The github repository is no longer there, all links are broken.. I am desparately seeking this API!!