Skip to content

build stembuild

Michael Tang edited this page Feb 5, 2018 · 32 revisions

Build Instructions

Note: you can only build on your host OS. You cannot cross compile.

Stembuild applies a binary diff to a source vhd and creates a stemcell. The binary diff creation is dependent upon rdiff (located in librsync). rdiff is dependent upon (POP3) which is not supported in windows. In order to get around this, a shim has been written in go that is not dependent upon POP3.

Requirements

For all platforms

Additional requirements for Windows

  • cmake https://cmake.org/
  • MinGW https://sourceforge.net/projects/mingw-w64/
    1. From within the VM, download the installer executable
    2. Select x86_64 as the Architecture
    3. Do not use the default root directory (Program Files); use something without spaces (this will save you a lifetime of pain if you decide to compile something that uses Makefiles) for example C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1
    4. Add gcc and friends to the path (for the above install location you would add C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin to the system path) before the strawberry gcc path
  • git https://git-scm.com/download/win
    1. USE THE DEFAULTS (WITH ONE EXCEPTION)
      • install to C:\Git or any other path without spaces
  • Strawberry Perl http://strawberryperl.com/
    1. Verify the additions to the system path for strawberry perl are after the MinGW bin

CMake

CMake is used to create the necessary header files so that compilation can succeed. You should only have to generate these files once since we only care about the rdiff files.

To generate the correct files:

  1. open CMake
  2. set source folder to librsync
  3. set destination folder to librsync/build
  4. set CMAKE_INSTALL_PREFIX=librsync/install
  5. set CMAKE_BUILD_TYPE=release
  6. click configure
  7. select MinGW Makefiles as the generator for the project (for Windows)
  8. click generate (this generates the .h files)
  9. after generating the Makefile you can CD into the build directory and run mingw32-make and mingw32-make test to make sure things are working (also, the tests will not pass - so don't sweat it)
  10. copy all source and header files from librsync/src into stembuild/rdiff/
  11. copy all source and header files from librsync/build/src into stembuild/rdiff/
  12. remove rdiff/rdiff.c (this is because we have rewritten this in go rdiff.go)
  13. go install puts the stembuild executable into $GOPATH/bin

Other environments are similar.

Using the CMake CLI

You can also generate the headers using cmake from the command line. The following command will generate *.h files under src in your current directory:

cmake -D CMAKE_INSTALL_PREFIX=librsync/install -D CMAKE_BUILD_TYPE=release -G "MinGW Makefiles" <path-to-librsync>