in Perl

more Perl aggravation…

For some time I’ve been trying to get amavisd-new to play nicely with ClamAV using Mail::ClamAV under FreeBSD. It just would not behave – I would get an error like /usr/local/lib/libclamav.so.1: undefined reference to pthread_mutex_create() and fall over. (This error message would only appear if amavisd-new was being run in debug mode; otherwise, mail would just silently fail to be delivered and queue forever.)

Well, I finally discovered the problem: Perl is not built multithreaded by default on FreeBSD! 🙁 You have to build Perl, defining WITH_THREADS and this will work.

Obviously this isn’t apparent from the above error message. It looks like ClamAV is the culprit, rather than the ClamAV.so that’s built by Mail::ClamAV. I guess it’s just because in the course of using the ClamAV API, libclamav.so.1 is the caller, so the runtime link problem is wrongly attributed to it.