Compile BOINC Client on Linux

in cryptocurrency •  6 years ago 

Gridcoin is a cryptocurrency which rewards users for sharing idle processing time with scientific research projects through the Berkeley Open Infrastructure for Network Computing, or BOINC. The Gridcoin Wallet itself is designed to consume minimal processor power so that resources are available for the BOINC client, meaning participating devices contribute most of their resources to scientific research rather than just maintaining the blockchain. The low hardware requirements mean that BOINC can run on standard hardware and older equipment, with some research projects providing applications for Android and Raspberry Pi devices.

If you want to participate in Gridcoin, you'll need the Gridcoin Wallet, and the BOINC client. I've found that most recent mainstream linux distributions include packages for both, although if you want the most recent versions you'll need to compile from source. That's especially true if you're running a "light" distribution on older hardware, like I am with a few old laptops.

Up-to-date compilation instructions for BOINC are hard to find, and I could not find a guide that had a working set of complete instructions in one place. So, working off some of these guides and looking into compile failures on my own, I've come up with a set of instructions for (I think) any rpm-based distribution, and which can probably be adapted to any linux if you know where to find the prerequisite packages and how to install them. This will get you the most up-to-date BOINC client installed, but to actually get up and running, see the guides at gridcoin.us.

Step 1: install prerequisites

These prerequisite packages come from a list at the BOINC wiki. Use your package manager to install these packages.

First, the generic development tools.

sudo apt install make m4 libtool autoconf automake gcc git pkg-config

Next, prerequisites for building BOINC.

sudo apt install sqlite3 libsqlite3-dev libnotify-dev openssl libssl-dev libcurl4-openssl-dev libjpeg-dev libgtk2.0-dev libx11-dev freeglut3-dev libxmu-dev

These packages enable compiling the BOINC screensaver. The screensaver does not work in linux, but if the screensaver is not compiled then a later step fails.

sudo apt install libxcb0-util-dev libxss-dev libxi-dev
libxcb0-util-dev may have a different name on some distros (under lubuntu I found it as libxcb-util0-dev)

To make your BOINC client compatible with 32-bit projects on a 64-bit platform you need some additional packages. This list is from a different page on the BOINC wiki

sudo apt install ia32-libs libstdc++6 libstdc++5 freeglut3
On newer distos, ia32-libs is replaced by lib32z1. Install that instead if apt complains.

Another note suggests installing this set of packages if the first set fails. I've never had to do this, though.

sudo apt install gcc-4.7-multilib libstdc++6 libstdc++5 freeglut3 lib32z1 lib32ncurses5 lib32bz2-1.0

Step 2: download and compile wxWidgets

BOINC requires wxWidgets version 3.0.0 or better, but I've found many distributions don't have up-to-date packages and it's necessary to compile from source. If you can get development packages for a recent-enough version in your distro, then just install those and skip this part.

To get started, download the latest stable version of wxWidgets (avoid unstable versions). The most recent as of this guide is 3.0.4. This is assuming you're going to build in your home directory.

cd
wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.4/wxWidgets-3.0.4.tar.bz2

Once downloaded, extract the archive and begin compiling.

tar -jxvf wxWidgets-3.0.4.tar.bz2
cd wxWidgets-3.0.4
./autogen.sh
./configure --with-gtk --disable-shared
make -j5
The -j switch tells make how many processing threads to use in compiling. Setting this to one more than the number of processor cores in your system can greatly reduce the time to compile, but also needs more RAM. If you get strange compile errors you might be running out of memory. If so, try running make without the switch.

Once compiling finishes, install as root:

sudo make install
sudo ldconfig

Step 3: download and compile BOINC

Get the BOINC source code from git:

cd
git clone https://github.com/BOINC/boinc boinc
cd boinc

As of June 2019 the latest release of BOINC is 7.14.2. Use git tag to look for a newer release if you want to, and then use git checkout to select the release version.

git tag
git checkout client_release/7.14/7.14.2

Compile the BOINC client and the BOINC manager application:

./_autosetup
./configure --disable-server --enable-client CXXFLAGS="-O3 -funroll-loops -fforce-addr -ffast-math"
make -j5
cd packages/generic/sea/
make

BOINC doesn't come with an install target, so installing and setting up the client will be our next step.

Step 4: configure and install BOINC

These instructions are adapted from a guide at (http://www.spy-hill.net/help/boinc/unix.html).

First, we need to create a user account for boinc. I'm using /var/lib/boinc for its home directory, which will be the data directory BOINC operates out of, and will require about 2GB for itself although you can configure this in the manager once it's running. If you want to use a different data directory, change /var/lib/boinc to the directory you want to use.

sudo useradd -d /var/lib/boinc boinc

Now, as root, create the data directory, copy files from the compilation directories, and set ownership of the data directories.

cd ~/boinc/packages/generic/sea/BOINC
sudo mkdir /var/lib/boinc
sudo cp * /var/lib/boinc/ -r
cd /var/lib
sudo chown boinc boinc -R
sudo chgrp boinc boinc -R

Copy BOINC's executables to system folders:

cd /var/lib/boinc
sudo cp boincmgr /usr/local/bin
sudo cp boinc /usr/local/bin
sudo cp boinccmd /usr/local/bin
sudo ln -s /usr/local/bin/boinc /usr/local/bin/boinc_client

Create a password so that BOINC manager can communicate with the client, and to enable remote access.

cd ~boinc/
sudo echo [password] > gui_rpc_auth.cfg

Spy-Hill.net hosts an init script that works out-of-the-box on any of the distros that I've tried. Download that to your init.d directory:

cd /etc/init.d
sudo wget http://www.spy-hill.net/help/boinc/init.d/boinc
sudo chmod +x boinc

Next you'll need to use your favourite text editor to edit the boinc init script, and set the BOINCDIR and BOINCEXE variables to the right values for your installation.

BOINCDIR=/var/lib/boinc
BOINCEXE=/usr/local/bin/boinc_client
Note: these are fields to edit with a text editor. Don't enter these as commands on the command line!

Activate the init script so that the BOINC client starts on boot. These instructions worked on lubuntu, it may vary by distribution.

sudo update-rc.d boinc enable
sudo systemctl enable boinc

Reboot and you should have a working BOINC client set up on your system. Note that the client won't be doing anything yet, you have to configure it by logging in to your project manager or however you interact with BOINC projects. See the Gridcoin website for instructions on this.

These instructions work on any version of Ubuntu or Lubuntu that I've tried them on, as well as Bunsenlabs Deuterium and Helium, which are minimalist Debian-based distributions.

Good luck!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Very nice. Perhaps we should include this in the Gridcoin wiki?

Congratulations @ivanvector! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You made your First Vote
You got a First Vote

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Hey there @ivanvector, welcome to STEEM. If you join @schoolofminnows, you can receive votes for free.
1. Your post will appear in post-promotion on the discord.
2. Your posts will also get featured on the school of minnows account on steem
https://steemit.com/@schoolofminnows
3. You get votes from other members.
4. The whole thing is FREE.
To join follow this link:
https://steem.host/connect/steempunks