File: FAQ-3.html

package info (click to toggle)
squid 1.1.21-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,828 kB
  • ctags: 3,705
  • sloc: ansic: 34,400; sh: 1,975; perl: 899; makefile: 559
file content (263 lines) | stat: -rw-r--r-- 10,417 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<HTML>
<HEAD>
<TITLE>SQUID Frequently Asked Questions: Compiling</TITLE>
</HEAD>
<BODY>
<A HREF="FAQ-2.html">Previous</A>
<A HREF="FAQ-4.html">Next</A>
<A HREF="FAQ.html#toc3">Table of Contents</A>
<HR>
<H2><A NAME="s3">3. Compiling</A></H2>

<H2><A NAME="ss3.1">3.1 src/Makefile options</A></H2>

<P>The Squid <EM>Makefile</EM> includes numerous options
that you may define before compiling.  These enable certain
customizations and/or non-standard features described below.
As of this writing, the options below were present in
the Squid&nbsp1.1.15 <EM>src/Makefile</EM>.  If you want to
define these before running <EM>configure</EM> then you would edit
<EM>src/Makefile.in</EM>.</P>
<P>
<DL>
<DT><B>HOST_OPT</B><DD><P>Normally the <EM>cachemgr.cgi</EM> program brings up the main
HTML form with the hostname field blank.  Some administrators
grow weary from continually entering hostnames, so this option
allows a default hostname to be set for that field.</P>
<DT><B>AUTH_OPT</B><DD><P>
<A HREF="mailto:jrmt@uk.gdscorp.com">Jon Thackray</A> has
written some optionally-compiled code to support proxy
authentication.  In addition to enabling this option in the
Makefile, you must also define a password file with the
<EM>proxy_auth</EM> option in <EM>squid.conf</EM>.</P>
<DT><B>LOG_HDRS_OPT</B><DD><P>
<A HREF="mailto:rrg@ny.ubs.com">Ron Gomes</A> has written
some optionally-compiled code to log FULL request and response
headers to <EM>access.log</EM>.  The headers are encoded safely and
will appear as two bracketed fields at the end of each line.
The <EM>log_mime_hdrs</EM> option must also be
enabled in <EM>squid.conf</EM>.</P>
<DT><B>ICMP_OPT</B><DD><P>This option enables using ICMP (ala <EM>ping</EM>) to measure the
proximity of origin servers.   This feature is fully described
in 
<A HREF="FAQ-7.html#using-icmp">using-icmp</A>.</P>
<DT><B>DELAY_HACK</B><DD><P>
<A HREF="mailto:mikeg@scorpion.murdoch.edu.au">Mike Groeneweg</A> has written
some optionally-compiled code to delay the requests of certain users.  Requests matching
the <EM>delay_access</EM> ACL rules (similar to <EM>http_access</EM>) will be
artificially delayed by the <EM>neighbor_timeout</EM> amount.</P>
<DT><B>USERAGENT_OPT</B><DD><P>
<A HREF="mailto:ramey@csc.ti.com">Joe Ramey</A> has written some
optionally-compiled code to log the value of the User-Agent request header to
a separate <EM>useragent.log</EM> file.</P>
<DT><B>KILL_PARENT_OPT</B><DD><P>When this option is defined, Squid sends a kill signal to its
parent process (assuming it to be the <EM>RunCache</EM> script) when
Squid terminates.  This feature is a bit dangerous, so use at your
own risk.</P>
<DT><B>USE_POLL_OPT</B><DD><P>Some operating systems may perform better when the <EM>poll()</EM>
function call is available.  <EM>poll()</EM> would be used in place
of <EM>select()</EM>.  Solaris', <EM>select()</EM> only supports 1024
file descriptors (even if the process limit is higher).
<EM>poll()</EM> should be used if you need more than 1024
descriptors on Solaris.</P>
<DT><B>USE_SPLAY_TREE</B><DD><P>By default, Squid stores IP access list entries as a
linked-list.  Linear searches on these lists may be inefficient.
This optionally-compiled code stores IP access lists as
<A HREF="http://gs213.sp.cs.cmu.edu/prog/splay">SPLAY trees</A>.
No analysis has been done to prove that this
implementation is significantly more efficient, however.</P>
<DT><B>USE_BIN_TREE</B><DD><P>Another option to linear linked-lists of IP access controls.
With this option, binary balanced trees are used to store 
the access lists.</P>
<DT><B>RELOAD_INTO_IMS</B><DD><P>Some administrators have asked for the ability to change a
<EM>no-cache</EM> request into an <EM>If-Modified-Since</EM> request.
When this option is defined, Squid will strip the <EM>no-cache</EM>
request header and insert an <EM>If-Modified-Since</EM> header with
last-valid time of the cached object.  If the request already
includes an <EM>If-Modified-Since</EM> header, it will be unchanged.
Use of this feature means
that cache users will have no way to enforce a refresh if a
bad or outdated page gets cached and the dates get out of sync,
or if a partial object somehow becomes cached.</P>
</DL>
</P>


<H2><A NAME="ss3.2">3.2 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="gnu-malloc"></A> <A NAME="ss3.3">3.3 Using GNU malloc</A></H2>

<P>Many users have found improved performance when linking Squid with an external malloc
library, such as GNU malloc.   To make Squid use GNU malloc follow these simple steps:</P>
<P>
<OL>
<LI>Download the GNU malloc source, available from one of
<A HREF="http://www.gnu.org/order/ftp.html">The GNU FTP Mirror sites</A>.</LI>
<LI>Compile GNU malloc
<PRE>
        % gzip -dc malloc.tar.gz | tar xf -
        % cd malloc
        % vi Makefile     # edit as needed
        % make
</PRE>
</LI>
<LI>Copy libmalloc.a to your system's library directory and be sure to 
name it <EM>libgnumalloc.a</EM>.
<PRE>
        % su
        # cp malloc.a /usr/lib/libgnumalloc.a
</PRE>
</LI>
<LI>(Optional) Copy the GNU malloc.h to your system's include directory and
be sure to name it <EM>gnumalloc.h</EM>.  This step is not required, but if
you do this, then Squid will be able to use the <EM>mstat()</EM> function to
report memory usage statistics on the cachemgr info page.
<PRE>
        # cp malloc.h /usr/lib/gnumalloc.h
</PRE>
</LI>
<LI>Reconfigure and recompile Squid
<PRE>
        % make realclean
        % ./configure ...
        % make
        % make install
</PRE>

Note, In later distributions, 'realclean' has been changed to 'distclean'.
As the configure script runs, watch its output.  You should find that
it locates libgnumalloc.a and optionally gnumalloc.h.</LI>
</OL>
</P>


<H2><A NAME="ss3.4">3.4 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-- &gt; 0 && cp &lt; eom && !had_error) {
                n = dn_expand(answer-&gt;buf, eom, cp, bp, buflen);
                if ((n &lt; 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>


<H2><A NAME="ss3.5">3.5 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 need to upgrade your gcc installation to a more recent version, 
say 2.7.2.</P>


<H2><A NAME="ss3.6">3.6 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.  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>




<HR>
<A HREF="FAQ-2.html">Previous</A>
<A HREF="FAQ-4.html">Next</A>
<A HREF="FAQ.html#toc3">Table of Contents</A>
</BODY>
</HTML>