Wednesday, November 22, 2006

Building the BOINC Client on CentOS-4

UPDATE: Fixed directions on adding lines to curl-local.spec.

Both Red Hat Enterprise Linux 4 and its clone, CentOS-4, need some updated packages to build the BOINC client out of the box. For example, they both ship libcurl 7.12.1 and BOINC requires 7.15.5 or better. They already ship RPMs for the older version, we just need to create an RPM for the newer version.

The only instructions that should be CentOS specific are related to retrieving the source RPM files. For Red Hat, you might try:
$ sudo up2date --get-source 
On CentOS:
$ wget ftp://rpmfind.net/linux/redhat/updates/enterprise/4AS/en/os/SRPMS/curl-$(yum -C list|grep curl-devel|awk '{print $2}').src.rpm
will work. This calls yum (which does not exist in RHEL4) to find out what the current version of curl-devel is. Then awk spits out only the version information and the whole thing is plopped down into the middle of the URL passed to wget, which retrieves the file.

Once retrieved:
sudo rpm -Uhv curl*.src.rpm
will install the source and files necessary to build an RPM. Following that, everything should be available under /usr/src/redhat.

Let's change to that directory to update and build cURL.
cd /usr/src/redhat
The latest released version of cURL is always available from http://curl.haxx.se. They are very proactive in supporting the package, issuing updates, and fixing any security related bugs that are found.

If you are going to locally compile and install software on a machine, I highly recommend creating an account at freshmeat.net and subscribing to get announcements for updates to that project. This includes security fixes. I would also recommend subscribing to the CentOS or RHEL announcement mailing list.

First, we have packages such as PHP that depend upon the libcurl version 3 ABI, so we need to arrange to have both the old version, and the new version installed. Start by:
cd SPECS
Then, either get the spec files from compat-curl-local.spec and curl-local.spec, saving them into the SPECS directory or create them afther this fashion:
sudo cp curl.spec compat-curl-local.spec
Then,
  1. Edit compat-curl-local.spec:
  2. Change the Name: to compat-curl
  3. Append .local.1 to the Release: line
  4. Change the Source: line to reference curl- instead of %{name}.
  5. Add -n curl-%{version} to the end of the %setup line.
  6. Save it.
Then,
sudo rpmbuild -ba compat-curl-local.spec
Running:
sudo wget -P ../SOURCES http://curl.haxx.se/download/curl-7.16.0.tar.bz2
will place the latest (as of this writing) released source into the ../SOURCES subdirectory.
sudo cp curl.spec curl-local.spec
sudo <your-favorite-editor> curl-local.spec
Change Version: to 7.16.0
Change Release: string to 0.rhel4.local.1
Add a Prefix: /usr line near the top of the file. This makes the package relocatable.
Delete all patches except #1 and renumber it to 0.
After %setup remove all %patch lines greater than 0.
Under %files add:
%{_libdir}/pkgconfig/libcurl.pc
This will make sure that any version 7.16.0 that is released by Red Hat will replace our local one. Yet, it will also guarantee that no 7.x versions less than that will overwrite our local one.

Then,
sudo rpmbuild -ba curl-local.spec
When this is done, it's time to install:
sudo rpm --force -Uhv ../RPMS/i386/compat-curl-7.*.local.1.i386.rpm
sudo rpm --force -Uhv ../RPMS/i386/compat-curl-devel-7.*.local.1.i386.rpm
sudo rpm -e curl curl-devel
sudo rpm -Uhv --prefix=/usr/local ../RPMS/i386/curl-7.16.0-0.rhel4.local.1.i386.rpm
sudo rpm -Uhv --prefix=/usr/local ../RPMS/i386/curl-devel-7.16.0-0.rhel4.local.1.i386.rpm
We first force the installation of our new compat- RPMs, because they will conflict with the originals. (The supply the same files under a different name. The name change is necessary so that our newer version does not result in an upgrade removing the old ABI version 3 files entirely.) Once those are in place we remove (erase) the original packages to make way for the new ones. Then we load our new local versions prefixing them into the /usr/local hierarchy to avoid interfering with the old files.

Once the updated cURL is in place we need the OpenGL and JPEG development libraries.
sudo up2date xorg-x11-devel freeglut-devel libjpeg-devel
Another fairly large component that we need are the wxWidgets. We get these from building a spec file that is part of the RPMforge project. I could not find the corresponding binary RPM for RHEL4.
cd /usr/src/redhat/SPECS
sudo wget http://svn.rpmforge.net/svn/branches/rpms/matthias/wxGTK/wxGTK.spec
sudo wget -P ../SOURCES http://downloads.sourceforge.net/wxwindows/wxGTK-2.6.2.tar.bz2
sudo up2date gtk2-devel SDL-devel libgnomeprintui22-devel libpng-devel libtiff-devel
sudo rpmbuild -ba --define 'dist el4' wxGTK.spec
cd ../RPMS/<architecture>
sudo rpm -Uhv wxGTK-2.6.* wxGTK-gl-2.6* wxGTK-devel-2.6.*
For most, <architecture> is going to be i386.
cd ~/src/boinc
./configure --enable-unicode
make
I have to commend the guys working on BOINC, especially Rom Walton. Prior to revision 1.20 of clientgui/SkinManager.cpp this would blow up compiling for UNICODE due to some character width mismatch errors. I sent in a patch and the very next day it was already in their CVS repository.

That's like a breath of fresh air in FOSS development. Too many projects make it difficult to get your patches accepted into the mainstream. It shouldn't be that way.

6 comments:

Aaron Hawryluk said...

Hi,

Having a little trouble with your install - the final two lines generate the following error: Package _name_ is not relocatable

Any suggestions?

Aaron Hawryluk said...

Ok, think I found the problem. You say:

Change Version: to 7.16.0
Change Release: string to 0.rhel4.local.1
Add a line near the top of the file. This makes the package relocatable.
Delete all patches except #1 and renumber it to 0.

Add what line? Seems to be missing...

Ron Parker said...

Right after the Requires: openssl line, I added a Prefix: /usr line.

Ron Parker said...

Sorry about that. Blogger converted the original text to an HTML tag that would only be seen in the page source.

Aaron Hawryluk said...

AHA!

Build works fine now, thanks!

Ron Parker said...

Glad I could help.