Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Build Instructions for Windows

jenkinsmaidsafe edited this page Dec 2, 2014 · 10 revisions

Prerequisites

  • MSVC minimum MSVC 2013 Update 1 (including free Express edition) with no dependency on CTP releases.
  • git
  • CMake minimum version 2.8.12.2
  • Python minimum version 2.7 including corresponding psutil version.
  • OPTIONAL: For Windows, we use the commercial Callback File System (minimum version 5.0) from EldoS instead of FUSE. As this is a commercial product, its inclusion is optional, but without it MaidSafe Client cannot provide a Virtual Filesystem and its functionality is considerably reduced. EldoS provide an evaluation key which would temporarily allow the use of Callback File System. See Installing Callback File System v5 for installation details.

Get the Source Code

It is recommended to use SSH (GitHub account required) when cloning the MaidSafe repositories. GitHub provides instructions on how to generate SSH keys.

Navigate to where you wish to create your build. If you have git version < 1.8.5, the second command will have to be executed from within the "MaidSafe" source folder, omitting the -C MaidSafe part.

git clone git@github.com:maidsafe/MaidSafe
git -C MaidSafe submodule update --init
git -C MaidSafe checkout next && git -C MaidSafe pull
git -C MaidSafe submodule foreach 'git checkout next && git pull' 

Configure the Project

We use CMake to generate the makefiles/project solution files. There is a more detailed description of running CMake here, but the following may be enough to get you started.

We only allow out-of-source builds for our projects, which means you need to create a separate build directory from which to run CMake. You need to specify the generator as Visual Studio 12 (i.e. VS 2013), and you can choose to create either a 32-bit or 64-bit solution.

So, from inside of MaidSafe root:

cmake -H. -B../build_maidsafe -G"Visual Studio 12"

or for a 64-bit version of the project

cmake -H. -B../build_maidsafe -G"Visual Studio 12 Win64"

If -DDONT_USE_CBFS=TRUE the Callback File System, CBFS, include path and library will be excluded from the MaidSafe-Drive build. If CBFS is installed then CBFS_KEY should be set using either -DCBFS_KEY=<path to a text file whose only content is an Eldos licence key> or -DCBFS_KEY=<Eldos licence key>, if installed to a non-default location set -DCBFS_ROOT_DIR=<path to Callback File System root>. The cbfs_driver target can be used to install the CBFS driver, -h on the command line gives the available options, note that the -I option requires a unique product id associated with the installation and not the licence key passed to cmake during the build step.

On the first run of CMake, some optional components are checked and can generate output such as:

...
-- Performing Test HAVE_FLAG_SANITIZE_BLACKLIST
-- Performing Test HAVE_FLAG_SANITIZE_BLACKLIST - Failed
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS - Success
...

Such failures are safe to ignore. Any fatal failures should output obvious messages, and configuring will fail. If configuring succeeds, the final output from CMake should be:

...
-- Configuring done
-- Generating done
-- Build files have been written to: <path to build_maidsafe>

After the CMake command has finished, you should have a file 'build_maidsafe/CMakeCache.txt' containing (amongst other things) any variables passed on the command line. This is used on future runs of CMake, and CMake can now be targeted either at the source root (where CMakeLists.txt lives), or at the build folder where the CMakeCache.txt lives. So, from within the build folder, you can now rerun CMake by simply doing:

cmake .

Build the Targets

Your build folder should now contain a Visual Studio solution file.

Each submodule has an All<submodule name> target and an Exper<submodule name> target. The "All" target builds all libraries and executables (including test ones) defined in that submodule. The "Exper" target builds the "All" target, then runs all associated tests and submits the results to the public dashboard. For example, to run the Common experimental tests, just build "ExperCommon". You can do this from the command line if preferred:

msbuild /P:Configuration=Debug src\Common\ExperCommon.vcxproj

Running MSVC 2013 on a 32-bit machine

You may encounter a build error Fatal error c1002: compiler is out of heap space in pass 2. This is due to the fact that Visual Studio uses only 2GB of memory. To overcome this problem, you can increase the limit to 3GB by running the following from an Administrator VS command prompt. This will create a backup of your existing IDE and will trigger a reboot (to abort the reboot run shutdown /a). If running the Express edition, substitute devenv.exe with WDExpress.exe below:

bcdedit /Set IncreaseUserVa 3072
copy "%devenvdir%devenv.exe" "%devenvdir%devenv.exe.backup"
editbin /LARGEADDRESSAWARE "%devenvdir%devenv.exe"
shutdown /r

(Workaround found on this blog)