# Upgrade of Clamav is failing



## megapearl (May 8, 2014)

I'm running FreeBSD 10.0-RELEASE-p1

Update of ClamAV is failing, why?

Tried `make clean` and `make distclean`, then `make reinstall` (`make install` doesn't make any difference)*.* Tested on two FreeBSD servers, both on 10.0-RELEASE-p1, same error, same package.

Who can help me out?

Regards,
Donald.

Last couple of lines:


```
/usr/include/string.h:101:57: note: passing argument to parameter here
char    *strncpy(char * __restrict, const char * __restrict, size_t);
                                                           ^
  CC     fan.o
1 warning generated.
  CCLD   clamd
gmake[5]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3/clamd'
Making all in clamdscan
gmake[5]: Entering directory `/usr/ports/security/clamav/work/clamav-0.98.3/clamdscan'
  CC     output.o
  CC     optparser.o
  CC     misc.o
  CC     getopt.o
  CC     actions.o
  CC     clamdcom.o
  CC     clamdscan.o
../shared/clamdcom.c:42:13: warning: implicit declaration of function 'send' is invalid in C99 [-Wimplicit-function-declaration]
        int sent = send(sockd, line, len, 0);
                   ^
../shared/clamdcom.c:75:13: warning: implicit declaration of function 'recv' is invalid in C99 [-Wimplicit-function-declaration]
            s->r = recv(s->sockd, s->cur, sizeof(s->buf) - (s->cur - s->buf), 0);
                   ^
2 warnings generated.
  CC     proto.o
  CC     client.o
  CCLD   clamdscan
gmake[5]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3/clamdscan'
Making all in freshclam
gmake[5]: Entering directory `/usr/ports/security/clamav/work/clamav-0.98.3/freshclam'
  CC     output.o
  CC     optparser.o
  CC     getopt.o
  CC     misc.o
  CC     cdiff.o
  CC     tar.o
  CC     clamdcom.o
  CC     freshclam.o
../shared/clamdcom.c:42:13: warning: implicit declaration of function 'send' is invalid in C99 [-Wimplicit-function-declaration]
        int sent = send(sockd, line, len, 0);
                   ^
../shared/clamdcom.c:75:13: warning: implicit declaration of function 'recv' is invalid in C99 [-Wimplicit-function-declaration]
            s->r = recv(s->sockd, s->cur, sizeof(s->buf) - (s->cur - s->buf), 0);
                   ^
2 warnings generated.
  CC     manager.o
  CC     notify.o
  CC     dns.o
In file included from freshclam.c:57:
In file included from ../libclamav/others.h:21:
In file included from ../libclamav/matcher.h:28:
../libclamav/others.h:154:5: error: unknown type name 'stats_section_t'
    stats_section_t *sections;
    ^
  CC     execute.o
../libclamav/others.h:323:5: error: unknown type name 'clcb_stats_add_sample'
    clcb_stats_add_sample cb_stats_add_sample;
    ^
  CC     nonblock.o
  CC     mirman.o
../libclamav/others.h:324:5: error: unknown type name 'clcb_stats_remove_sample'
    clcb_stats_remove_sample cb_stats_remove_sample;
    ^
../libclamav/others.h:325:5: error: unknown type name 'clcb_stats_decrement_count'
    clcb_stats_decrement_count cb_stats_decrement_count;
    ^
../libclamav/others.h:326:5: error: unknown type name 'clcb_stats_submit'
    clcb_stats_submit cb_stats_submit;
    ^
../libclamav/others.h:327:5: error: unknown type name 'clcb_stats_flush'
    clcb_stats_flush cb_stats_flush;
    ^
../libclamav/others.h:328:5: error: unknown type name 'clcb_stats_get_num'
    clcb_stats_get_num cb_stats_get_num;
    ^
../libclamav/others.h:329:5: error: unknown type name 'clcb_stats_get_size'
    clcb_stats_get_size cb_stats_get_size;
    ^
../libclamav/others.h:330:5: error: unknown type name 'clcb_stats_get_hostid'
    clcb_stats_get_hostid cb_stats_get_hostid;
    ^
../libclamav/others.h:380:5: error: unknown type name 'clcb_stats_add_sample'
    clcb_stats_add_sample cb_stats_add_sample;
    ^
../libclamav/others.h:381:5: error: unknown type name 'clcb_stats_remove_sample'
    clcb_stats_remove_sample cb_stats_remove_sample;
    ^
../libclamav/others.h:382:5: error: unknown type name 'clcb_stats_decrement_count'
    clcb_stats_decrement_count cb_stats_decrement_count;
    ^
../libclamav/others.h:383:5: error: unknown type name 'clcb_stats_submit'
    clcb_stats_submit cb_stats_submit;
    ^
../libclamav/others.h:384:5: error: unknown type name 'clcb_stats_flush'
    clcb_stats_flush cb_stats_flush;
    ^
../libclamav/others.h:385:5: error: unknown type name 'clcb_stats_get_num'
    clcb_stats_get_num cb_stats_get_num;
    ^
../libclamav/others.h:386:5: error: unknown type name 'clcb_stats_get_size'
    clcb_stats_get_size cb_stats_get_size;
    ^
../libclamav/others.h:387:5: error: unknown type name 'clcb_stats_get_hostid'
    clcb_stats_get_hostid cb_stats_get_hostid;
    ^
freshclam.c:762:5: warning: implicit declaration of function 'cl_engine_stats_enable' is invalid in C99 [-Wimplicit-function-declaration]
    cl_engine_stats_enable(engine);
    ^
freshclam.c:781:9: warning: implicit declaration of function 'cl_engine_set_clcb_stats_get_hostid' is invalid in C99 [-Wimplicit-function-declaration]
        cl_engine_set_clcb_stats_get_hostid(engine, NULL);
        ^
freshclam.c:786:35: error: use of undeclared identifier 'CL_ENGINE_STATS_TIMEOUT'; did you mean 'CL_ENGINE_BYTECODE_TIMEOUT'?
        cl_engine_set_num(engine, CL_ENGINE_STATS_TIMEOUT, optget(opts, "StatsTimeout")->numarg);
                                  ^~~~~~~~~~~~~~~~~~~~~~~
                                  CL_ENGINE_BYTECODE_TIMEOUT
/usr/local/include/clamav.h:192:5: note: 'CL_ENGINE_BYTECODE_TIMEOUT' declared here
    CL_ENGINE_BYTECODE_TIMEOUT,     /* uint32_t */
    ^
2 warnings and 18 errors generated.
gmake[5]: *** [freshclam.o] Error 1
gmake[5]: *** Waiting for unfinished jobs....
gmake[5]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3/freshclam'
gmake[4]: *** [all-recursive] Error 1
gmake[4]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3'
gmake[3]: *** [all] Error 2
gmake[3]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/security/clamav
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/security/clamav
*** Error code 1

Stop.
make: stopped in /usr/ports/security/clamav
root@backup:/usr/ports/security/clamav #
```


----------



## trh411 (May 8, 2014)

I just successfully installed security/clamav on a FreeBSD-10.0-RELEASE-p1 amd64 VM. Are you amd64 or i386? Looks like you got the latest update that hit the ports collection this morning for version  0.98.3, so no problem there.

Please show the entire contents of /etc/make.conf. If you have any CFLAGS/CXXFLAGS statements in your /etc/make.conf file, comment them out and re-try the installation.


----------



## megapearl (May 8, 2014)

It's amd64*.*


```
CPUTYPE=core2
CFLAGS=-O2 -pipe -fno-strict-aliasing
COPTFLAGS=-O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF=FILESERVER
OPTIMIZED_CFLAGS=YES
WITHOUT_X11=YES
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
WITH_OPTIMIZED_CFLAGS=YES
WITHOUT_DEBUG=YES
BUILD_STATIC=YES
NO_PROFILE=YES
#NO_INET6=YES
WITH_PKGNG=yes
#WRKDIRPREFIX=/usr/ports
#DISTDIR=/usr/ports/distfiles
#PACKAGES=/usr/ports/packages
#PERL_VERSION=5.18
DEFAULT_VERSIONS=perl5=5.18
DEFAULT_VERSIONS=php=55
```

Trying without CFLAGS now. Update: doesn't make any difference:


```
CPUTYPE=core2
#CFLAGS=-O2 -pipe -fno-strict-aliasing
#COPTFLAGS=-O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF=FILESERVER
#OPTIMIZED_CFLAGS=YES
WITHOUT_X11=YES
#BUILD_OPTIMIZED=YES
#WITH_CPUFLAGS=YES
#WITH_OPTIMIZED_CFLAGS=YES
WITHOUT_DEBUG=YES
BUILD_STATIC=YES
NO_PROFILE=YES
#NO_INET6=YES
WITH_PKGNG=yes
#WRKDIRPREFIX=/usr/ports
#DISTDIR=/usr/ports/distfiles
#PACKAGES=/usr/ports/packages
#PERL_VERSION=5.18
DEFAULT_VERSIONS=perl5=5.18
DEFAULT_VERSIONS=php=55
```

Trying without make.conf now. Still no luck, even without make.conf it's giving the 
	
	



```
CL_ENGINE_BYTECODE_TIMEOUT
```
 error (in color green)*.*


----------



## trh411 (May 8, 2014)

Are you taking all the default options for installation? I'm trying to narrow down why the installation of security/clamav works for me on the same platform, but not for you. Taking different installation options may explain it.


----------



## megapearl (May 8, 2014)

I don't know:
I have the following options checked:

```
ARC
ARJ
DMG_XAR
IPV6
LHA
LLVM
TESTS
UNRAR
UNZOO
```


----------



## trh411 (May 9, 2014)

Those are all the default options that I installed with as well, so that does not explain the error you are getting.


----------



## trh411 (May 9, 2014)

Okay, here is what I found through a bit of experimentation:

If security/clamav is not already installed

`make install` *works*
If security/clamav is already installed

`make install` *fails*
`make deinstall clean` followed by `make reinstall clean` *works*
`make deinstall clean` followed by `make install clean` *works*
at least for me.

EDIT: My findings would seem to be corroborated by Re: Unable to update to clamav 0.98.3 which I just happened upon.


----------



## megapearl (May 9, 2014)

That does work for me also:


```
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
===>  Installing for clamav-0.98.3
===>   Registering installation for clamav-0.98.3
Installing clamav-0.98.3... done
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/clamd

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/clamav-freshclam
/usr/local/etc/rc.d/clamav-clamd

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.clamav.net/
root@backup:/usr/ports/security/clamav #
```

I normally never run `make deinstall`, because if it doesn't compile I can get a broken system.

But this one works for me, topic can be closed.
Thanks for your help and support.


----------



## wblock@ (May 9, 2014)

megapearl said:
			
		

> I normally never run `make deinstall`, because if it doesn't compile I can get a broken system.



Don't run that until after building the new version.  So do `make build` (or just `make`, build is the default target).  After that succeeds, use `make deinstall` to get rid of the old version, then `make install` to install the new one.


----------



## HL1234 (May 9, 2014)

*F*or me too. I would like to update to ClamAV 0.98.3 over the ports but it breaks whatever I did. *T*hanks @trh411!

I `make` first in security/clamav `deinstall clean` and then `make reinstall` and suddenly it works, compile and install.

Normally I would prefer what @wblock@ wrote:


> never run `make deinstall`, before make works, because if it doesn't compile I can get a broken system.


Mostly I do no more follow the overall found written: "got to /usr/ports/pppp/xyz && `make install clean`".

Much better is to:
`cd /usr/ports/pppp/xyz`
`make config`
`make fetch-recursive`   #here somtimes it gives me a warning that my changed configuration can not work
`make [build]`
`make install`
and at the end, if all works 
`make clean`


----------



## kpa (May 9, 2014)

The port doesn't even build in a package builder in a clean environment when some extra QA tests are used.


```
===========================================================================
====> Running Q/A tests (stage-qa)
Warning: .la libraries found, port needs USES=libtool
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for directories owned by MTREEs
Error: Owned by MTREE: @unexec rmdir "/prefix/%%CLAMAVUSER%%-0.98.3" >/dev/null 2>&1 || :
===> Checking for directories handled by dependencies
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
===> Warning: Test was done with PREFIX != LOCALBASE
===> Warning: The port may not be properly installing into PREFIX
*** Error code 1

Stop.
make: stopped in /usr/ports/security/clamav
====>> Error: check-plist failures detected
build of /usr/ports/security/clamav ended at Fri May  9 18:43:18 EEST 2014
build time: 00:14:26
!!! build failure encountered !!!
====>> Error: Build failed in phase: check-plist
```

Looks like something is badly broken with this port.

Edit: It probably does build when built in clean environment but I'm using `poudriere testport` above that turns on some extra QA tests that are failing.


----------



## allank (May 9, 2014)

I'm running FreeBSD84-p9 i386 and I can't get this port to build either.  I have a different error when building the freshclam portion. Any ideas?


```
Making all in freshclam
gmake[2]: Entering directory `/usr/ports/security/clamav/work/clamav-0.98.3/freshclam'
  CC     freshclam.o
In file included from ../libclamav/matcher.h:28,
                 from ../libclamav/others.h:21,
                 from freshclam.c:57:
../libclamav/others.h:154: error: expected specifier-qualifier-list before 'stats_section_t'
../libclamav/others.h:323: error: expected specifier-qualifier-list before 'clcb_stats_add_sample'
../libclamav/others.h:380: error: expected specifier-qualifier-list before 'clcb_stats_add_sample'
freshclam.c: In function 'submit_host_info':
freshclam.c:766: error: 'struct cl_engine' has no member named 'cb_stats_submit'
freshclam.c:773: error: 'struct cl_engine' has no member named 'cb_stats_submit'
freshclam.c:786: error: 'CL_ENGINE_STATS_TIMEOUT' undeclared (first use in this function)
freshclam.c:786: error: (Each undeclared identifier is reported only once
freshclam.c:786: error: for each function it appears in.)
gmake[2]: *** [freshclam.o] Error 1
gmake[2]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3/freshclam'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/ports/security/clamav/work/clamav-0.98.3'
gmake: *** [all] Error 2
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop in /usr/ports/security/clamav.
*** Error code 1

Stop in /usr/ports/security/clamav.
```


----------



## Anonymous (May 9, 2014)

Delete the port and fetch it complete new. 
Some libraries are merged in the last time, make a `pkg_libchk` (from sysutils/bsdadminscripts). 
Last possibility ist  `pkg install clamav`.
Some ports who fails to compile or reinstall, compile or reinstall well after `pkg install`.


----------



## trh411 (May 9, 2014)

allank said:
			
		

> I'm running FreeBSD84-p9 i386 and I can't get this port to build either.  I have a different error when building the freshclam portion. Any ideas?


If you are updating an existing installation of security/clamav, try the following:

```
cd /usr/ports/security/clamav
make deinstall clean
make install clean
```


----------



## allank (May 9, 2014)

Deleting the current clamav package and reinstalling it did the trick. Thanks!


----------



## xy16644 (May 11, 2014)

I seem to be having an issue updating security/clamav-milter:


```
2 warnings and 18 errors generated.
gmake[4]: *** [freshclam.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[4]: Leaving directory `/usr/ports/security/clamav-milter/work/clamav-0.98.3/freshclam'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/usr/ports/security/clamav-milter/work/clamav-0.98.3'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/usr/ports/security/clamav-milter/work/clamav-0.98.3'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
Stop.
make[1]: stopped in /usr/ports/security/clamav-milter
*** Error code 1
```

When I tried to run:


```
cd /usr/ports/security/clamav
make deinstall clean
make install clean
```

It said that clamav wasn't installed! If I run `clamd -V` I get:


```
ClamAV 0.98.1/18963/Sun May 11 04:09:10 2014
```

So how can I update security/clamav-milter?


----------



## trh411 (May 11, 2014)

xy16644 said:
			
		

> I seem to be having an issue updating security/clamav-milter:
> 
> ```
> 2 warnings and 18 errors generated.
> ...


This does not show any of errors. They are all above this in the log.


			
				xy16644 said:
			
		

> When I tried to run:
> 
> ```
> cd /usr/ports/security/clamav
> ...


Why are you deinstalling/reinstalling security/clamav if you are trying to upgrade security/clamav-milter? If you try instead:

```
cd /usr/ports/security/clamav-milter
make deinstall clean
make install clean
```
does it work?


----------



## xy16644 (May 11, 2014)

That did it, port upgraded!


----------



## tytus (May 21, 2014)

trh411 said:
			
		

> If you are updating an existing installation of security/clamav, try the following:
> 
> ```
> cd /usr/ports/security/clamav
> ...



This is the best solution, thanks!

maciek


----------

