# Varnish4 not building?



## PeterSprague (Mar 5, 2015)

Varnish4 is not building.

Get error when run `make`

```
===>  License BSD2CLAUSE accepted by the user
===>  varnish4-4.0.3_1 depends on file: /usr/local/sbin/pkg - found
=> varnish-4.0.3.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch http://repo.varnish-cache.org/source/varnish-4.0.3.tar.gz
varnish-4.0.3.tar.gz  100% of 1823 kB  273 kBps 00m06s
===> Fetching all distfiles required by varnish4-4.0.3_1 for building
===>  Extracting for varnish4-4.0.3_1
=> SHA256 Checksum OK for varnish-4.0.3.tar.gz.
===>  Patching for varnish4-4.0.3_1
===>  Applying extra patch /usr/ports/www/varnish4/files/bug-1201.patch
1 out of 1 hunks failed--saving rejects to bin/varnishtest/tests/r01109.vtc.rej
*** [do-patch] Error code 1

Stop in /usr/ports/www/varnish4.
```

On up to date Freebsd FreeBSD 9.3 with `portsnap fetch update` from this morning.

Have others had an issue with the Varnish4 port? Any suggestions for a fix?

Peter


----------



## julp (Mar 5, 2015)

Try to remove or comment the line EXTRA_PATCHES+= ${FILESDIR}/bug-1201.patch in /usr/ports/www/varnish4/Makefile and rerun `make install`.

This Varnish issue is fixed since a while so this patch should be no longer needed.

(only i386 systems are affected here)


----------



## PeterSprague (Mar 5, 2015)

Thanks.  Done and built.  

Should the maintainer be notified?


----------



## PeterSprague (Mar 5, 2015)

Built, but varnish/default.vlc config file is not added to any usual suspect directories.  Would have thought /usr/local/etc/varnish/.. would the default location.


----------



## julp (Mar 6, 2015)

By default, varnishd rc.d script, use buitin/default VCL configuration. To use your own, define `varnishd_config="/usr/local/etc/varnish.vcl"` (for example) in /etc/rc.conf.

To write your own configuration starting from builtin VCL, `cp /usr/ports/www/varnish4/work/varnish-4.0.3/bin/varnishd/builtin.vcl /usr/local/etc/varnish.vcl` should work (not tested). (if you have previously run `make clean`, don't forget to run `make -C /usr/ports/www/varnish4 extract` first)


----------



## PeterSprague (Mar 8, 2015)

Thanks.

My case was a bit more involved due to installing to an ezjail:

In host, cd /usr/ports/www/varnish4 -> make
as above, cp work/varnish-4.0.3/bin/varnishd/builtin.vcl /usr/jails/J1/usr/local/etc/varnish/
in J1, etc/rc.conf

varnishd_enable="YES"
varnishd_listen=":80"
varnishd_config="/usr/local/etc/varnish/builtin.vcl"
varnishd_storage="malloc,4G"
varnishd_admin=":6082
[http://bin63.com/how-to-install-varnish-cache-on-freebsd]

Added my backend config to builtin.vcl.  This seems counter-intuitive to me.  Would prefer my config would be in a separate file and use an "include" statement to pull into vlc compiler.


----------

