From c54b3990d9be009bd4a9ecb9ac16ad8cace3c423 Mon Sep 17 00:00:00 2001 From: Duke Date: Thu, 25 Jan 2024 09:13:56 -0800 Subject: [PATCH] Compiling Hush basics --- doc/developer-notes.md | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index a2d90a7d3..df090cd05 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -1,3 +1,53 @@ +# Basics + +First the basics, how to compile code in this repo. + +First you will want to clone the code locally: + +``` +git clone https://git.hush.is/hush/hush3 +cd hush3 +``` + +If you want to compile a branch other than master (the default), such as +our development tip (the `dev` branch) you can switch to it: + +``` +git checkout dev +``` + +Then install needed dependencies. This is different on each OS as well as +older or newer systems. See https://git.hush.is/hush/hush3/src/branch/dev/INSTALL.md for +details on installing dependencies. If you are using a recent-ish Linux distro, this +is probably what you need: + +``` +# install build dependencies +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib \ + autoconf libtool ncurses-dev unzip git zlib1g-dev wget \ + bsdmainutils automake curl unzip nano libsodium-dev cmake +``` + +Finally to compile the software you use `./build.sh` . It is quite slow +to only use a single thread, so you can use multiple threads, for example 4, +like this: + +``` +./build.sh -j4 +``` + +Each `build.sh` thread will take ~2GB of RAM so beware of that. If you have +compiled before and just made a change to C++ code, you can probably use +`make` instead and use a high number of threads. For example, if your CPU +has 8 physical cores and 16 "virtual cores" then you can use `make -j16` and +things will compile much faster. Each `make` threads takes only about 200MB of RAM. +If `make` fails in a weird way complaining about Makefiles, you probably need to +run `build.sh`, which takes care of regenerating Makefiles and installing some +additional dependencies. + +Sometimes using multiple threads the build can fail, so if it does, try again +with a different number of threads or just one thread before reporting an issue. + # Fresh sync Many times, you will want to do a "fresh sync" test, to verify code works when syncing from the genesis block, which is a different code path than a "partial sync" which means you already have part of blockchain history and are "catching up" to get in sync.