1include_server(1) General Commands Manual include_server(1)
2
3
4
6 include_server.py - conservative approximation of include dependencies
7 for C/C++
8
10 include_server --port INCLUDE_SERVER_PORT [OPTIONS]
11
13 include_server.py starts an include server process. This process
14 answers queries from distcc(1) clients about what files to include in
15 C/C++ compilations. The include_server.py command itself terminates as
16 soon as the include server has been spawned.
17
18 The INCLUDE_SERVER_PORT argument is the name of a socket used for all
19 communication between distcc clients and the include server. The
20 pump(1) command is responsible for creating the socket location, for
21 passing it to this script, and for passing it to all distcc clients via
22 the environment variable named INCLUDE_SERVER_PORT.
23
24 The protocol used by the include server uses distcc's RPC implementa‐
25 tion. Each distcc request consists of (1) the current directory and (2)
26 the list of arguments of the compilation command.
27
28 If the include server is able to process the request, then it answers
29 the distcc client by sending a list of filepaths. The filepaths are
30 those of the compressed source and header files found to be necessary
31 for compilation through include analysis. The list also comprises sym‐
32 bolic links and even dummy files needed for the compilation server to
33 construct an accurate replica of the parts of the filesystem needed for
34 compilation. In this way, a needed header file like /path/foo.h is
35 compressed, renamed, and stored in a temporary location, such as
36 /dev/shm/tmpiAvfGv.include_server-9368-1/path/foo.h.lzo. The distcc
37 client will pass these files on to a compilation server, where they
38 will be uncompressed and mounted temporarily.
39
40 If the include server is not able to process the request, then it
41 returns the empty list to the distcc client.
42
43 There are two kinds of failures that relate to the include server. The
44 include server may fail to compute the includes or fail in other ways,
45 see section INCLUDE SERVER SYMPTOMS. Also, the compilation on the
46 remove server may fail due to inadequacy of the calculated include clo‐
47 sure, but then succeed when locally retried, see section DISTCC DIS‐
48 CREPANCY SYMPTOMS.
49
50
52 The following options are understood by include_server.py.
53
54 -dPAT, --debug_pattern=PAT
55 Bit vector for turning on warnings and debugging
56 1 = warnings
57 2 = trace some functions
58 other powers of two: see include_server/basics.py.
59
60 -e, --email
61 Send email to 'distcc-pump-errors' or if defined, the value of
62 enviroment variable DISTCC_EMAILLOG_WHOM_TO_BLAME, when include
63 server gets in trouble. The default is to not send email.
64
65 --email_bound NUMBER
66 Maximal number of emails to send (in addition to a final email).
67 Default: 3.
68
69 --no-email
70 Do not send email. This is the default.
71
72 --path_observation_re=RE
73 Issue warning message whenever a filename is resolved to a real‐
74 path that is matched by RE, which is a regular expression in
75 Python syntax. This is useful for finding out where files
76 included actually come from. Use RE="" to find them all. Note:
77 warnings must be enabled with at least -d1.
78
79 --pid_file FILEPATH
80 The pid of the include server is written to file FILEPATH. This
81 allows a script such a pump to tear down the include server.
82
83 -s, --statistics
84 Print information to stdout about include analysis.
85
86 --stat_reset_triggers=LIST
87 Flush stat caches when the timestamp of any filepath in LIST
88 changes or the filepath comes in or out of existence. LIST is a
89 colon separated string of filepaths, possibly containing simple
90 globs (as allowed by Python's glob module). Print a warning
91 whenever such a change happens (if warnings are enabled). This
92 option allows limited exceptions to distcc_pump's normal assump‐
93 tion that source files are not modified during the build.
94
95 -t, --time
96 Print elapsed, user, and system time to stderr.
97
98 --unsafe_absolute_includes
99 Do preprocessing on the compilation server even if includes of
100 absolute filepaths are encountered. Normally the include-server
101 will fall back on local preprocessing if it detects any absolute
102 includes. Thus, this flag is useful for preventing such fall‐
103 backs when the absolute includes are a false alarm, either
104 because the absolute include is discarded during preprocessing
105 or because the absolutely included file exists on the compila‐
106 tion servers.
107
108 More precisely, with --unsafe_absolute_includes absolute
109 includes are ignored for the purposes of gathering the include
110 closure. Using this option may lead to incorrect results
111 because (1) the header may actually be included on the compila‐
112 tion server and it may not be the same as on the client, (2) the
113 include directives of the header are not further analyzed.
114
115 The option is useful for compiling code that has such hardcoded
116 absolute locations of header files inside conditional directives
117 (e.g. "#ifdef") that render the includes irrelevant. More pre‐
118 cisely, these includes must be eliminated during preprocessing
119 for the actual configuration. Then the question of existence of
120 the header file is moot and the remote compilation is sound.
121 This is often the case if such includes are meant for unusual
122 configurations different from the actual configuration.
123
124 -v, --verify
125 Verify that files in CPP closure are contained in closure calcu‐
126 lated by include processor.
127
128 -w, --write_include_closure
129 Write a .d_approx file which lists all the included files calcu‐
130 lated by the include server; with -x, additionally write the
131 included files as calculated by CPP to a .d_exact file.
132
133 -x, --exact_analysis
134 Use CPP instead, do not omit system headers files.
135
136
138 The most likely messages and warnings to come from the include proces‐
139 sor are listed below.
140
141 Preprocessing locally. Include server not covering: Couldn't determine
142 default system include directories
143 To determine the default system header directories, the include
144 server runs the compiler once for each language needed during
145 its session. This message indicates that the compiler specified
146 to distcc is not present on the client.
147
148 Preprocessing locally. Include server not covering: Bailing out because
149 include server spent more than ...s user time handling request
150 In uncommon situations, the include server fails to analyze very
151 complicated macro expressions. The distcc client will use plain
152 distcc mode.
153
154 Warning: Filepath must be relative but isn't
155 The include server does not accept absolute filepaths, such as
156 /usr/include/stdio.h, in include directives, because there is no
157 guarantee that this header on the compilation server machine
158 will be the same as that on the client. The include server
159 gives up analyzing the include closure. The distcc client cannot
160 use pump-mode.
161
162 To overcome this problem in a not always reliable way, set the
163 environment variable INCLUDE_SERVER_ARGS='--unsafe_abso‐
164 lute_includes' when invoking the pump script to pass the
165 --unsafe_absolute_includes option to the include server.
166
167 Warning: Absolute filepath ... was IGNORED
168 The --unsafe_absolute_includes is in use. This situation hap‐
169 pens under the same circumstances as when "Filepath must be rel‐
170 ative but isn't" is issued, but in this case the include will
171 provide an answer to the distcc client.
172
173 Warning: Path '/PATH/FILE' changed/came into existence/no longer exists
174 These warnings are issued when using stat reset triggers.
175 Because /PATH/FILE changed, the include server clears its
176 caches; the new version of the file (or the lack of it) renders
177 the include analysis invalid. This message can usually be
178 ignored; it does signify a somewhat precarious use of files by
179 the build system. It is recommended to fix the build system so
180 that files are not rewritten.
181
182 Warning: For translation unit ..., lookup of file ... resolved to ...
183 whose realpath is ...
184 This warning occurs with --path_observation_re when a new real‐
185 path matching a source or header file is observed.
186
187
189 The interactions between the build system, distcc, and the include
190 server is somewhat complex. When a distcc commands receives a failing
191 compilation from the remote server it retries the compilation locally.
192 This section discusses the causes of discrepancies between remote and
193 local compilation. These are flagged by the demotion message:
194
195 __________Warning: ... pump-mode compilation(s) failed on server, but
196 succeeded locally.
197 __________Distcc-pump was demoted to plain mode. See the Distcc Dis‐
198 crepancy Symptoms section in the include_server(1) man page.
199
200 The pump script issues this message at the end of the build. This means
201 that for at least one distcc invocation a local compilation succeeded
202 after the remote compilation failed. Each distcc invocation for which
203 such a discrepancy occurred in turn also issues a message such as:
204
205 Warning: remote compilation of '...' failed, retried locally and got a
206 different result.
207
208 The demotion makes subsequent distcc invocations use plain distcc mode.
209 Thus preprocessing will take place on the local machine for the remain‐
210 der of the build. This technique prevents very slow builds where all
211 compilations end up on the local machine after failing remotely.
212
213 Of course, if the local compilations fails after the remote failures,
214 then the distcc invocation exits with the non-zero status of the local
215 compilation. The error messages printed are also those of the local
216 compilation.
217
218 The fallback behavior for distcc-pump mode to local compilation can be
219 disabled by setting the environment variable DISTCC_FALLBACK to 0,
220 which makes the distcc command fail as soon as the remote compilation
221 has failed. This setting is very useful for debugging why the remote
222 compilation went wrong, because now the output from the server will be
223 printed.
224
225 Next we discuss the possible causes of discrepancies.
226
227 The user changed a source or header file during the build.
228 This yields inconsistent results of course.
229
230 A source or header file changed during the build.
231 The build system rewrites a file. For Linux kernel 2.6, this
232 happens for 'include/linux/compile.h' and 'include/asm/asm-off‐
233 sets.h'. This condition is fixed by letting the include server
234 know that it must reset its caches when a stat of any of the
235 files changes. Practically, this is done by gathering the files
236 in a colon-separated list and then setting the
237 INCLUDE_SERVER_ARGS environment variable when invoking the pump
238 script, so that it passes the --stat_reset_triggers option; for
239 example,
240
241 INCLUDE_SERVER_ARGS="--stat_reset_triggers=include/linux/com‐
242 pile.h:include/asm/asm-offsets.h"
243
244 A header file is potentially included, but does not exist, and is then
245 later included.
246 This occurs when some header foo.h includes another header file
247 trick.h, but the trick.h file has not yet been generated and the
248 inclusion is actually ignored because of preprocessing direc‐
249 tives. The include server will probe for the existence of
250 trick.h, because it overapproximates all possible ways direc‐
251 tives actually evaluate. The file trick.h is determined not to
252 exist. If it is later generated, and then really included, then
253 the include server will falsely believe that the file still does
254 not exist. The solution to this problem is to make the build
255 system generate trick.h before the first time any header file is
256 included that makes a syntactic reference to trick.h
257
258 The include server was started with --unsafe_absolute_includes.
259 This is a problem if there are header files locally that do not
260 exist remotely and that are actually used. Such includes are
261 often protected by conditional directives that evaluate so that
262 are actually used on only specific and often uncommon platforms.
263 If you are not compiling for such a platform, then it may be
264 correct to use --unsafe_absolute_include.
265
266 The include server has calculated the wrong includes.
267 We do not know of such a situation.
268
269
270
272 The exit code of include_server.py is usually 0. That the include
273 server has been started properly is communicated through the existence
274 of the pid_file.
275
276
278 DISTCC_EMAILLOG_WHOM_TO_BLAME The email address to use for include
279 server automated emails. The default is 'distcc-pump-errors' (which is
280 an email address that probably will not exist in your domain).
281
282 Additionally, the invocation of the compiler may use additional envi‐
283 ronment variables.
284
285
286
288 If you think you have found a distcc bug, please see the file report‐
289 ing-bugs.txt in the documentation directory for information on how to
290 report it.
291
292
293 In distcc-pump mode, the include server is unable to handle certain
294 very complicated computed includes as found in parts of the Boost
295 library. The include server will time out and distcc will revert to
296 plain mode.
297
298 Other known bugs may be documented on http://code.google.com/p/distcc/
299
300
302 The include server was written by Nils Klarlund, with assistance from
303 Fergus Henderson, Manos Renieris, and Craig Silverstein. Please report
304 bugs to <distcc@lists.samba.org>.
305
306
308 You are free to use distcc. distcc (including this manual) may be
309 copied, modified or distributed only under the terms of the GNU General
310 Public Licence version 2 or later. distcc comes with absolutely no
311 warrany. A copy of the GPL is included in the file COPYING.
312
313
315 distcc(1), distccd(1), include_server(1), and gcc(1).
316 http://code.google.com/p/distcc/ http://ccache.samba.org/
317
318
319
320 9 June 2008 include_server(1)