|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/share/doc/squid-2.5.STABLE14/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
<TITLE>SQUID Frequently Asked Questions: Getting and Compiling Squid</TITLE>
<LINK HREF="FAQ-3.html" REL=next>
<LINK HREF="FAQ-1.html" REL=previous>
<LINK HREF="FAQ.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="FAQ-3.html">Next</A>
<A HREF="FAQ-1.html">Previous</A>
<A HREF="FAQ.html#toc2">Contents</A>
<HR>
<H2><A NAME="compiling"></A> <A NAME="s2">2.</A> <A HREF="FAQ.html#toc2">Getting and Compiling Squid</A></H2>
<H2><A NAME="ss2.1">2.1</A> <A HREF="FAQ.html#toc2.1">Which file do I download to get Squid?</A>
</H2>
<P>You must download a source archive file of the form
squid-x.y.z-src.tar.gz (eg, squid-1.1.6-src.tar.gz) from
<A HREF="http://www.squid-cache.org/">the Squid home page</A>, or.
<A HREF="ftp://www.squid-cache.org/pub/">the Squid FTP site</A>.
Context diffs are available for upgrading to new versions.
These can be applied with the <EM>patch</EM> program (available from
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">the GNU FTP site</A>).</P>
<H2><A NAME="ss2.2">2.2</A> <A HREF="FAQ.html#toc2.2">How do I compile Squid?</A>
</H2>
<P>For <B>Squid-1.0</B> and <B>Squid-1.1</B> versions, you can just
type <EM>make</EM> from the top-level directory after unpacking
the source files. For example:
<PRE>
% tar xzf squid-1.1.21-src.tar.gz
% cd squid-1.1.21
% make
</PRE>
</P>
<P>For <B>Squid-2</B> you must run the <EM>configure</EM> script yourself
before running <EM>make</EM>:
<PRE>
% tar xzf squid-2.0.RELEASE-src.tar.gz
% cd squid-2.0.RELEASE
% ./configure
% make
</PRE>
</P>
<H2><A NAME="ss2.3">2.3</A> <A HREF="FAQ.html#toc2.3">What kind of compiler do I need?</A>
</H2>
<P>To compile Squid, you will need an ANSI C compiler. Almost all
modern Unix systems come with pre-installed compilers which work
just fine. The old <EM>SunOS</EM> compilers do not have support for ANSI
C, and the Sun compiler for <EM>Solaris</EM> is a product which
must be purchased separately.</P>
<P>If you are uncertain about your system's C compiler, The GNU C compiler is
available at
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">the GNU FTP site</A>.
In addition to gcc, you may also want or need to install the <EM>binutils</EM>
package.</P>
<H2><A NAME="ss2.4">2.4</A> <A HREF="FAQ.html#toc2.4">What else do I need to compile Squid?</A>
</H2>
<P>You will need
<A HREF="http://www.perl.com/">Perl</A> installed
on your system.</P>
<H2><A NAME="ss2.5">2.5</A> <A HREF="FAQ.html#toc2.5">Do you have pre-compiled binaries available?</A>
</H2>
<P>The developers do not have the resources to make pre-compiled
binaries available. Instead, we invest effort into making
the source code very portable. Some people have made
binary packages available. Please see our
<A HREF="http://www.squid-cache.org/platforms.html">Platforms Page</A>.</P>
<P>The
<A HREF="http://freeware.sgi.com/">SGI Freeware</A> site
has pre-compiled packages for SGI IRIX.</P>
<P>
Squid binaries for
<A HREF="http://www.freebsd.org/cgi/ports.cgi?query=squid-2&stype=all">FreeBSD on Alpha and Intel</A>.</P>
<P>Squid binaries for
<A HREF="ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/www/squid/README.html">NetBSD on everything</A></P>
<P>Gurkan Sengun has some
<A HREF="http://www.linuks.mine.nu/solaris/">Sparc/Solaris packages</A>
available.</P>
<H2><A NAME="ss2.6">2.6</A> <A HREF="FAQ.html#toc2.6">How do I apply a patch or a diff?</A>
</H2>
<P>You need the <CODE>patch</CODE> program. You should probably duplicate the
entire directory structure before applying the patch. For example, if
you are upgrading from squid-1.1.10 to 1.1.11, you would run
these commands:
<PRE>
cd squid-1.1.10
mkdir ../squid-1.1.11
find . -depth -print | cpio -pdv ../squid-1.1.11
cd ../squid-1.1.11
patch < /tmp/diff-1.1.10-1.1.11
</PRE>
After the patch has been applied, you must rebuild Squid from the
very beginning, i.e.:
<PRE>
make realclean
./configure
make
make install
</PRE>
Note, In later distributions (Squid 2), 'realclean' has been changed
to 'distclean'.</P>
<P>If patch keeps asking for a file name, try adding ``-p0'':
<PRE>
patch -p0 < filename
</PRE>
</P>
<P>If your <CODE>patch</CODE> program seems to complain or refuses to work,
you should get a more recent version, from the
<A HREF="ftp://ftp.gnu.ai.mit.edu/pub/gnu/">GNU FTP site</A>, for example.</P>
<H2><A NAME="ss2.7">2.7</A> <A HREF="FAQ.html#toc2.7"><EM>configure</EM> options</A>
</H2>
<P>The configure script can take numerous options. The most
useful is <CODE>--prefix</CODE> to install it in a different directory.
The default installation directory is <EM>/usr/local/squid/</EM>. To
change the default, you could do:
<PRE>
% cd squid-x.y.z
% ./configure --prefix=/some/other/directory/squid
</PRE>
</P>
<P>Type
<PRE>
% ./configure --help
</PRE>
to see all available options. You will need to specify some
of these options to enable or disable certain features.
Some options which are used often include:</P>
<P>
<PRE>
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/squid]
--enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea
--enable-gnuregex Compile GNUregex
--enable-splaytree Use SPLAY trees to store ACL lists
--enable-xmalloc-debug Do some simple malloc debugging
--enable-xmalloc-debug-trace
Detailed trace of memory allocations
--enable-xmalloc-statistics
Show malloc statistics in status page
--enable-carp Enable CARP support
--enable-async-io Do ASYNC disk I/O using threads
--enable-icmp Enable ICMP pinging
--enable-delay-pools Enable delay pools to limit bandwith usage
--enable-mem-gen-trace Do trace of memory stuff
--enable-useragent-log Enable logging of User-Agent header
--enable-kill-parent-hack
Kill parent on shutdown
--enable-snmp Enable SNMP monitoring
--enable-cachemgr-hostname[=hostname]
Make cachemgr.cgi default to this host
--enable-arp-acl Enable use of ARP ACL lists (ether address)
--enable-htpc Enable HTCP protocol
--enable-forw-via-db Enable Forw/Via database
--enable-cache-digests Use Cache Digests
see http://www.squid-cache.org/Doc/FAQ/FAQ-16.html
--enable-err-language=lang
Select language for Error pages (see errors dir)
</PRE>
</P>
<H2><A NAME="ss2.8">2.8</A> <A HREF="FAQ.html#toc2.8">undefined reference to __inet_ntoa</A>
</H2>
<P>by
<A HREF="mailto:SarKev@topnz.ac.nz">Kevin Sartorelli</A>
and
<A HREF="mailto:doering@usf.uni-kassel.de">Andreas Doering</A>.</P>
<P>Probably you've recently installed bind 8.x. There is a mismatch between
the header files and DNS library that Squid has found. There are a couple
of things you can try.</P>
<P>First, try adding <CODE>-lbind</CODE> to <EM>XTRA_LIBS</EM> in <EM>src/Makefile</EM>.
If <CODE>-lresolv</CODE> is already there, remove it.</P>
<P>If that doesn't seem to work, edit your <EM>arpa/inet.h</EM> file and comment out the following:</P>
<P>
<PRE>
#define inet_addr __inet_addr
#define inet_aton __inet_aton
#define inet_lnaof __inet_lnaof
#define inet_makeaddr __inet_makeaddr
#define inet_neta __inet_neta
#define inet_netof __inet_netof
#define inet_network __inet_network
#define inet_net_ntop __inet_net_ntop
#define inet_net_pton __inet_net_pton
#define inet_ntoa __inet_ntoa
#define inet_pton __inet_pton
#define inet_ntop __inet_ntop
#define inet_nsap_addr __inet_nsap_addr
#define inet_nsap_ntoa __inet_nsap_ntoa
</PRE>
</P>
<H2><A NAME="dns-ttl-hack"></A> <A NAME="ss2.9">2.9</A> <A HREF="FAQ.html#toc2.9">How can I get true DNS TTL info into Squid's IP cache?</A>
</H2>
<P>If you have source for BIND, you can modify it as indicated in the diff
below. It causes the global variable _dns_ttl_ to be set with the TTL
of the most recent lookup. Then, when you compile Squid, the configure
script will look for the _dns_ttl_ symbol in libresolv.a. If found,
dnsserver will return the TTL value for every lookup.</P>
<P>This hack was contributed by
<A HREF="mailto:bne@CareNet.hu">Endre Balint Nagy</A>.</P>
<P>
<PRE>
diff -ru bind-4.9.4-orig/res/gethnamaddr.c bind-4.9.4/res/gethnamaddr.c
--- bind-4.9.4-orig/res/gethnamaddr.c Mon Aug 5 02:31:35 1996
+++ bind-4.9.4/res/gethnamaddr.c Tue Aug 27 15:33:11 1996
@@ -133,6 +133,7 @@
} align;
extern int h_errno;
+int _dns_ttl_;
#ifdef DEBUG
static void
@@ -223,6 +224,7 @@
host.h_addr_list = h_addr_ptrs;
haveanswer = 0;
had_error = 0;
+ _dns_ttl_ = -1;
while (ancount-- > 0 && cp < eom && !had_error) {
n = dn_expand(answer->buf, eom, cp, bp, buflen);
if ((n < 0) || !(*name_ok)(bp)) {
@@ -232,8 +234,11 @@
cp += n; /* name */
type = _getshort(cp);
cp += INT16SZ; /* type */
- class = _getshort(cp);
- cp += INT16SZ + INT32SZ; /* class, TTL */
+ class = _getshort(cp);
+ cp += INT16SZ; /* class */
+ if (qtype == T_A && type == T_A)
+ _dns_ttl_ = _getlong(cp);
+ cp += INT32SZ; /* TTL */
n = _getshort(cp);
cp += INT16SZ; /* len */
if (class != C_IN) {
</PRE>
</P>
<P>And here is a patch for BIND-8:
<PRE>
*** src/lib/irs/dns_ho.c.orig Tue May 26 21:55:51 1998
--- src/lib/irs/dns_ho.c Tue May 26 21:59:57 1998
***************
*** 87,92 ****
--- 87,93 ----
#endif
extern int h_errno;
+ int _dns_ttl_;
/* Definitions. */
***************
*** 395,400 ****
--- 396,402 ----
pvt->host.h_addr_list = pvt->h_addr_ptrs;
haveanswer = 0;
had_error = 0;
+ _dns_ttl_ = -1;
while (ancount-- > 0 && cp < eom && !had_error) {
n = dn_expand(ansbuf, eom, cp, bp, buflen);
if ((n < 0) || !(*name_ok)(bp)) {
***************
*** 404,411 ****
cp += n; /* name */
type = ns_get16(cp);
cp += INT16SZ; /* type */
! class = ns_get16(cp);
! cp += INT16SZ + INT32SZ; /* class, TTL */
n = ns_get16(cp);
cp += INT16SZ; /* len */
if (class != C_IN) {
--- 406,416 ----
cp += n; /* name */
type = ns_get16(cp);
cp += INT16SZ; /* type */
! class = _getshort(cp);
! cp += INT16SZ; /* class */
! if (qtype == T_A && type == T_A)
! _dns_ttl_ = _getlong(cp);
! cp += INT32SZ; /* TTL */
n = ns_get16(cp);
cp += INT16SZ; /* len */
if (class != C_IN) {
</PRE>
</P>
<H2><A NAME="bsdi-compile"></A> <A NAME="ss2.10">2.10</A> <A HREF="FAQ.html#toc2.10">My platform is BSD/OS or BSDI and I can't compile Squid</A>
</H2>
<P>
<PRE>
cache_cf.c: In function `parseConfigFile':
cache_cf.c:1353: yacc stack overflow before `token'
...
</PRE>
</P>
<P>You may need to upgrade your gcc installation to a more recent version.
Check your gcc version with
<PRE>
gcc -v
</PRE>
If it is earlier than 2.7.2, you might consider upgrading.</P>
<P>Alternatively, you can get pre-compiled Squid binaries for BSD/OS 2.1 at
the
<A HREF="ftp://ftp.bsdi.com/patches/patches-2.1">BSD patches FTP site</A>,
patch
<A HREF="ftp://ftp.bsdi.com/patches/patches-2.1/U210-019">U210-019</A>.</P>
<H2><A NAME="ss2.11">2.11</A> <A HREF="FAQ.html#toc2.11">Problems compiling <EM>libmiscutil.a</EM> on Solaris</A>
</H2>
<P>The following error occurs on Solaris systems using gcc when the Solaris C
compiler is not installed:
<PRE>
/usr/bin/rm -f libmiscutil.a
/usr/bin/false r libmiscutil.a rfc1123.o rfc1738.o util.o ...
make[1]: *** [libmiscutil.a] Error 255
make[1]: Leaving directory `/tmp/squid-1.1.11/lib'
make: *** [all] Error 1
</PRE>
Note on the second line the <B>/usr/bin/false</B>. This is supposed
to be a path to the <EM>ar</EM> program. If <EM>configure</EM> cannot find <EM>ar</EM>
on your system, then it substitues <EM>false</EM>.</P>
<P>To fix this you either need to:
<UL>
<LI>Add <EM>/usr/ccs/bin</EM> to your PATH. This is where the <EM>ar</EM>
command should be. You need to install SUNWbtool if <EM>ar</EM>
is not there. Otherwise,</LI>
<LI>Install the <B>binutils</B> package from
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">the GNU FTP site</A>.
This package includes programs such as <EM>ar</EM>, <EM>as</EM>, and <EM>ld</EM>.</LI>
</UL>
</P>
<H2><A NAME="ss2.12">2.12</A> <A HREF="FAQ.html#toc2.12">I have problems compiling Squid on Platform Foo.</A>
</H2>
<P>Please check the
<A HREF="/platforms.html">page of platforms</A>
on which Squid is known to compile. Your problem might be listed
there together with a solution. If it isn't listed there, mail
us what you are trying, your Squid version, and the problems
you encounter.</P>
<H2><A NAME="ss2.13">2.13</A> <A HREF="FAQ.html#toc2.13">I see a lot warnings while compiling Squid.</A>
</H2>
<P>Warnings are usually not a big concern, and can be common with software
designed to operate on multiple platforms. If you feel like fixing
compile-time warnings, please do so and send us the patches.</P>
<H2><A NAME="building-os2"></A> <A NAME="ss2.14">2.14</A> <A HREF="FAQ.html#toc2.14">Building Squid on OS/2</A>
</H2>
<P>by
<A HREF="mailto:nazard@man-assoc.on.ca">Doug Nazar</A></P>
<P>In order in compile squid, you need to have a reasonable facsimile of a
Unix system installed. This includes <EM>bash</EM>, <EM>make</EM>, <EM>sed</EM>,
<EM>emx</EM>, various file utilities and a few more. I've setup a TVFS
drive that matches a Unix file system but this probably isn't strictly
necessary.</P>
<P>I made a few modifications to the pristine EMX 0.9d install.
<OL>
<LI>added defines for <EM>strcasecmp()</EM> & <EM>strncasecmp()</EM> to <EM>string.h</EM></LI>
<LI>changed all occurrences of time_t to signed long instead
of unsigned long</LI>
<LI>hacked ld.exe
<OL>
<LI>to search for both xxxx.a and libxxxx.a</LI>
<LI>to produce the correct filename when using the
-Zexe option</LI>
</OL>
</LI>
</OL>
</P>
<P>You will need to run <EM>scripts/convert.configure.to.os2</EM> (in the
Squid source distribution) to modify
the configure script so that it can search for the various programs.</P>
<P>Next, you need to set a few environment variables (see EMX docs
for meaning):
<PRE>
export EMXOPT="-h256 -c"
export LDFLAGS="-Zexe -Zbin -s"
</PRE>
</P>
<P>Now you are ready to configure squid:
<PRE>
./configure
</PRE>
</P>
<P>Compile everything:
<PRE>
make
</PRE>
</P>
<P>and finally, install:
<PRE>
make install
</PRE>
</P>
<P>This will by default, install into <EM>/usr/local/squid</EM>. If you wish
to install somewhere else, see the <EM>--prefix</EM> option for configure.</P>
<P>Now, don't forget to set EMXOPT before running squid each time. I
recommend using the -Y and -N options.</P>
<HR>
<A HREF="FAQ-3.html">Next</A>
<A HREF="FAQ-1.html">Previous</A>
<A HREF="FAQ.html#toc2">Contents</A>
</BODY>
</HTML>