[squid-users] The Solution Of How to run squid with eCAP feature on windows

DongMing Huang lionxyes at gmail.com
Fri Oct 31 08:31:12 UTC 2014


Some day ago, I made it. Just share.

Ready
Step 1: Install cygwin.

    https://cygwin.com/install.html

Step 2: Get squid-3.3.3-2 src by cygwin setup-x86.exe or setup-x86_64.exe.
They are GUI package manager of cygwin.

    HDM at HDM-PC /usr/src/squid-3.3.3-2.src
    $ ls
    3.3.3-cygwin.patch squid.cygport squid-3.3.3.tar.bz2
squid-3.3.3.tar.bz2.asc

    3.3.3-cygwin.patch is used to patch squid-3.3.3-2 src.
    squid.cygprot. we will introduce it later.

Step 3: Install cygport by setup-x86.exe or setup-x86_64.exe. We will use
cygport to unpack sources, apply patches and compile squid-3.3.3.-2.
squid.cygprot tell cygport how to compile squid-3.3.3-3. Please look the
content of it.

Compile eCAP
Step 1: compile ecap-0.2.0 as before.

    HDM at HDM-PC /usr/src/ecap-0.2.0
    $ ./configure && make

Now, We get libcommon.a, libadapter.a and libhost.a

Step 2: link it by runing command as following.

    HDM at HDM-PC /usr/src/libecap-0.2.0/src/libecap
    $ g++ -shared -o cygecap.dll -Wl,--out-implib=libecap.dll.a
-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive
common/.libs/libcommon.a adapter/.libs/libadapter.a host/.libs/libhost.a
-Wl,--no-whole-archive -lstdc++ -lm -lc

    HDM at HDM-PC /usr/src/libecap-0.2.0/src/libecap
        $ ls | grep dll || a
        cygecap.dll
        libecap.dll.a

Compile Squid-3.3.3-2
Step 1: copy libecap.dll.a to /usr/lib and copy cygecap.dll to /usr/bin

    HDM at HDM-PC /usr/lib
    $ ls | grep libecap
    libecap.dll.a
    HDM at HDM-PC /usr/bin
    $ ls | grep cygecap
    cygecap.dll

Step 2: Add --enable-ecap option by editing squid.cygport file
////////////////////////squid.cygport/////////////////////////
.
.
.
src_compile() {
        cd ${S}
        ./bootstrap.sh
        lndirs
        cd ${B}
        cygconf \
          --sysconfdir=/etc/squid \
          --datadir=/usr/share/squid \
          --libexecdir=/usr/lib/squid \
          --disable-strict-error-checking \
          --with-logdir=/var/log/squid \
          --with-swapdir=/var/cache/squid \
          --with-pidfile=/var/run/squid.pid \
          --enable-ecap \
          --enable-ssl \
          --enable-esi \
          --enable-disk-io="AIO,Blocking,DiskThreads,IpcIo,Mmapped" \

--enable-auth-basic="DB,LDAP,MSNT,MSNT-multi-domain,NCSA,POP3,RADIUS,SASL,SMB,fake,getpwnam"
\
          --enable-auth-ntlm='fake,smb_lm' \
          --enable-auth-negotiate='kerberos,wrapper' \

--enable-external-acl-helpers='LDAP_group,SQL_session,eDirectory_userip,file_userip,kerberos_ldap_group,session,time_quota,unix_group,wbinfo_group'
\
          --with-filedescriptors=3072

        # FIXME: error: 'snprintf' was not declared in this scope
        for fn in `find . -name Makefile`
        do
          sed -i -e "s#c++0x#gnu++0x#" ${fn}
        done

        make
}
.
.
.
///////////////////////////////////squid.cygport////////////////////////////

Step 3: compile squid-3.3.3-2 src. Then we can get .o files.

  HDM at HDM-PC /usr/src/squid-3.3.3-2.src
  $ ls
  3.3.3-cygwin.patch squid.cygport squid-3.3.3.tar.bz2
squid-3.3.3.tar.bz2.asc squid-3.3.3-2.i686

  HDM at HDM-PC /usr/src/squid-3.3.3-2.src
  $ cygport --32 squid.cygport prep compile install

