FoundationDB

Building on Windows


(Christophe Chevalier) #1

I was not able to find a place that specifically address the build process on Windows, so here are my quick notes.

These are from the perspective of a non-C++ developper, so some of these may seem obvious for seasoned C++ devs :slight_smile:

I’m using Visual Studio 2017 (15.7) on Win10.

  1. Need to install Boost
  • download the 1.52.0 .7z or .zip archive from https://sourceforge.net/projects/boost/files/boost/1.52.0/
  • unzip it and copy it in C:\Program Files\boost_1_52_0\. Please note that the Boost documentation says to copy them to C:\Program Files\boost\boost_1_52_0\ but the .vcxproj in fdb ommit the “\boost” middle folder !
  • if you still get errors about boost includes, double check the path is correct! Also you need Boost v1.52, not 1.55 or later !
  1. Need to install Python 2.7
  • Download the Windows x86-64 MSI installed for Python 2.7.x for Windows
  • It must be installed to the default location of C:\Python27\
  1. Need to install WiX ToolSet for the MSIInstaller project
  • if you don’t care about building the MSI installer, just unload the project from the solution explorer.
  • if VS does not want to open the project, you may need to reinstall WiX
  • download latest from http://wixtoolset.org/releases/
  • you may also need to install the “Wix Toolset Visual Studio 2017 Extension” (or 2015) if you get warning about project type not supported.
  1. Need to install Java JDK 8
  • If you don’t care about building the java binding, just unload the project from the solution explorer.
  • note: You may need to sell your soul to Oracle to accept the agreement, which I was not willing to do.
  1. For syntax highlighting:
  • To have syntax highlighting of the flow keywords, you need to copy the usertype.dat file located in flow/actorcompiler/ in your Visual Studio installation dir, following the instructions at https://msdn.microsoft.com/en-us/library/zy61y8b8.aspx
  • ReSharper C++ does not understand the flow/actor syntax by default (as of version 2018.1) so you may need to disable Resharper when working on the code.

First build (in Debug) can be slow (several minutes on a fast machine). Next builds should be faster.
Build output is in the bin\Debug or bin\Release folder.

Quick sanity check: start the fdbcli.exe in the build output folder. If you get "WARNING: One or more of the processes in the cluster is incompatible with this version of fdbcli." this is still a success, it just means that it is connected to your existing installed cluster which is probably a lower version.


(Christophe Chevalier) #2

Both Visual Studio and ReSharper are a bit confused by the custom flow syntax (ACTOR, wait ..).

The build works fine, but the code is filled with red squigglies and the “find all reference” code gets confused a lot, which makes exploring the code a bit more difficult.

Update: the issue comes from Resharper C++ which must be disabled

Example of the intellisense going berserk on the code when Resharper is enabled:

How have you solved this for your day-to-day coding? What are you doing to have highlighting and auto completion for code that uses Actors at the IDE level?


(A.J. Beamon) #3

There’s a file flow/actorcompiler.h that gets included which provides some fake definitions for the flow keywords that make visual studio happy:

You can see it’s included here in the file you had open:

Perhaps there’s something going on with the inclusion of that file or the definitions that it contains?

We also have a file that can be used to define user types for Visual Studio for purposes of syntax highlighting. The file is located here, and can be applied using the instructions from here.


(Christophe Chevalier) #4

It was in fact Resharper that does not understand the code. If I disable R#, the warnings go away. Maybe their C++ parser is not able to recognize the custom macro definitions. I’ll try open a ticket with them about that.


(Christophe Chevalier) #5

I missed the fact that you needed to install Pythong 2.7 to build the fdbclient (it was already installed on my other dev box). Updated the top comment.


(Jesse Bennett) #6

This is just C++ for VS I’m assuming but curious to see if the new LLVM and/or MinGW can also handle these builds on Windows. If you are able to build this without switching the compiler on Windows that’s pretty cool.


(Christophe Chevalier) #7

Looks like Resharper 2018.1.1 has some fixes for C++ that solve the intellisense issues:

Now all that remains are a few similar errors that I’m not sure I understand.

One example is in NativeAPI.actor.cpp:

Severity	Code	Description	Project	File	Line	Suppression State	Detail Description
Error (active)	E0308	more than one instance of overloaded function "getValue" matches the argument list:
	fdbclient	c:\DATA\Git\GitHub\foundationdb\fdbclient\NativeAPI.actor.cpp	998		            
            function "getValue(const Future<Version> &version, const Key &key, const Database &cx, const TransactionInfo &info, const Reference<TransactionLogInfo> &trLogInfo)"
            function "getValue(Future<Version> version, Key key, Database cx, TransactionInfo info, Reference<TransactionLogInfo> trLogInfo)"
            argument types are: (Future<Version>, const Key, Database, TransactionInfo, Reference<TransactionLogInfo>)

The issue for R# C++ seems to be that getValue is first defined line 995 with all arguments as const&, but then later its implementation in line 1163 does not have const&. Visual Studio seems ok with this, but R# c++ thinks that they are two different methods, and so getValue(...) appears ambigous. In turn, this trips up the wait(....) over getValue as a side effect.

Removing the const& line 995 does make the error go away. Are they needed?


(A.J. Beamon) #8

The flow actor compiler generates methods with const& for all of its arguments, so to forward declare an actor method you must include const&. I also believe it doesn’t allow you to pass arguments by reference to an ACTOR, so you won’t be able to addconst& at 1163 either.