Migration to Cygwin plataform

Jorge Díaz jdzstz at gmail.com
Wed Jul 21 00:23:27 CEST 2010


It will be nice to support Varnish in Cygwin plataform (
http://www.cygwin.com <http://www.cygwin.com/>)
I have opened a ticket in http://varnish-cache.org/ticket/736


After weeks making some tests I was able to build successful Varnish in
Cygwin, the problems that I have found are:

1) Cygwin doesn't support CLOCK_MONOTONIC but HAVE_CLOCK_GETTIME is defined

 2) RTLD_LOCAL is not defined in dlfcn.h headers

 3) madvise function and MADV_RANDOM define does not exists, in Cygwin their
correct names are posix_madvise and POSIX_MADV_RANDOM

 4) In Cygwin SO_RCVTIMEO_WORKS and SO_SNDTIMEO_WORKS doesn't work properly
because in Windows setsockopt/getsockopt expects time-out in "int"
milliseconds instead of "struct timeval" (in future, i think it could be
fixed)

 5) Linkage problems ("Undefined reference" errors). The undefined reference
is because fundamentally ELF (UNIX) and PE/COFF (Windows) are very different
in terms of how linking works under the hood. The short explanation is that
PE/COFF requires all references to be resolved at link-time:


   -  http://www.cygwin.com/ml/cygwin/2006-12/msg00592.html<http://www.cygwin.com/ml/cygwin/2006-12/msg00592.html>
   -  http://www.cygwin.com/ml/cygwin/2005-07/msg00675.html<http://www.cygwin.com/ml/cygwin/2005-07/msg00675.html>
   -  http://www.mail-archive.com/cygwin@cygwin.com/msg81837.html<http://www.mail-archive.com/cygwin@cygwin.com/msg81837.html>

 6) VCL compilation problems ("Undefined reference" errors). VCL compiled
DLL uses simbols from EXE. It is necesary to create a fake import file from
EXE to allow compilation.

I have solved all problems modifing source code and automake scripts. I
attach all modification to this ticket.

It is also necessary to execute varnishd with cc_command parameter in order
to compile VCL correctly:

-p cc_command='cc -shared
/tmp/varnish-2.1.2/bin/varnishd/varnishd-cache_vrt.o
/tmp/varnish-2.1.2/bin/varnishd/varnishd-cache_backend_cfg.o
-L/usr/local/lib -L/tmp/varnish-2.1.2/bin/varnishd/ -lvarnish -lvarnishd
-Wl,--export-all-symbols -Wl,-x -o %o %s'

I have tested varnish and works OK.

I think it will be interesting to add this information to wiki:

   -  http://www.varnish-cache.org/wiki/Installation<http://www.varnish-cache.org/wiki/Installation>


I have worked with varnish 2.1.2 version, I don't know if there is any
change in trunk.

The modifications works OK in SOLARIS and CYGWIN platforms, I need somebody
to test in Linux.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20100721/b22f4816/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin_changes.zip
Type: application/zip
Size: 12063 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20100721/b22f4816/attachment-0003.zip>


More information about the varnish-dev mailing list