Skip to content

Installation

mcfatealan edited this page Oct 13, 2015 · 46 revisions

rDSN has been built on the following platforms, and here are the quick summaries.

Ubuntu 14.04 LTS x86_64 with gcc 4.8.2
~$ sudo apt-get install build-essential
~$ sudo apt-get install git
~$ sudo apt-get install cmake
~$ sudo apt-get install php5-cli
~$ sudo apt-get install libboost-all-dev
~$ sudo apt-get install libaio-dev
~/projects$ git clone https://github.com/Microsoft/rdsn.git
~/projects/rdsn$ mkdir mybuilddir
~/projects/rdsn$ cd mybuilddir
~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn
~/projects/rdsn/mybuilddir$ make
~/projects/rdsn/mybuilddir$ sudo make install
Mac OS X Yosemite with Apple LLVM version 6.1.0

install Xcode

install HomeBrew, which will be installed to '/usr/local' by default.

~$ brew install --env=std cmake
~$ brew install --env=std php
~$ brew install --env=std boost
~/projects$ git clone https://github.com/Microsoft/rdsn.git
~/projects/rdsn$ mkdir mybuilddir
~/projects/rdsn$ cd mybuilddir
~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn -DBOOST_INCLUDEDIR=/usr/local/include
~/projects/rdsn/mybuilddir$ make
~/projects/rdsn/mybuilddir$ sudo make install
FreeBSD 10.2 x86_64 with clang 3.4.1
~$ sudo pkg install git
~$ sudo pkg install cmake
~$ sudo pkg install php5
~$ sudo pkg install boost-libs
~/projects$ git clone https://github.com/Microsoft/rdsn.git
~/projects/rdsn$ mkdir mybuilddir
~/projects/rdsn$ cd mybuilddir
~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn -DBOOST_INCLUDEDIR=/usr/local/include
~/projects/rdsn/mybuilddir$ make
~/projects/rdsn/mybuilddir$ sudo make install
Windows 8.1/Server 2012 R2 with Visual Studio 2013.

install Visual Studio 2013

install GitHub Windows

install cmake

install php

install boost library

c:\projects> git clone https://github.com/Microsoft/rDSN.git
c:\Projects\rDSN> "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
c:\Projects\rDSN> mkdir mybuilddir
c:\Projects\rDSN> cd mybuilddir
c:\Projects\rDSN\mybuilddir> cmake .. -DCMAKE_INSTALL_PREFIX=c:\rdsn -DBOOST_INCLUDEDIR="c:\boost_1_57_0" -DBOOST_LIBRARYDIR="c:\boost_1_57_0\lib64-msvc-12.0" -G "NMake Makefiles"
c:\Projects\rDSN\mybuilddir> nmake
c:\Projects\rDSN\mybuilddir> nmake install

Though not well tested, we assume rDSN can run on most platforms across Linux, Mac and Windows.


Prerequisites

Development Environment

  1. Ubuntu

     ~$ sudo apt-get install build-essential
    
  2. Mac OS X. Please install the latest Xcode from Mac App Store. We also recommend Homebrew for handily handling dependent packages. Homebrew as well as those packages will be installed to '/usr/local' by default.

  3. FreeBSD. Clang 3.4.1 is installed by default on FreeBSD 10.1 x86_64. You need to install git by:

     ~$ sudo pkg install git
    
  4. Windows. Both Visual Studio 2012 and 2013 are supported, and a free version of Visual Studio Community 2013 could be found here

CMake

CMake is a cross-platform build-generator tool. CMake does not build the project directly, yet it generates the files needed by the build tools such as GNU make, Visual Studio, nmake and etc. for building rDSN. Version 2.8.8 is the minimum required, however we recommend using the latest version.

  1. Ubuntu

     ~$ sudo apt-get install cmake
    
  2. Mac OS X. Download the executable package from here, or use homebrew:

     ~$ brew install --env=std cmake
    
  3. FreeBSD

     ~$ sudo pkg install cmake
    
  4. Windows. Download the executable package from here, and make sure that cmake could be reachable through the PATH environment variable.

PHP

PHP is a server-side scripting language designed for web development, and here we use it for code generation purpose.

  1. Ubuntu

     ~$ sudo apt-get install php5-cli
    
  2. Mac OS X

     ~$ brew install --env=std php
    
  3. FreeBSD

     ~$ sudo pkg install php5
    
  4. Windows. Download the executable package from here, and make sure that php could be reachable through the PATH environment variable.