Step 4: link it by runing command as following.

  HDM at HDM-PC
/usr/src/squid-3.3.3-2.src/squid-3.3.3-2.i686/src/squid-3.3.3/src
  $ g++ -Wall -Wpointer-arith -Wwrite-strings -Wcomments -pipe -D_REENTRANT
-g -O2 -std=gnu++0x .libs/squid.exeS.o -g -o squid.exe AclRegs.o AuthReg.o
AccessLogEntry.o AsyncEngine.o YesNoNone.o cache_cf.o CacheDigest.o
cache_manager.o carp.o cbdata.o ChunkedCodingParser.o client_db.o
client_side.o client_side_reply.o client_side_request.o BodyPipe.o
clientStream.o CompletionDispatcher.o ConfigOption.o ConfigParser.o
CpuAffinity.o CpuAffinityMap.o CpuAffinitySet.o debug.o disk.o
DiskIO/DiskIOModule.o DiskIO/ReadRequest.o DiskIO/WriteRequest.o dlink.o
dns_internal.o DnsLookupDetails.o errorpage.o ETag.o event.o EventLoop.o
external_acl.o ExternalACLEntry.o FadingCounter.o fatal.o fd.o fde.o
filemap.o forward.o fqdncache.o ftp.o gopher.o helper.o HelperChildConfig.o
htcp.o http.o HttpStatusLine.o HttpHdrCc.o HttpHdrRange.o HttpHdrSc.o
HttpHdrScTarget.o HttpHdrContRange.o HttpHeader.o HttpHeaderTools.o
HttpBody.o HttpMsg.o HttpParser.o HttpReply.o RequestFlags.o HttpRequest.o
HttpRequestMethod.o icp_v2.o icp_v3.o int.o internal.o ipc.o ipcache.o
SquidList.o main.o mem.o mem_node.o MemBuf.o MemObject.o mime.o
mime_header.o multicast.o neighbors.o Packer.o Parsing.o pconn.o
peer_digest.o peer_proxy_negotiate_auth.o peer_select.o peer_sourcehash.o
peer_userhash.o redirect.o refresh.o RemovalPolicy.o send-announce.o
MemBlob.o snmp_core.o snmp_agent.o SquidMath.o SquidNew.o stat.o
StatCounters.o StatHist.o String.o StrList.o stmem.o store.o
StoreFileSystem.o store_io.o StoreIOState.o store_client.o store_digest.o
store_dir.o store_key_md5.o store_log.o store_rebuild.o store_swapin.o
store_swapmeta.o store_swapout.o StoreMeta.o StoreMetaMD5.o StoreMetaSTD.o
StoreMetaSTDLFS.o StoreMetaUnpacker.o StoreMetaURL.o StoreMetaVary.o
StoreStats.o StoreSwapLogData.o Server.o SwapDir.o MemStore.o time.o
tools.o tunnel.o unlinkd.o url.o URLScheme.o urn.o wccp.o wccp2.o whois.o
wordlist.o LoadableModule.o LoadableModules.o DiskIO/DiskIOModules_gen.o
err_type.o err_detail_type.o globals.o hier_code.o icp_opcode.o lookup_t.o
repl_modules.o swap_log_op.o DiskIO/Blocking/BlockingDiskIOModule.o
DiskIO/DiskThreads/DiskThreadsDiskIOModule.o
DiskIO/IpcIo/IpcIoDiskIOModule.o DiskIO/Mmapped/MmappedDiskIOModule.o
-Wl,--export-all-symbols auth/.libs/libacls.a ident/.libs/libident.a
acl/.libs/libacls.a acl/.libs/libstate.a auth/.libs/libauth.a libBlocking.a
libDiskThreads.a libIpcIo.a libMmapped.a acl/.libs/libapi.a
base/.libs/libbase.a ./.libs/libsquid.a ip/.libs/libip.a fs/.libs/libfs.a
ipc/.libs/libipc.a mgr/.libs/libmgr.a anyp/.libs/libanyp.a
comm/.libs/libcomm.a eui/.libs/libeui.a icmp/.libs/libicmp.a
icmp/.libs/libicmp-core.a log/.libs/liblog.a format/.libs/libformat.a
repl/liblru.a -lpthread -lcrypt adaptation/.libs/libadaptation.a
-L/usr/local/lib esi/.libs/libesi.a ../lib/libTrie/src/libTrie.a
/usr/lib/libexpat.dll.a ssl/.libs/libsslsquid.a ssl/.libs/libsslutil.a
snmp/.libs/libsnmp.a ../snmplib/libsnmplib.a
../lib/.libs/libmisccontainers.a ../lib/.libs/libmiscencoding.a
../lib/.libs/libmiscutil.a -lssl -lcrypto -L../compat -lcompat-squid -L..
/usr/lib/libltdl.dll.a /usr/lib/libecap.dll.a

  Now,we can get the new squid.exe.

  HDM at HDM-PC
