Installation

Installing on Linux

Prerequisites

ScaleOut’s C++ Native Client API libraries were built and tested on Linux using the following compilers and libraries:

  • GCC 4.4.7 (with gcc-c++ package for C++ compilation)
  • cmake 2.6.4
  • Boost 1.41 (with boost-devel package for boost headers)
  • (Recommended) Protobuf 2.5.0

To take full advantage of ScaleOut’s C++ Native Client API libraries, we recommend installing Google’s Protocol Buffer library.

Compiling Google Protocol Buffers

If your distribution does not provide a pre-packaged binary installer, and since the Protocol Buffers ("protobuf") project does not provide pre-packaged binaries, you must download and compile the protobuf libraries on your local system. The official protobuf project homepage is located on Google Code, and the instructions for compiling from source can be found within the project package. Be certain to install the compiled package by running make install.

The following instructions are provided as a courtesy, but if any of the below steps fail, consult protobuf’s official documentation for more information:

  1. Download the source package from Google Code
  2. Extract the source package: tar -xf protobuf-*
  3. Change directory to the extracted source folder: cd protobuf-*
  4. Run the configuration script: ./configure
  5. Make the package: make
  6. Install the compiled libraries and applications: sudo make install
Compiling ScaleOut’s C++ Native Client API from Source
  1. Create a new user-writeable directory for an out-of-source build: mkdir ~/soss_native_api
  2. Change to the new directory: cd ~/soss_native_api
  3. Run CMake to configure the C++ Native Client API project: cmake /usr/local/soss/cpp_api (-DBUILD_SHARED_LIBS:BOOL=ON)
  4. Build the project: make
  5. (Optional) Run tests: ./tests/tests
  6. (Optional) Install the compiled library to the system library directory: sudo make install
  7. (Optional) Repeat steps 3-6 to build and install the SOSS client shared library
[Note] Note

When running the tests executable, the ScaleOut StateServer service must be running, configured, and in an active state. Depending on the features enabled by your license key, some tests may fail with an unlicensed exception.

Configuring your Project with CMake

The Native Client library source folder includes a CMake find module (compatible with CMake 2.6 and above) for the Native Client library ("SossClient"). To add the SossClient library to your CMake project:

set(CMAKE_MODULE_PATH "/usr/local/soss/cpp_api/CMakeModules")
find_package(SossClient REQUIRED)
include_directories(${SOSS_CLIENT_INCLUDE_DIRS})
target_link_libraries(MySossClientApp ${SOSS_CLIENT_LIBRARIES})

The Native Client library source folder also contains a sample program using the CMake build system. It includes a CMakeLists.txt file with the above configuration which may be used as a starting template for your project.

Configuring your Project Manually

In some cases, it may not be desirable to use CMake, such as with an existing project with a build and configuration system already in place. In these environments, you must explicitly add the required libraries to your linker command, including the external libraries upon which the Native Client libraries are dependent. For example, to compile the same CMake project via the command line with g++:

g++ -I../include -I/usr/local/soss/c_api -I/usr/local/soss/cpp_api/include -I/usr/include/boost/ -DUNIX -std=c++0x -lsoss_svccli -lsoss_client -lboost_thread-mt -lboost_date_time -lboost_system sample.cpp

Argument Type Purpose

-I../include

Include folder

Include directory for sample program

-I/usr/local/soss/cpp_api/include

Include folder

SOSS include files for C++ Native Client API

-I/usr/local/soss/c_api

Include folder

SOSS include files for C API ("SOSS service client"; required by soss_client)

-I/usr/include/boost/

Include folder

Boost include directory (required by soss_client)

-DUNIX

Pre-processor definition

Required by SOSS header files for OS-level functions

-std=c++0x

g++ option

Sets the language standard to C++0x

-lsoss_client

Linker option

Link against the C++ Native Client API

-lsoss_svccli

Linker option

Link against the C API ("SOSS service client"; required by soss_client)

-lboost_thread-mt

Linker option

Link against the Boost thread library (required by soss_client)

-lboost_date_time

Linker option

Link against the Boost date/time library (required by soss_client)

-lboost_system

Linker option

Link against the Boost system library (required by soss_client)

sample.cpp

Source file

C++ source file containing target code