Skip to content
vogel76 edited this page Jul 14, 2014 · 5 revisions

Table of Contents

Windows ======= #### Prerequisites #### * Microsoft Visual C++ 2013 Update 1

Set up the directory structure####

  • Create a base directory for all projects. I'm putting everything in E:\Invictus, you can use whatever you like. In several of the batch files and makefiles, this directory will be referred to as INVICTUS_ROOT:

mkdir E:\Invictus


* Dowload CMake
  
  Download the latest *Win32 Zip* build CMake from http://cmake.org/cmake/resources/software.html (version 2.8.12.2 as of this writing).  Unzip it to your base directory, which will create a directory that looks something like `E:\Invictus\cmake-2.8.12.2-win32-x86`.  Rename this directory to `E:\Invictus\CMake`.

  If you already have CMake installed elsewhere on your system you can use it, but Keyhotee has a few batch files that expect it to be in the base directory's `CMake` subdirectory, so those scripts would need tweaking.

* Download library dependencies:
 * ICU and QT
   
   Keyhotee depends on ICU4C version 53.1, boost 1.55, BerkeleyDB 12c Release 1 (12.1.6.0.20), OpenSSL 1.0.1g and Qt 5.2.1  You can build these from source or download our pre-built binaries to speed things up.  To download the pre-built versions:
   * download http://get.syncad.com/invictus/InvictusRoot-vs2013.7z
   * download http://get.syncad.com/invictus/OpenSSL-vs2013.7z
   * unpack it to the base directory `E:\Invictus`

   If you prefer to build your own version of ICU, there is the script [https://github.com/InvictusInnovations/keyhotee/blob/master/build_icu.bat build_icu.bat] containing all commands to build it from scratch.  Likewise for QT, there is a script [https://github.com/InvictusInnovations/keyhotee/blob/master/build_qt.bat build_qt.bat] to build it.  For both libraries, we build static versions to cut down on the number of DLLs we need to ship.

 * Boost
 
   Keyhotee depends on the Boost libraries version 1.53 or later (I assume you're using 1.55, the latest as of this writing).  You must build them from source.
   * download the latest boost source from http://www.boost.org/users/download/
   * unzip it to the base directory `E:\Invictus`. 
   * This will create a directory like `E:\Invictus\boost_1_55_0`. Rename this directory to `E:\Invictus\boost_1.55`
 * OpenSSL

At the end of this, your base directory should look like this:

E:\Invictus +- BerkeleyDB +- boost_1.55 +- CMake +- ICU +- openssl +- QT

* Clone the Keyhotee repository

cd E:\Invictus git clone https://github.com/InvictusInnovations/keyhotee.git

  • Spawn 'jenkins_build.bat' script to automatically clone other repositories keyhotee depends on, and build them: keyhotee\HelperScripts\jenkins_build.bat

After that you should have checked out:
+-keyhotee
+--Bitshares
+-bitshare_toolkit
+--libraries\fc
+--vendor\leveldb-win

Also jenkins build script should produce:
+-bin directory containing built binaries for keyhotee and bitshare toolkit projects
+-build directory containing generated build files (incl. keyhotee.sln to be opened in VS IDE and start development)
#### Build the library dependencies ####

* Set up environment for building:

cd E:\Invictus\keyhotee setenv.bat


* Build boost libraries:

cd E:\Invictus\boost bootstrap.bat b2.exe link=shared

  The file `E:\Invictus\keyhotee\BitShares\fc\CMakeLists.txt` has the `FIND_PACKAGE(Boost ...)`
  command that makes CMake link in Boost.  That file contains the line:

SET(Boost_USE_DEBUG_PYTHON ON)

  Edit this file and comment this line out (with a `#`).
  This line  tells CMake to look for a boost library that was built with `b2.exe link=shared python-debugging=on`.  That would cause debug builds to have `-gyd` mangled into their filename.  We don't need python debugging here, so we didn't give the `python-debugging` argument to `b2.exe`, and
that causes our boost debug libraries to have `-gd` mangled into the filename instead.  If this option in `fc\CMakeLists.txt` doesn't match the way you compiled boost, CMake won't be able to find the
debug version of the boost libraries, and you'll get some strange errors when you try to run the
debug version of Keyhotee.

* Build OpenSSL DLLs

cd E:\Invictus\openssl-1.0.1G perl Configure --openssldir=E:\Invictus\OpenSSL VC-WIN32 ms\do_ms.bat nmake -f ms\ntdll.mak nmake -f ms\ntdll.mak install

  This will create the directory `E:\Invictus\OpenSSL` with the libraries, DLLs, and header files.

#### Build project files for Keyhotee ####

* Run CMake:

cd E:\Invcitus\build run_cmake_gui.bat

 This pops up the cmake gui, but if you've used CMake before it will probably be showing 
 the wrong data, so fix that:
 * Where is the source code: `E:\Invictus\keyhotee`
 * Where to build the binaries: `E:\Invictus\vs12`
 
 Then hit **Configure**.  It may ask you to specify a generator for this project; if it does, choose **Visual Studio 12** and select **Use default native compilers**. It could be needed to press Configure twice, to eliminate all 'red' entries in CMake GUI. Otherwise generator can ignore some data entered in the GUI. Look through the output and fix any errors.  Then hit **Generate**.

#### Build Keyhotee ####
* Launch *Visual Studio* and load `E:\Invictus\vs12\keyhotee.sln`
* set *Keyhotee* as the startup project
* *Build Solution*

 This will build Keyhotee.exe (KeyhoteeD.exe for debug) to `E:\Invictus\bin`

#### Copy DLLs ####
All dependend dlls should be automatically copied into `E:\Invictus\bin`.
## Linux ## #### Used tools #### * As build entry is used CMake. * Then as compiler gcc 4.8.1 and make as build manager (generally this could be changed to tools choosen while configuring CMake generation but toolset described above is tested).

Dependencies

  • ICU - currently it depends on ICU preinstalled in OS. Also KH is linked dynamically to it. Generally this is a subject to change to avoid Keyhotee executable runtime dependency on ICU libraries.
  • QT 5.2 built statically. There is https://github.com/InvictusInnovations/keyhotee/blob/master/build_qt.sh script containing all commands to build QT. Generally it should work fine to built whole QT from scratch.
    Its prebuilt form also can be downloaded from: http://get.syncad.com/invictus/QT-static-5.2.tgz
  • OpenSSL - currently it depends on OpenSSL preinstalled in OS. Also KH is linked dynamically to it. Generally this is a subject to change to avoid Keyhotee executable runtime dependency on these libraries.
  • Boost libraries - currently it depends on OpenSSL preinstalled in OS. Built statically.
  • Additional dependencies caused by QT deps: libgtk2-dev, libfreetype-dev
  • Additional linux specific dependencies: libreadline-dev
## CMake Notes ## We are using a cmake feature that allows specifing include directories and compiler settings for a TARGET, not globally as it was done previously. The advantage is that now cmake automatically propagates all include directories needed from module INTERFACE point of view, so there is no need to copy/paste such settings in all clients modules using a library (e.g. fc or bitshare).

Such settings are properly configured using the following cmake constructs: target_link_libraries, target_include_directories, target_compile_options and target_compile_definitions. Each setting can be categorized to be PUBLIC, PRIVATE OR INTERFACE like.

The same rules apply to linker options and link dependencies. So, for example, when link Keyhotee which depends on bitshare, there is no need to put into Keyhotee dependencies list all the dependencies of bitshare.

So when working on bitshare and fc CMakeLists.txt files (in keyhotee CMakeLists.txt we didn’t set target_ specific setting yet), please avoid using globals cmake statements like include_directories and add_definition functions since they have a global scope. Instead, their target_ equivalents should be supplemented by the needed change.

## Jenkins Builds ## * Keyhotee has a jenkins build server at: http://jenkins.bitshares.org/ * Builds from this server are available at: ftp://178.63.85.22/