Boost C++ Library

  1. Ubuntu

     ~$ sudo apt-get install libboost-all-dev
    
  2. Mac OS X. Homebrew is recommended:

     ~$ brew install --env=std boost
    
  3. Ubuntu

     ~$ sudo pkg install boost-all
    
  4. Windows. The prebuilt 1.57.0 windows binaries is recommended instead of manual build. E.g. if the user would like to build 64 bit rDSN using Visual Studio 2013, the file boost_1_57_0-msvc-12.0-64.exe in that prebuilt directory is needed. Suppose the boost library is installed in 'c:\boost_1_57_0'.

General installation information can be found here.

Enhanced Apache Thrift and Google Protoc

Please get the enhanced Apache Thrift and Google Protoc, and put them in the 'bin' subdirectory under the rDSN source tree.

Build rDSN

We use here the command-line, non-interactive CMake interface. Suppose later you will install rDSN to '/opt/rdsn' on UNIX, or 'c:\rdsn' on Windows.

  1. Open a shell. Your development tools must be reachable from this shell through the PATH environment variable:

    a. Windows using Visual Studio 2013. Open a CMD console and execute:

     "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
    
  2. Create a directory for containing the build. It is not supported to build rDSN directly in the source directory. Go to this directory:

     ~/projects/rdsn$ mkdir mybuilddir
     ~/projects/rdsn$ cd mybuilddir
    
  3. Generate build files by CMake:

    a. Ubuntu

     ~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn
    

    b. Mac OS X

     ~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn -DBOOST_INCLUDEDIR=/usr/local/include
    

    c. FreeBSD

     ~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rdsn -DBOOST_INCLUDEDIR=/usr/local/include
    

    d. Windows using Visual Studio 2013

     ~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=c:\rdsn -DBOOST_INCLUDEDIR="c:\boost_1_57_0" -DBOOST_LIBRARYDIR="c:\boost_1_57_0\lib64-msvc-12.0" -G "Visual Studio 12 2013 Win64"
    

    e. Windows using nmake

     ~/projects/rdsn/mybuilddir$ cmake .. -DCMAKE_INSTALL_PREFIX=c:\rdsn -DBOOST_INCLUDEDIR="c:\boost_1_57_0" -DBOOST_LIBRARYDIR="c:\boost_1_57_0\lib64-msvc-12.0" -G "NMake Makefiles"
    

    CMake will detect your development environment, perform a series of test and generate the files required for building rDSN. CMake will use default values for all build parameters. See the CMake documentation for fine-tuning your build. E.g. if we need a "Debug" version, just append the parameter "-DCMAKE_BUILD_TYPE=Debug". When under windows, we may encounter the error of "cannot find the following boost libraries", and this is usually caused by one of following reasons: (1) invalid local cache, please clean up the build directory, and retry; or (2). incompatible boost library version versus local compiler settings, e.g., 32 bits vs 64 bits, or VS2013 (12.0) boost libraries while local visual studio is 2012. Please fix and retry.

  4. After CMake has finished running, proceed to use IDE project files or start the build from the build directory:

    a. UNIX

     ~/projects/rdsn/mybuilddir$ make
    

    b. Windows using nmake

     ~/projects/rdsn/mybuilddir$ nmake 
    
  5. Install rDSN:

    a. UNIX

     ~/projects/rdsn/mybuilddir$ sudo make install
    

    b. Windows using nmake

     ~/projects/rdsn/mybuilddir$ nmake install
    

    Take Ubuntu as an example, the rDSN libraries will be installed in /opt/rdsn/lib and all header files in /opt/rdsn/include:

    • libdsn.core.a - this is where the Service API and Tool API are defined and connected.
    • libdsn.dev.a - higher level programming syntactic sugar
    • libdsn.tools.common.a - default local runtime providers, including network, aio, lock, etc., and a set of common tools like tracer/profiler/fault-injector.
    • libdsn.tools.simulator.a - the simulation tool
    • libdsn.failure_detecotor - the perfect failure detector library
    • libdsn.replication.clientlib - replication client library
    • libdsn.replication - replication server library
    • libdsn.replication.meta_server - replication meta server library

If everything is as expected, congratulations, and you are ready to try our tutorial to develop your first service with rDSN.