Windows Users : How to build RYO from source on Linux using WSL
The open source revolution is just accelerating more and more every day, this makes learning about Linux a great thing to do. For many people Windows is the only OS they’ve ever known so it can be a bit daunting to wade into the Linux world. Working in IT within a Fortune 500 company I’ve noticed that some developers began requesting Apple notebooks so that they could develop in a more Linux-esque OS.
I found it interesting to learn that the macOS kernel (XNU) has been around longer than Linux and was based on a combination of two even older code bases. It seems that Microsoft also noticed the trend and the wider domination of Linux in the realm of servers and has been making moves to empower windows users to be able to develop locally against a full Linux kernel with the addition of a feature called Windows Subsystem Linux (WSL).
So first things first, get WSL enabled and installed on your PC. I went with the Windows 10 manual install to avoid having to join the ‘windows insider program’ and update to the preview build of Win10. I then chose to use Ubuntu 18.04 LTS as my flavor of Linux to begin my adventure.
Now before we do anything else lets just make sure we’re all up to date, Linux makes this super easy with just a couple commands. The first command is sudo apt-get update
The second command to run is sudo apt-get upgrade -y
Now that we have the OS current lets follow the compile direction doc from the ryo-currency Github repo and prepare to compile a debug build to be able to provide better logs when testing.
For starters Ryo uses the CMake build system and a top-level Makefile that invokes cmake commands as needed. So we also need to install CMake with sudo apt-get install cmake
Debian / Ubuntu one liner for all ryo dependencies sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpgm-dev
On Debian/Ubuntu libgtest-dev
only includes sources and headers. You must build the library binary manually. This can be done with the following command sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo mv libg* /usr/lib/
Ok, now that the foundation is all current and ryo dependencies installed lets clone the ryo-currency dev branch from Github to compile so we can test new features.🤓
- First lets make sure we’re in our home directory
cd ~
you can check your present working directory withpwd
- Make a ‘code’ directory
mkdir code
and change directory to itcd code
- Run the follow command to clone ryo-currency repository and checkout the dev branch:
git clone -b dev https://github.com/ryo-currency/ryo-currency.git
- Change directory
cd ryo-currency
- Check your current branch with
git branch
When running the make
command we can speed up the compile time through parallelization of the process via executing with multiple threads. Your ability to do this will be bound by your systems CPU (# of threads possible) and how much RAM there is (each thread needs 2GB). While you might already know the capabilities of your PC here are a few commands that can provide you with the information.
Possible Threads :nproc
will print the number of processing units available or lscpu
can get you to the same number.
RAM available : free -g
will show you in gigabytes how much RAM you have total, used, and free.
Based on your system hardware the command will be make -j<# of threads>
my CPU supports 24 threads and I have 59GB of free RAM which is enough (24x2 ≤ 59) to use all possible threads.
make debug -j24
You now have executable assets under the build path: cd build/debug/bin/
WSL is nifty in that it also support running in the background which means with a little help from tmux
we can run our ryo debug daemon without keeping WSL open.
If you are a user of the Ryo GUI wallet Atom with the local node option enabled then you’ll already have the blockchain downloaded to your Windows file system. WSL provides access to your Windows directories in the /mnt/c/
path so using Atoms default location we can run the following to avoid downloading the blockchain again to the Linux file system being run on WSL.
./ryod --data-dir /mnt/c/ProgramData/ryo/ --log-file-level 2 --log-file ~/ryo_debug.log