Re: [Clamav-devel] [Clamav] Cannot dlopen: file not found - …

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ladar Levison
Date:  
To: ClamAV Development
Subject: Re: [Clamav-devel] [Clamav] Cannot dlopen: file not found - unrar support unavailable
nicolas dumont wrote:
> Hello,
>
> I am using clamav-0.95 with my own daemon that use libclamav
>
> During the initialization I have the message :
> LibClamAV Warning: Cannot dlopen: file not found - unrar support unavailable
>
> I would like to link my daemon with the libclamunrar_iface.a and libclamunrar.a
> in order to have all libraries inside my binary.
>
> Is there a way in my Makefile or elsewhere to have the libclamunrar
> directly called
> inside my binary without modifying the call to
> lt_dlopenext("libclamunrar_iface") ?
>
> Best regards,
> Nicolas Dumont.
>


Hi Nicholas,

I am also compiling ClamAV into a library and opening it with a dlopen()
call. The technique I use is:

/configure
make

I then merge together the different ClamAV libs using this command:

ld -shared -o clamav.lib clamav-0.94.2/libclamav/.libs/libclamav.a
clamav-0.94.2/libclamunrar_iface/.libs/libclamunrar_iface.a
clamav-0.94.2/libclamunrar/.libs/libclamunrar.a -lbz2 -lgmp -lpthread -lz

Which creates a file called clamav.lib that can be passed to dlopen().

There are a couple of notes. Which libraries you dynamically link
against when using ld will vary depending on your platform and how
ClamAV configures itself. For example, on my system I don't actually
link against pthread specifically because I know the program I'm using
is already linked against the pthread library. On Cent OS 4/Red Hat
Enterprise 4 specifically, I need to pass the --disable-zlib-vcheck
parameter to configure and I need to manually edit the libclamav
makefiles to pass -O1 instead of -O2 to gcc or all of the free() calls
will be optimized away inside the cl_free() function. See this bug for
details:

https://bugzilla.redhat.com/show_bug.cgi?id=490253

If anyone knows of a better way to do this, or finds any problems with
using ClamAV this way, please let me know...

Ladar


_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net