# installing c-icap from ports vs source file



## abyz (Apr 7, 2013)

Hi,

I'm trying to install c-icap *o*n my freebsd FreeBSD 8.1 box. For the record, I've update*d* my port*s* tree to its latest version. I compiled and then installed my port. When the c-icap server was running I coul*d*n't get any answers from the server using a c-icap client. I deinstalled the pack*a*ge and removed configuration files from /usr/local/etc. This time I've compiled from the source file that I've downloaded from sf.net and then installed it and it works.

I also tried to update the port version from 0.2.3 to 0.2.4 by changing Makefiles. *T*he new port is also not working.

I don't have any clue about the reason but I think the configuration file in /usr/local/etc is the source of problem.

If you have any clue please help me.


----------



## SirDice (Apr 8, 2013)

abyz said:
			
		

> I'm trying to install c-icap *o*n my freebsd FreeBSD 8.1 box.


FreeBSD 8.1 has been end-of-life since July 2012. Please upgrade to at least 8.3.

http://www.freebsd.org/security/#unsup


----------



## abyz (Apr 8, 2013)

Thanks for your repl*y*.

The reason I use FreeBSD 8.1 is to make a binary package that can be installed on my router which runs pfSense 2.0.1. Regarding to their guide about adding a new ports to the pfSense, the port (www/c-icap) must be compiled and the package must be created using the proper version of FreeBSD which is 8.1.

I'll try to make the binary package using FreeBSD 8.3 and install it on my router and see if there is anything that must be asked or not. As far as I remember, I've installed some binaries from FreeBSD 8.3 on my pfSense box without any issues.

Thanks.


----------



## kpa (Apr 8, 2013)

Binary packages from 8.3 should work in general on 8.1. There are some rare exceptions like sysutils/lsof that uses special knowledge of some kernel data structures that can change from version to version.


----------



## DutchDaemon (Apr 8, 2013)

Yes, other than ports requiring specific kernel code or creating a KLD (like the Nvidia drivers), you'll generally get working ports/packages throughout FreeBSD 8.x.


----------



## abyz (Apr 8, 2013)

Thanks for your repl*ie*s.

As you mentioned the port which is created in FreeBSD 8.3 is working on pfSense without any problem. But the problem with www/c-icap is not the configuration but the core of www/c-icap. After running c-icap in debug mode for dozens of times, I find out that the main problem is the IPC implementation in Unix. I found this Wiki article that says 





> In UNIX, c-icap has been implemented by using POSIX threads, an IPC shared memory, and an IPC locking mechanism. However, there exists a less tested implementation, which uses POSIX semaphores and a file-locking mechanism for cross-locking between child processes and POSIX memory-mapped files for shared memory.
> 
> The server operates well, but there still exist some open issues:
> 
> ...


. After updating c-icap source from 0.2.3 to 0.2.5 which I have downloaded from sf.net it seems the issues have been resolved.


----------



## Lonney (Apr 26, 2013)

*ICAP protocol error*

I'm having a similar problem using squid32, clamav, squidclamav 6.10, and c-icap - all installed from ports on a fresh FreeBSD 9.1 installation.

Ports installed and updated using:
`portsnap fetch`
`portsnap extract`
`portsnap update`

I can*'*t get icap to work.

`# /usr/local/bin/c-icap-client`

```
Error connecting to socket (host: *beep*Ã™Ã¿Ã¿) .....
Failed to connect to icap server.....
```

Nothing useful is logged in icap's logs- even with debug set to 10, no errors are given when starting the daemon.

Squid gives this error in the web browser:


```
ICAP protocol error.

The system returned: [No Error]
This means that some aspect of the ICAP communication failed.
Some possible problems are:
    The ICAP server is not reachable.
    An Illegal response was received from the ICAP server.
```

Squid's cache.log offers:


```
essential ICAP service is down after an options fetch failure: icap://127.0.0.1:1344/squidclamav [down,!opt]
```

`sockstat -4` does not show anything listening on 1344. If I try and telnet 127.0.0.1 1344 I get connection refused.

I have the same versions Squid and squidclamav running successfully on Debian. I have used the default configuration files as installed on FreeBSD - and only modified them where needed. Carefully double checked, can*'*t see any errors on my part. Squid works ok by itself.

I'm at a loss as to what I can try next..

Any suggestions welcome!


----------



## Lonney (Apr 26, 2013)

*[Solved] ICAP protocol error*

c-icap was only listening on IPv6, I guess because I accepted the default option of having IPv6 support.


```
/usr/local/etc/rc.d/c-icap stop
cd /usr/ports/www/c-icap
make deinstall
make rmconfig
make install clean # deselect IPv6 support when prompted
/usr/local/etc/rc.d/c-icap start
```

Works as expected.


----------



## abyz (Apr 26, 2013)

As far as I remember, I had the same problem with IPv6 in my installation, but I also have the problem with POSIX IPC (I have updated the source code of www/c-icap). 

I will test the original www/c-icap to see if it is working (without IPv6 support) in the first place or not.


----------

