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!


Actions

Informations

3 responses to “Compiling Clamav 0.88.5 from source on OpenBSD 3.7”

18 11 2006
Chris (22:51:44) :

Hi,

I was searching for the same thing (compiling ClamAV 0.88.6 on OpenBSD 3.8) when I came across this page before yours:

http://www.idapps.com/zager/openbsd-notes.html

He uses environment variables which seems cleaner than modifying the configure script.

Here’s the configure string that I used:

env CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -lpthread" \ ./configure –sysconfdir=/etc –with-user=_clamav –with-group=_clamav –disable-cr –disable-threads

I’m using csh instead of the default ksh thus the difference in setting the environment variables. I didn’t find the "–disable-threads" option in the configure script (there is a "–disable-pthreads" option), but it still seems to work. If you use "–sysconfdir=/etc", then you don’t have to do the soft-linking.

Hope this helps someone. Thanks for your posting as well. I’m glad I’m not the only one trying to compile ClamAV on older versions of OpenBSD as well.

Chris

19 11 2006
george (13:16:43) :

Excellent! Thanks for your valuable comments Chris. They’ll certainly help me - I haven’t got round to upgrading to 0.88.6 yet.

13 01 2007
Chris (17:22:03) :

Hi,

When compiling ClamAV 0.88.7 (and perhaps higher), do not use “-disable-pthreads” or “-disable-threads” in your configure statement, otherwise clamd and clamdscan will not get compiled. (I found out the hard way.)

My new configure string is:

env CFLAGS=”-I/usr/local/include” LDFLAGS=”-L/usr/local/lib -lpthread” \
./configure –sysconfdir=/etc –with-dbdir=/var/db/clamav \
–with-user=_clamav –with-group=_clamav –disable-cr

Chris

Leave a comment

You must be logged in to post a comment