Building Steem with GCC 6.1 on Fedora 24

in #steem-help8 years ago

I successfully compiled Steem from the master branch on Fedora 24 with GCC 6.1. There was a couple of gotchas to overcome, so I think this quick guide could be useful to users of Fedora and maybe other GNU/Linux distributions that have the latest GCC version. The guide is adapted from the Russian version that I posted earlier.

Penguin

You need to download and build Boost 1.60.0 first (Steem wouldn't compile with the latest Boost 1.61.0). After downloading boost_1_60_0.tar.bz2:

$ tar -xjf boost_1_60_0.tar.bz2
$ cd boost_1_60_0/

Now, Boost 1.60.0 is not compatible with GCC 6.1. To fix this I had to replace boost/multiprecision/cpp_int.hpp with this version:

$ curl 'https://raw.githubusercontent.com/boostorg/multiprecision/f9c8f9ec091ad232c0a291904f7839d665d098e0/include/boost/multiprecision/cpp_int.hpp' \
      > boost/multiprecision/cpp_int.hpp

Installing the dependencies needed to compile Boost:

$ sudo dnf builddep boost

Building and installing Boost:

$ ./bootstrap.sh --prefix="$HOME/opt/boost-1.60.0"
$ ./b2 install

Building Steem:

$ git clone --recursive https://github.com/steemit/steem.git
$ cd steem
$ cmake -DBOOST_ROOT="$HOME/opt/boost-1.60.0" \
      -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=ON \
      -DCMAKE_BUILD_TYPE=Release .

While compiling I caught an error that I was able to fix by replacing the following line in libraries/fc/git_revision.cpp (I am using sharps instead of hashes here as otherwise Steemit parses it as a tag):

♯define FC_GIT_REVISION_UNIX_TIMESTAMP HEAD-HASH-NOTFOUND

with

♯define FC_GIT_REVISION_UNIX_TIMESTAMP 0

and restarting cmake.

After that everything compiled successfully, steemd could be found in programs/steemd/, cli_wallet — in programs/cli_wallet/.

If I understand it correctly, variables ENABLE_CONTENT_PATCHING=OFF and LOW_MEMORY_NODE=ON are supposed to reduce system resource usage by the node, yet steemd still requires quite a lot of memory. On my machine it uses 5 G while mining, of which 2.8 G is resident and 2.2 G is in swap.

Sort:  

By chance did you try Intel C++ v16 as an alternative to GCC? I've been trying for 2 days to get it to compile, without luck. I need it to work so I can try running SteemD on an Intel Phi coprocessor!

No, I have no experience with icc at all.

As a tip (for any node that takes a lot of RAM, whether steem or something else): If you are sort in ram, you may want to try zram. It can save you the use of slow swap. It essentially compresses the ram used for a small cpu tradeoff (if you use LZ4 the tradeoff is minimal) allowing you to do more with less, plus increase speed if you avoid the swap.

Thanks. I'm actually using zswap, which is better as it can move compressed pages between RAM and on-disk swap while zram only holds compressed pages in RAM. Zswap can be enabled simply by adding "zswap.enabled=1" to the kernel command line.

From what I understand, zswap just compressed the pages it's going to swap out (reducing I/O - say a 10kb write becomes a 5kb write) and doesn't include zram-like functionality although I could be wrong.

Zram can be used to compress the pages it holds in the ram itself - so it avoids the I/O entirely. In my observation, average compression rates are ~3x in my machine for normal use. So in a 4GB machine with 3gb getting compressed with zram, the 3gb compressed can host ~9gb of data. Plus 1gb for the non-zram compressed, it totals around 10gb.

No, according to the kernel documentation zswap keeps compressed pages in a RAM-based memory pool and only moves them out to the on-disk swap when the compressed pool reaches its size limit.

Hmmm... nice. I'm using both zram and zswap on an old laptop of mine (it has an old 40gb pata - very slow) to reduce I/O, so I'll try at some point to see how it goes with zswap only.

Thanks for this guide. I will trying this build on Fedora 25 over the weekend.

Coin Marketplace

STEEM 0.15
TRX 0.16
JST 0.028
BTC 68588.91
ETH 2458.42
USDT 1.00
SBD 2.35