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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
|
<!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://ftp.gnu.org/gnu/patch">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://ftp.gnu.org/gnu/gcc">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>
<P>
Squid binaries for
<A HREF="http://www.acmeconsulting.it/SquidNT/download.html">Windows</A>.</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-2.5.STABLE3
mkdir ../squid-2.5.STABLE4
find . -depth -print | cpio -pdv ../squid-1.1.11
cd ../squid-1.1.11
patch -p1 < /tmp/squid-2.5.STABLE3-STABLE4.diff
or alternatively
cp -rl squid-2.5.STABLE3 squid-2.5.STABLE4
cd squid-2.5.STABLE4
zcat /tmp/squid-2.5.STABLE3-STABLE4.diff.gz | patch -p1
</PRE>
After the patch has been applied, you must rebuild Squid from the
very beginning, i.e.:
<PRE>
make distclean
./configure ...
make
make install
</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>
<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://ftp.gnu.org/gnu/binutils">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>
<H2><A NAME="building-Cygwin"></A> <A NAME="ss2.15">2.15</A> <A HREF="FAQ.html#toc2.15">Building Squid on Cygwin</A>
</H2>
<P>In order to compile squid, you need to have Cygwin fully installed.</P>
<P>Unpack the source archive as usual and run configure:
<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, add a new Cygwin user - see the Cygwin user guide - and map it to
SYSTEM, or create a new NT user, and a matching Cygwin user and they
become the squid runas users.</P>
<P>Read the squid FAQ on permissions if you are using CYGWIN=ntsec.</P>
<P>After run squid -z.
If that succeeds, try squid -N -D -d1, squid should start. Check that there are no errors. If
everything looks good, try browsing through squid.</P>
<P>Now, configure cygrunsrv to run squid as a service as the chosen
usercode. You may need to check permissions here.</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>
|