truXoft

Compiling Custom BOINC Client on FreeBSD

(for semi-dummies)


Warning

I have to warn you that I am not a FreeBSD expert, or an expert in other brands of Posix. I just happen to use a FreeBSD web server, and have just learned what I need to keep it running. Experts may be able to give you better instructions. I am posting this manual because athough there are some instructions available on the official site, and some Linux howto's are on the web too, I was never successful following them, and so far I did not find any cookbook for FreeBSD. Using the very outdated FreeBSD BOINC v4.67 port was the only possibility easily available.

Preparation

There were several problems when I tried compiling it on my FreeBSD server. First of all, you have to install all missing ports, like for example autoconf, curl, m4, etc. The usual way is first looking the ports up with the help of the command whereis and then installing. For example:

Foo# whereis autoconf
autoconf: /usr/ports/devel/autoconf213
Foo# cd /usr/ports/devel/autoconf213
Foo# make
Foo# make install

There are also other methods of installing ports - you can find more details about installing ports at freebsd.org. Usually you will encounter other problems (at least I always do), so for the right solution, you may need to google the specific error message you are getting.

Getting the source code

First of all, after installing the CVS port (CVS = Concurrent Versions System = version control and collaboration system used here for downloading the right source code revision), I downloaded the official release 5.3.12 that I needed for my custom build 5.3.12.tx37:

Foo# cd ~
Foo# mkdir build
Foo# cd build
Foo# cvs -d :pserver:anonymous:@alien.ssl.berkeley.edu:/home/cvs/cvsroot checkout -r boinc_core_release_5_3_12 boinc

Then I loaded my modified source files over the original ones.

Autosetup

Now, I tried running the first installation step as described at http://boinc.berkeley.edu/build_system.php:

Foo# cd ~/build/boinc
Foo# ./_autosetup

Unfortunately, there were plenty of errors. I had to install couple of other missing or outdated ports. I also had to edit the file _autosetup, because for some reason the FreeBSD version of m4 (macro processor utility) does not recognize the switch --version as probably the Linux versions do. I opened the _autosetup file in editor (I use vi, but if you are not used to it, you better stick with the one you are familiar with, or download and re-upload the file, if it is a remote machine), looked for the error message I saw, and found the code shown below, where I added the comment #-sign in front of the "exit 1" command. With this change, unlike without it, the autosetup will continue to the next step. However, you have to verify manually that you have the right build of m4 installed properly anyway (at least the v1.4.1).

echo "Couldn't find a new-enough version of 'm4', please install one!";
# exit 1;
# build_lsc_aux "m4-1.4.1"

The next problem was, that although I installed all the necessary ports, like autoconf, automake, etc., for some reason they were not registered under the expected names (aclocal, libtool, autoheader, autoconf,...) but under version branded names (aclocal19, libtool15, autoheader259, autoconf259). First I tried adding the paths to the environment in the following way:

Foo# env LIBTOOL=/usr/local/bin/libtool15
Foo# env ACLOCAL=/usr/local/bin/aclocal19
Foo# env AUTOHEADER=/usr/local/bin/autoheader259
Foo# env AUTOCONF=/usr/local/bin/autoconf259
...

However, it did not seem to help (I tried also the set command), so I did it the straight way and created symbolic links:

Foo# ln /usr/local/bin/aclocal19 /usr/local/bin/aclocal
Foo# ln /usr/local/bin/libtool15 /usr/local/bin/libtool
Foo# ln /usr/local/bin/autoheader259 /usr/local/bin/autoheader
Foo# ln /usr/local/bin/autoconf259 /usr/local/bin/autoconf
...

I think there was another problem or two, but unfortunately I did not note them. The solution was rather intuitive though, so even if it should happen to you too, you will certainly find your way out too.

So now finally autoconf went through and I could proceed to the next step:

Configure

Foo# ./configure

Better told I had to make some research on the web, and reading of file before I found I probably need the following:

Foo# ./configure --disable-server -enable-client WITHOUT_X11=yes no_glut=yes

Adding the option --enable-static may be good for better portability and on machines with gcc-3.0, you can also use --enable-client-release

Again, there was number of error messages. I believe it was here I found out I have to reinstall the libcurl port. It is hidden under the name curl, so I did not find it immediately - had to look it up at freebsd.org first.

Well, so far it took couple of hours, and now I was finally ready to compile:

Compile

Foo# make

Hmm, big disapointemnt - plenty of error messages. It was here I had to experiment with the additional options for configure and re-configure it couple of times. Every time I've gotten an inch further, but still getting errors. I had to fix couple of incompatibilities in my source code (that's fixed now in the release 5.3.12.tx38). However, I still could not manage compiling it. I tried then going to the individual subdirs and compiling the elements one after the other, but it did not work either. Finally, it was indeed the right approach. After finding the right configure switches and debugging makefiles, I saw I have to compile first the lib subdir, then coming back to boinc root and compiling the client:

Foo# cd lib
Foo# make
Foo# make install
Foo# cd ..
Foo# make

Install

Now, I stopped the old client, and installed the new one:

Foo# /usr/local/etc/rc.d/boinc.sh stop
Foo# make install

Just a quick peek into the directory /usr/local/lib/boinc/ if the new file is really installed, and... arrgh, of course, it failed again for some reason, so I have to move it manually (please note that the original client installed from the FreeBSD port used a dash instead of underscore in the new file name! I kept it, because it is used also in the starter script /usr/local/etc/rc.d/boinc.sh):

Foo# mv /usr/local/lib/boinc/boinc-client /usr/local/lib/boinc/boinc-client.orig
Foo# cp /home/truxoft/temp/boinc/boinc/client/boinc_client /usr/local/lib/boinc/boinc-client

Let me add the truxoft_prefs.xml configuration file to /var/db/boinc, and I can almost start the new client. Before doing it, I realize I was stupidly logged as root (because some of the steps required it) and horrified, I see the original client ran as root too (ouch!!). So, let's create a new user and group boinc with restricted access (nologin) - it is definitely very bad idea to keep it as root or under any other user id!

Foo# adduser
...

Then change the original ownership to the new one:

Foo# chown -R boinc:boinc /var/db/boinc/
Foo# chown -R boinc:boinc /usr/local/lib/boinc/

And now we can finally start the new client:

Foo# /usr/local/etc/rc.d/boinc.sh start

BINGO! It was a big pain (much worse than described), but it finally worked.

I still needed to look at the newly created /var/db/boinc/gui_rpc_auth.cfg, copy the password and paste it into the BoincView manager.

Support

IMPORTANT: Please do not contact me with any questions directly. I am a busy person, handling daily many hundreds of emails, and often have to ignore messages not concerning my daily job. If you have any troubles or doubts, please write your question to the BOINC message boards - there are plenty of experts who will happily jump in with a helpful advice, and I may answer too if I have the chance to see it.

offered by trux @ truXoft
Freediving Team

The compiled clients are my contribution to the BOINC community, and I do not intend profiting from it. However, the cost of the software tools for Windows development is huge (over three thousands of dollars), so if you can help with a small donation, I may be able to buy other tools I need for better optimizing - Intel Math Libraries, Intel Debugger, Profiler, and possibly other needs may emerge (i.e. updates). I already purchased full and legal versions of MS Visual Studio PRO 2003, and the Intel ICC Compiler + the Intel IPP Library. I did so spontaneously, without expecting any return, but unfortunately I cannot afford spending any more funds on the other needed tools. Any donations to help covering the cost of the development tools are very much appreciated!

Current donation status: €352.20 (updated manually)

THANKS!