Cygwin Package Port

From miki
Jump to navigation Jump to search

This page explains how to build on Cygwin packages that are not part of the official Cygwin distribution.

Socat

Socat 1.6.0.1

A port of socat 1.6.0.1 on Cygwin is easily obtained (see [1]).

After untar & cd:

./configure
make
make install
make test

Socat 2.0.0 beta 2

!!! Interaction with McAfee Anti-Virus !!! - McAfee AV detects socat 2.0.0-b2 as a potentially unwanted program, and deletes socat.exe at first execution. To prevent this, open McAfee VirusScan ConsoleUnwanted program policyUnwanted program exclusions → click Exlusions... → click Add... → click Browse... → select 'Socat' and then click Ok. This should prevent McAfee AV to detect Socat as an unwanted program.

First install the following packages in Cygwin:

  • libwrap-devel (optional - to enable tcp wrappers)
  • readline (optional - to enable readline)
  • minires, minires-devel (optional - to enable resolver)
  • openssl-devel (optional - to enable openssl)

The following changes must be made to the build & install procedure:

  • Add LIBS="-lresolv" to configure call (note that /lib/libresolv.a is a link to /lib/libminires.dll.a on Cygwin). This is only needed if package minires-devel is installed. In that case, HAVE_RESOLV_H is defined, and without this change, we get the compilation error:
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.   -o socat socat.o libxio.a -lutil  -lssl -lcrypto -lpthread
libxio.a(xio-ip.o):xio-ip.c:(.text+0x24): undefined reference to `___res_init'
libxio.a(xio-ip.o):xio-ip.c:(.text+0x51): undefined reference to `___res_state'
...

The build & install procedure:

./configure LIBS="-lresolv"
make
make install

Note that a custom config.h and Makefile for Cygwin can also be found in the directory config/.

Tests can be run, but it needs the following changes to test.sh

--- socat-2.0.0-b2/test.sh      2008-11-16 23:33:09.312500000 +0100
+++ socat-2.0.0-b2-cygwin/test.sh       2008-11-16 23:25:21.312500000 +0100
@@ -2189,7 +2189,7 @@
 # with MacOS, this test hangs if nonblock is not used. Is an OS bug.
 tp="$td/pipe$N"
 # note: the nonblock is required by MacOS 10.1(?), otherwise it hangs (OS bug?)
-testecho "$N" "$TEST" "" "pipe:$tp,nonblock" "$opts"
+#testecho "$N" "$TEST" "" "pipe:$tp,nonblock" "$opts"
 esac
 N=$((N+1))

Apply the patch above, and run the tests:

patch -Np1 <test.sh.patch
make test