Compiling Clamav 0.88.5 from source on OpenBSD 3.7

28 10 2006

Fed up with getting messages from freshclam saying my clamav installation was out of date, and reluctant to update one of my OpenBSD installations to latest release, I set about trying to figure out how to compile clamav from source.

I started by downloading the latest stable source from www.clamav.net (0.88.5) and tried a simple

./configure
make

I was under no illusions that this would probably fail and it did:

...
/usr/local/lib/libclamav.so.1.17: undefined reference to `pthread_mutex_lock'
/usr/local/lib/libclamav.so.1.17: undefined reference to `pthread_join'
collect2: ld returned 1 exit status

Much google-ing later I was still having no luck … I tried a number of different ./configure arguments which I found in my ports tree at /usr/ports/security/clamav/Makefile until I found this thread started by Charles Farinella on the OpenBSD Misc List

I followed the instructions in this thread to the letter; found the block of text in the configure script:

openbsd*)
    if test "$have_pthreads" = "yes"; then
	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
	if test "$use_cr" = "no"; then
	    CLAMD_LIBS="$CLAMD_LIBS -pthread"
	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
	else
	    CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
	fi
	TH_SAFE="-thread-safe"

and changed LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread" to LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
did a

./configure --disable-cr --disable-clamav
make
make install

and WOO-HOO all was good!!!

Just a couple of things, After installation I tried a freshclam and it complained that I should edit /usr/local/etc/clamd|freshclam.conf files - these are usually kept in /etc not /usr/local/etc so I cd’d to /usr/local/etc renamed the conf files and soft linked the files in /etc to /usr/local/etc and voilla!



Updating The ClamAV Daemon on OpenBSD 3.7

25 10 2006

Introduction

This post is now pretty pointless. The OpenBSD 3.7 ports tree is no longer maintained so you’ll only get up to clamav 0.88.3 (I think). Take a look at this post on compiling clamav from source.

This reference document describes the process for updating
ClamAV on OpenBSD 3.7 Release via the ports system.

Requirements

  • OpenBSD 3.7 Release (Although these intuctions will work on
    any version of OpenBSD with a little alteration)
  • A local copy of the OpenBSD Ports tree
  • This document assumes you already have a working (But out of date) copy of ClamAV installed.

Instructions

I use tcsh for my shell so you may need to alter the syntax for setting the
CVSROOT environment variable:

Update the Ports tree

Make sure you pick a cvs mirror close to you.

host: su
root# tcsh
root# setenv CVSROOT anoncvs@anoncvs.de.openbsd.org:/cvs
root# cd /usr/ports
root# cvs -q up -rOPENBSD_3_7 -Pd

Find and remove the clamav package

root# kill -s QUIT `cat /path/to/clamd.pid`
root# pkg_info -a | grep clamav
clamav-0.88.2       free virus scanner
root# pkg_delete clamav-0.88.2

Make and install the updated package and start the ClamAV daemon

root# cd /usr/ports/security/clamav
root# make install
(… Screenfulls of output ….)
root# freshclam
root# /usr/local/sbin/clamd