Hi Eero,

Sorry about the delay.  Building clamav binaries statically is simple when 
using the new CMake build system.

And you're welcome to use ClamAV in this way but please do not distribute 
ClamAV builds in this way. This will also link the UnRAR library statically 
with libclamav. UnRAR's license is not compatible with our GPLv2 license 
because it contains a clause that says you can't reverse engineer it to create 
a RAR archiver program. For this reason, we prefer to keep 
libclamunrar+libclamunrar_iface and libclamav separate for distribution.

Use these options for the first CMake step to the clamav binaries statically:  
-D ENABLE_STATIC_LIB=ON​ -D ENABLE_SHARED_LIB=OFF​

If you need the 3rd party dependencies to be statically linked into the clamav 
binaries as well, that is only slightly more complicated.  We do it for our 
oss-fuzz integration using a dependency build automation tool we developed 
called Mussels to build all of the static dependencies.


For an example, see:

  *   
https://github.com/google/oss-fuzz/blob/master/projects/clamav/Dockerfile#L26-L31
[https://opengraph.githubassets.com/1afde33aa035f47999310d9888ba7e9881a59b552a8661a33e0e768acae74a54/google/oss-fuzz]<https://github.com/google/oss-fuzz/blob/master/projects/clamav/Dockerfile#L26-L31>
oss-fuzz/Dockerfile at master · 
google/oss-fuzz<https://github.com/google/oss-fuzz/blob/master/projects/clamav/Dockerfile#L26-L31>
OSS-Fuzz - continuous fuzzing for open source software. - oss-fuzz/Dockerfile 
at master · google/oss-fuzz
github.com



  *   
https://github.com/google/oss-fuzz/blob/master/projects/clamav/build.sh#L31-L51
[https://opengraph.githubassets.com/1afde33aa035f47999310d9888ba7e9881a59b552a8661a33e0e768acae74a54/google/oss-fuzz]<https://github.com/google/oss-fuzz/blob/master/projects/clamav/build.sh#L31-L51>
oss-fuzz/build.sh at master · 
google/oss-fuzz<https://github.com/google/oss-fuzz/blob/master/projects/clamav/build.sh#L31-L51>
OSS-Fuzz - continuous fuzzing for open source software. - oss-fuzz/build.sh at 
master · google/oss-fuzz
github.com




Regards,
Micah


Micah Snyder
ClamAV Development
Talos
Cisco Systems, Inc.
________________________________
From: clamav-users <clamav-users-boun...@lists.clamav.net> on behalf of Eero 
Volotinen <eero.voloti...@iki.fi>
Sent: Sunday, September 19, 2021 11:38 PM
To: ClamAV users ML <clamav-users@lists.clamav.net>
Subject: [clamav-users] clamav static binary

Hi All,

Is there way to build static binary for clamav?



Eero
_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml

Reply via email to