Building native Windows Urbit binaries
Late 2021 Note: This guide is now largely outmoded; Urbit now has official Windows binaries, and Port now has a native Windows installer |
---|
Last month, a PR was published by locpyl-tidnyd
to the Urbit Github, containing instructions and a build environment for the compilation of static, Windows-native Urbit executables(!), for the eventual purpose of an official Windows binary distribution. I am frankly amazed that this is even possible.
As somebody who has encouraged many friends to try out a comet, the biggest hurdle has been convincing them to set up a Linux environment – the source of two previous tutorials on this blog. WSL2 is a fabulous tool but still veers toward the geekier side of things, and ordinary people cannot be blamed for wanting a simpler method.
This achievement is pulled off using MSYS2, a fork of Cygwin, and MinGW, a Windows port of gcc
. The codebase for vere
was also ported to mingw
by ~locpyl-tidnyd
. This tutorial will walk you through the steps necessary to build Windows-native binaries, and execute them in an ordinary command prompt.
I include a download link for my compiled binaries in case you have difficulty; however, I very strongly recommend that you compile your own, rather than downloading executables from a stranger on the internet! This is a simple process and should only take about ten minutes.
Installation
Download the latest installer for MSYS2 from the official website, and install it with all default options. After completion, leave the ‘run now’ option checked off.
A wintty
will pop up with a bash shell; let’s update all our packages:
- $> pacman -Syu
Once finished, the window will close. Go ahead and launch MSYS2 MSYS
from the start menu, and run another update, then install our toolkit:
- $> pacman -Syu
- $> pacman -S --needed base-devel mingw-w64-x86_64-toolchain
Now head over to the linked PR and download the tarball for the mingw
urbit port. Extract the contents, then copy them into your MSYS2
home directory:
C:\msys64\home\user.name\home\
Compiling
Open your start menu, and pull up MinGW 64-bit
– note that this is not the same as MSYS2
despite the similar icons.
Navigate to your newly copied directory, and run the configure
script:
- $> cd urbit-mingw-port/pkg/urbit
- $> ./configure
Once this has finished running, build it:
- $> make build/urbit build/urbit-worker
Locate and copy the executables out of their directory:
C:\msys64\home\user.name\home\urbit-mingw-port\pkg\urbit\build
Execution
Open an ordinary cmd.exe
command prompt, or Windows Terminal if you have it installed – you do not need elevated privileges, but you may need to allow it through the Windows firewall.
Navigate to the directory where you have copied your executables, and try executing urbit.exe
to print the help menu:
- C:\> cd c:\users\user.name\urbit
- C:\Users\user.name\urbit> .\urbit.exe
If all is successful so far, you’re ready to boot a comet.
- C:\Users\user.name\urbit> .\urbit.exe -c mycomet
Let your ship download its source and compile – this will probably take 15-20 minutes to complete. Once done, and you’re in your dojo, request an OTA update, and produce your Landscape access code:
- ~sampel_wanzod:dojo> |ota ~wanzod %kids
- ~sampel_wanzod:dojo> +code
Navigate to http://localhost:80 to access your ship, and paste the password produced by +code
to enter Landscape.
Addendum
The process of downloading and compiling your ship is significantly slower than on a Linux machine in my experience, even compared to running a ship on WSL2. That said, it was still totally functional if slightly less responsive.
While I have successfully tested and used this Windows build, I cannot guarantee their stability – these have not been released into production, I assume for this reason. I would not recommend booting a planet with this just yet, but this should be replaced by an official release in the near future.