/usr/src/squid-3.3.3-2.src/squid-3.3.3-2.i686/src/squid-3.3.3/src
  $ find . -name squid.exe
  ./.libs/squid.exe
  ./squid.exe

Compile ecap_adapter_sample-0.2.1
Step 1: compile ecap-0.2.0 as usually.
  HDM at HDM-PC /usr/src/ecap_adapter_sample-0.2.1
  $ ./configure && make

Step 2: link it by runing command as following.
  HDM at HDM-PC /usr/src/ecap_adapter_sample-0.2.1/src
  $ g++ -shared -o cygmodifying.dll -Wl,--out-implib=libmodifying.dll.a
-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive
adapter_modifying.o -Wl,--no-whole-archive /usr/lib/libecap.dll.a

  HDM at HDM-PC /usr/src/ecap_adapter_sample-0.2.1/src
  $ g++ -shared -o cygrecord.dll -Wl,--out-implib=librecord.dll.a
-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive
adapter_passthru.o -Wl,--no-whole-archive /usr/lib/libecap.dll.a

  HDM at HDM-PC /usr/src/ecap_adapter_sample-0.2.1/src
  $ g++ -shared -o cygminimal.dll -Wl,--out-implib=librecord.dll.a
-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive
adapter_minimal.o -Wl,--no-whole-archive /usr/lib/libecap.dll.a

Ok. It' over.

Other
As you see, we compile squid-3.3.3-2 by cygport in the above steps. We also
can compile by ourself by parsing squid.cygprot. So, we can control the
install dir option etc. Here are my method.

  HDM at HDM-PC /usr/src/squid-3.3.3-2.src/squid-3.3.3-2.i686/src/squid-3.3.3
  $ ./configure --prefix=/cygdrive/c/squid --disable-strict-error-checking
--enable-ecap --enable-ssl --enable-esi
--enable-disk-io="AIO,Blocking,DiskThreads,IpcIo,Mmapped"
--enable-auth-basic="DB,LDAP,MSNT,MSNT-multi-domain,NCSA,POP3,RADIUS,SASL,SMB,fake,getpwnam"
--enable-auth-ntlm='fake,smb_lm' --enable-auth-negotiate='kerberos,wrapper'
--enable-external-acl-helpers='LDAP_group,SQL_session,eDirectory_userip,file_userip,kerberos_ldap_group,session,time_quota,unix_group,wbinfo_group'
--with-filedescriptors=3072

  HDM at HDM-PC /usr/src/squid-3.3.3-2.src/squid-3.3.3-2.i686/src/squid-3.3.3
  $ ./test.sh

  HDM at HDM-PC /usr/src/squid-3.3.3-2.src/squid-3.3.3-2.i686/src/squid-3.3.3
  $ make && make install

  -------------------------test.sh----------------------------------------
  #!/bin/bash

  for fn in `find . -name Makefile`
  do
    sed -i -e "s#c++0x#gnu++0x#" ${fn}
  done
  -------------------------test.sh end
----------------------------------------

Morely, I write link command by myself because I don't know well about g++,
automake, autoconf. So, maybe someone else can improve it. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20141031/7490907d/attachment.html>


More information about the squid-users mailing list