A Blog About Vector The Robot
How to compile Go projects on Windows

How to compile Go projects on Windows

Some of the open sourced packages released by Digital Dream Labs on Github are coded in Go, a development language by Google, that was invented 2007 to speed up the coding process at Google and because the devs there disliked C++. It is somewhat related to C, but has an easier syntax. It is a more obscure programming language as only about 1.4% of all IT projects worldwide are done with it (at february 2021, source: TIOBE index). I personally would have gone with a language that has broader acceptance and pervasion in community and hobbyist projects, but that’s what they did choose and we have to live with it. The cause for Go may be that it also was used by Anki for Vector-related projects, so it’s easy to guess that the DDL devs expand on things that were already in development by Anki.

Robbie Lucas Bussard helped me with questions on how to compile Go code on Windows via a quick chat we had on Facebook, and after that chat he also expanded the doc in the Github repository, as he agreed it was incomplete regarding windows. Thanks for both.

So how do you use this on Windows?

Note: This is not a complete course on using Github or something like that, but it get’s you started.

First: Install Git for Windows

If you don’t have already, install Git for Windows. Download the installer and run it. This also installs Git GUI and Git Bash and it should also include MinGW (“Minimalist Gnu For Windows”), that adds a set of Unix/Linux commands to Windows. Installation is straightforward, just run the installer. I did this some years ago, and I do not remember every detail, so if the installer asks if you want to add commands to the Windows Context Menu, please accept that. But it may be that these are installed without asking about it.

Second: Install Chocolatey.

Chocolatey is a package manager for Windows. Linux users already know package managers, those are administrative tools that install software, or better: software packages to operating systems. There are multiple package managers for Windows, Chocolatey is one of them, NuGet is another.

Requirements for Chocolatey are:

  • Windows 7 or higher / Windows Server 2003 or higher
  • PowerShell v2+ (minimum is v3 for install from the official website due to TLS 1.2 requirement)
  • .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)(minimum is 4.5 for install from the official website due to TLS 1.2 requirement)

To install Chocolatey, you need elevated rights, in other words: you have to run it as admin.

There are two ways to do this, via a cmd console (cmd.exe) or via Windows Powershell, read below and use the way you prefer.

Installation via command.exe (that also calls Powershell, but this is for users that are not comfortable around Powershell):

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

That is one long line, you can copy that code. For better readability here is it again with line breaks:

-NoProfile -InputFormat None -ExecutionPolicy Bypass
-Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072;
iex ((New-Object System.Net.WebClient).DownloadString
&& SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Or install it direktly with Powershell:

Run Get-ExecutionPolicy. If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.

After that execute:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Again in one line for more convenient reading:

Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
iex ((New-Object System.Net.WebClient).DownloadString

Chocolatey package manager is now installed on your system.

Third: Install the Go programming language.

Go to the Go project website’s download area and download the installer for Windows. You need at least Windows 7 to run it. Just execute the installer and Go is installed. As easy as that. To see if it worked open a command window via cmd.exe and type:

go version

You should see something like

go version go1.15.7 windows/amd64

If you get that, Go is installed.

Fourth: Install Make.

GNU Make is a tool to compile code from commands it usually find in a makefile. It is run from a command line and usually looks for it in the active folder. That is a very short explanation, find more information about GNU Make on Wikipedia.

Installing Make to compile Go projects is quite easy after installing Chocolatey: Open a command window (cmd.exe) with elevated rights (as administrator). Now type:

choco install make

… and Make gets installed. As easy as that.

Now do some Git cloning

Prepare a folder where you want to clone one of Digial Dream Labs Go project, for example Vector Configurator.

Right click into the folder and from the Windows context menu (right mouse click) run “Git Bash here”. That opens a Git Bash (read: commandline) window that gives you access to a subset of Linux commands via MingW64. Via this Git Bash you can now clone a repository with the command:

git clone https://github.com/digital-dream-labs/vector-configurator.git

Now the code in the Github repository is cloned into your local folder.


Now in the same Git Bash Window cd into the folder the code from the repository was cloned into (cd vector-configurator, the exact location depends on where on your hardisk you cloned it to) execute:

make build

Vector Configurator is now compiled. After Make finishes, you will find a command line tool called “vc” in the folder with the cloned repository. With that you can configure an OSKR robot for Escape Pod far easier than before. Please refer to the official documentation on usage in the Vector Configurator Github repository.

You can now compile Go projects that use a makefile.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *