Debian Codegraph @

doc/howto/Compiling.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD: Compiling ProFTPD</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center><h2><b>Compiling ProFTPD</b></h2></center>
11 <hr>
12
13 <p>
14 The ProFTPD source code is designed to be configured for compilation on the
15 target system by a single shell script, named <code>configure</code>, located
16 in the top-level directory of the source distribution, <i>e.g.</i>:
17 <pre>
18 # cd proftpd-<i>version</i>/
19 # ls -al configure
20 -rwxr--r-- 1 tj tj 1155157 Nov 18 19:54 configure
21 </pre>
22 This <code>configure</code> script, generated by the GNU <code>autoconf</code>
23 tool, will analyze your system and create a <code>config.h</code> file that
24 should allow ProFTPD to compile cleanly.
25
26 <p>
27 ProFTPD is designed to be very flexible, which necessarily leads to extra
28 compile-time and run-time configuration complexity. The <code>configure</code>
29 script also can be used to customize your build, setting compile-time options
30 based on command-line options that you provide. In particular, software
31 modules to be used by ProFTPD may be chosen this way.
32
33 <p>
34 In addition to the <code>config.h</code> file generated by the
35 <code>configure</code> script, the file <code>include/options.h</code>:
36 <pre>
37 # cd proftpd-<i>version</i>/
38 # ls -al include/options.h
39 -rw-r--r-- 1 tj tj 7212 Nov 15 14:34 include/options.h
40 </pre>
41 contains a number of easily tweakable compile-time options which will affect
42 ProFTPD's operation. These options are never modified by the
43 <code>configure</code> script. Changing these values is rarely needed, and
44 most can be overridden at run-time by directives in the
45 <code>proftpd.conf</code> configuration file.
46
47 <p>
48 To see the full list of command-line options for <code>configure</code>, run:
49 <pre>
50 # ./configure --help
51 </pre>
52 Should you change your mind about which options to use, you will need to
53 re-run <code>configure</code> with the new options. But first you will
54 need to clean up the previous results by doing:
55 <pre>
56 # make clean
57 # ./configure ...
58 </pre>
59 The rest of this document covers the various options of the
60 <code>configure</code> script in detail.
61
62 <p>
63 When you run the <code>configure</code> script by itself, without any
64 command-line options, you will get the defaults:
65 <pre>
66 # cd proftpd-<i>version</i>/
67 # ./configure
68 </pre>
69 What are the defaults?
70
71 <p>
72 <b>Layout Options</b><br>
73 One of the first decisions to make is where you want ProFTPD, and all of
74 its supporting files, to be installed on your system. By default, the
75 ProFTPD build system installs the files in a layout under the
76 <code>/usr/local/</code> directory. The <code>/usr/local/</code>
77 directory functions as the default <i>prefix directory</i>. Thus the
78 layout of installed files will look like:
79 <pre>
80 <i>/usr/local</i>/bin/ftpcount
81 <i>/usr/local</i>/bin/ftpdcount
82 <i>/usr/local</i>/bin/ftptop
83 <i>/usr/local</i>/bin/ftpwho
84 <i>/usr/local</i>/bin/prxs
85 <i>/usr/local</i>/etc/proftpd.conf
86 <i>/usr/local</i>/include/proftpd/*.h
87 <i>/usr/local</i>/lib/pkgconfig/proftpd.pc
88 <i>/usr/local</i>/libexec/*.{a,la,so}
89 <i>/usr/local</i>/sbin/ftpshut
90 <i>/usr/local</i>/sbin/in.proftpd
91 <i>/usr/local</i>/sbin/proftpd
92 <i>/usr/local</i>/share/locale/<i>lang</i>/LC_MESSAGES/proftpd.mo
93 <i>/usr/local</i>/share/man/man1/ftpcount.1
94 <i>/usr/local</i>/share/man/man1/ftptop.1
95 <i>/usr/local</i>/share/man/man1/ftpwho.1
96 <i>/usr/local</i>/share/man/man5/xferlog.5
97 <i>/usr/local</i>/share/man/man8/ftpdctl.8
98 <i>/usr/local</i>/share/man/man8/ftpshut.8
99 <i>/usr/local</i>/share/man/man8/proftpd.8
100 <i>/usr/local</i>/var/proftpd/*
101 </pre>
102 To place all of these files under the <code>/usr/</code> directory rather
103 than <code>/usr/local/</code>, you would change the prefix directory using
104 the <code>--prefix</code> option:
105 <pre>
106 # ./configure --prefix=/usr
107 </pre>
108
109 <p>
110 You can also change only portions of the layout, for just the binaries
111 or the configuration file or other parts:
112
113 <p>
114 <table summary="Configure Options">
115 <tr>
116 <td><code>--bindir</code></td>
117 <td>Change <code><i>prefix-dir</i>/bin/</code></td>
118 </tr>
119
120 <tr>
121 <td><code>--libexecdir</code></td>
122 <td>Change <code><i>prefix-dir</i>/libexec/</code></td>
123 </tr>
124
125 <tr>
126 <td><code>--localstatedir</code></td>
127 <td>Change <code><i>prefix-dir</i>/var/</code></td>
128 </tr>
129
130 <tr>
131 <td><code>--sbindir</code></td>
132 <td>Change <code><i>prefix-dir</i>/sbin/</code></td>
133 </tr>
134
135 <tr>
136 <td><code>--sysconfdir</code></td>
137 <td>Change <code><i>prefix-dir</i>/etc/</code></td>
138 </tr>
139 </table>
140
141 <p>
142 Thus to place the configuration file in <code>/etc/</code> and the runtime
143 state files in <code>/var/proftpd/</code>, you would use:
144 <pre>
145 # ./configure --sysconfdir=/etc --localstatedir=/var/proftpd
146 </pre>
147
148 <p><a name="InstallerOptions">
149 <b>Installer Options</b><br>
150 When you go to install ProFTPD, the build system will install all of the
151 files and directories as user 'root' and group 'root' (or group 'wheel',
152 depending on your system). This user/group combination is used because
153 on most systems, that is the user which has permissions for creating new
154 files/directories under the <code>/usr/local/</code> directory.
155
156 <p>
157 If you wish to <i>install</i> using a different user or group ownership, set the
158 <code>install_user</code> and <code>install_group</code> environment variables
159 before running <code>configure</code>. Using a Bourne-ish style shell
160 (<i>e.g.</i> sh, ksh, bash), you can do this on the command line like this:
161 <pre>
162 # install_user=root install_group=wheel ./configure
163 </pre>
164
165 <p>
166 For example, I do a lot of personal ProFTPD builds, and so I typically use:
167 <pre>
168 # install_user=tj install_group=tj ./configure --prefix=/home/tj/proftpd/devel/build/ ...
169 </pre>
170 Note that the <code>install_user</code> and <code>install_group</code>
171 environment variables do <b>not</b> affect the IDs used when <i>running</i>
172 <code>proftpd</code>.
173
174 <p><a name="FeatureOptions">
175 <b>Feature Options</b><br>
176 There are some features which are part of the core <code>proftpd</code> engine
177 itself which can be configured via compile-time options. The list below talks
178 about the more common of these feature options:
179 <ul>
180 <li><code>--disable-auth-file</code><br>
181 The <a href="../modules/mod_auth_file.html"><code>mod_auth_file</code></a>
182 module is included in the build by default; use this option to <b>not</b>
183 include the module.
184 </li>
185
186 <p>
187 <li><code>--enable-autoshadow</code><br>
188 Enables support for <i>autoshadow</i>
189 </li>
190
191 <p>
192 <li><code>--enable-ctrls</code><br>
193 Enables support for the <a href="Controls.html">Controls</a> feature; this
194 is not enabled by default.
195 </li>
196
197 <p>
198 <li><code>--enable-dso</code><br>
199 Enables support for <a href="DSO.html">DSO</a> modules (also called "shared
200 modules") by including the
201 <a href="../modules/mod_dso.html"><code>mod_dso</code></a> module in the
202 build. This is not enabled by default.
203 </li>
204
205 <p>
206 <li><code>--enable-facl</code><br>
207 Enables support for POSX ACLs, which is not enabled by default. Note that
208 the related <a href="../modules/mod_facl.html"><code>mod_facl</code></a>
209 module must be added <b>separately</b> to the build, using
210 <code>--with-modules</code>.
211 </li>
212
213 <p>
214 <li><code>--disable-ident</code><br>
215 Disables support for IDENT
216 (<a href="http://www.faqs.org/rfcs/rfc1413.html">RFC1413</a>) lookups by
217 not adding the <a href="../modules/mod_ident.html"><code>mod_ident</code></a>
218 module to the build. This module is added by default.
219 </li>
220
221 <p>
222 <li><code>--disable-ipv6</code><br>
223 Disables IPv6 support, which is enabled by default. Note that IPv6 support
224 can be disabled <i>at run-time</i> using the <code>UseIPv6</code> directive
225 in your <code>proftpd.conf</code> file.
226 </li>
227
228 <p>
229 <li><code>--enable-memcache</code><br>
230 Enables support for using <a href="http://memcached.org/"><code>memcached</code></a> for caching by including the
231 <a href="../modules/mod_memcache.html"><code>mod_memcache</code></a>
232 module in the build. This is not enabled by default.
233 </li>
234
235 <p>
236 <li><code>--enable-nls</code><br>
237 Enables support for different character sets and encodings, for translated
238 response messages, and for the <code>LANG</code> FTP command via the
239 <a href="../modules/mod_lang.html"><code>mod_lang</code></a> module. This
240 is not enabled by default.
241 </li>
242
243 <p>
244 <li><code>--enable-pcre</code><br>
245 Enable use of <a href="http://www.pcre.org/">PCRE</a> for POSIX regular
246 expressions, rather than the system library. This is not enabled by
247 default. Note that pcre-7.0 or later is <b>required</b>.
248 </li>
249
250 <p>
251 <li><code>--disable-sendfile</code><br>
252 Disables support for the <code>sendfile(2)</code> function, which is
253 enabled by default. Read <a href="Sendfile.html">here</a> for information
254 on when and why this is a Good Thing to do.
255 </li>
256
257 <p>
258 <li><code>--enable-devel</code><br>
259 Enables code/behavior that is specifically used by developers and
260 maintainers; this code is disabled by default. The uses for this option
261 are covered more fully <a href="#DeveloperOptions">below</a>; suffice to
262 say that unless you <i>really</i> know what you are doing, you should
263 <b>not</b> be using this option in your configure command.
264 </li>
265
266 <p>
267 <li><code>--with-lastlog</code><em>=/path/to/lastlog</em><br>
268 Enables support for lastlog logging; see the <code>lastlog(8)</code>
269 man page. The optional <em>/path/to/lastlog</em> argument is only
270 needed if your lastlog file location is not a standard location.
271 Note that this configure option is needed in order to support the
272 <code>UseLastlog</code> configuration directive at runtime.
273 This feature is not enabled by default.
274 </li>
275
276 </ul>
277 <p>
278 There are of course other feature-specific configure options, but most of
279 the time, most people will not need to know about or use them.
280
281 <p><a name="ModuleOptions">
282 <b>Module Options</b><br>
283 Now we come to the fun part: deciding which of the many different modules
284 to include in our build. Before doing this, though, you need to know that
285 some modules are <i>automatically</i> included in the build:
286 <ul>
287 <li><code>mod_core.c</code>
288 <li><code>mod_xfer.c</code>
289 <li><code>mod_auth_unix.c</code>
290 <li><code>mod_auth.c</code>
291 <li><code>mod_ls.c</code>
292 <li><code>mod_log.c</code>
293 <li><code>mod_site.c</code>
294 <li><code>mod_delay.c</code>
295 <li><code>mod_facts.c</code>
296 </ul>
297 In addition to these modules, there are some modules which <i>may</i> be
298 automatically added, depending on your system:
299 <ul>
300 <li><a href="../modules/mod_auth_file.html"><code>mod_auth_file.c</code></a><br>
301 This module is automatically added <i>unless</i> <code>--disable-auth-file</code> is used
302 </li>
303
304 <p>
305 <li><a href="../modules/mod_auth_pam.html"><code>mod_auth_pam.c</code></a><br>
306 This module is automatically added if PAM support is detected
307 </li>
308
309 <p>
310 <li><a href="../modules/mod_cap.html"><code>mod_cap.c</code></a><br>
311 This module is automatically added if Linux capabilities support is
312 detected
313 </li>
314
315 <p>
316 <li><a href="../modules/mod_ident.html"><code>mod_cap.c</code></a><br>
317 This module is automatically added <i>unless</i> <code>--disable-ident</code> is used
318 </li>
319 </ul>
320
321 <p>
322 The above modules all live under the <code>modules/</code> directory in
323 the source distribution. So what modules are left to choose from? All
324 of the modules under the
325 <a href="../contrib/index.html"><code>contrib/</code></a> directory.
326
327 <p>
328 Optional ProFTPD modules are added to the build using the
329 <code>--with-modules</code> option. The value you provide is a colon-delimited
330 list of the module names you wish to add, as statically linked modules. Thus if
331 you wanted to add LDAP and SSL/TLS support to your <code>proftpd</code>, you
332 would list the appropriate modules in the <code>--with-modules</code> list:
333 <pre>
334 $ ./configure --with-modules=mod_ldap:mod_tls ...
335 </pre>
336 Do <b>not</b> include the names of any modules under the <code>modules/</code>
337 directory; the modules there are either mandatory or conditional. Attempting
338 to include a non-optional module in the <code>--with-modules</code> list
339 will result in a configure error.
340
341 <p>
342 The <code>--with-shared</code> option works much like
343 <code>--with-modules</code>. You provide a colon-delimited list of names
344 of modules to be compiled as shared modules. Note that using the
345 <code>--with-shared</code> option <b>requires</b> the use of
346 <code>--enable-dso</code>. Thus to add LDAP and SSL/TLS support as
347 shared modules, you would use:
348 <pre>
349 $ ./configure --enable-dso --with-shared=mod_ldap:mod_tls ...
350 </pre>
351 Failure to include the <code>--enable-dso</code> option when using
352 <code>--with-shared</code> results in a configure error:
353 <pre>
354 configure: error: cannot build shared modules without DSO support -- aborting
355 </pre>
356
357 <p>
358 You can add <i>some</i> of the automatically included modules as shared
359 modules, but not all of them. The following automatically included modules
360 <b>cannot</b> be compiled as shared/DSO modules:
361 <ul>
362 <li><code>mod_auth.c</code>
363 <li><code>mod_auth_unix.c</code>
364 <li><code>mod_core.c</code>
365 <li><code>mod_ls.c</code>
366 <li><code>mod_xfer.c</code>
367 </ul>
368 If your <code>--with-shared</code> list includes one of the above modules,
369 it will result in a configure error:
370 <pre>
371 $ ./configure --enable-dso --with-shared=mod_auth_unix ...
372 configure: error: cannot build mod_auth_unix as a shared module
373 </pre>
374 Why can't these be shared modules? These modules <b>must</b> appear in the
375 <code>proftpd</code> binary in order for it to function as a proper FTP server.
376 Yes, even <code>mod_auth_unix.c</code>; it is the default/fallback mechanism
377 for obtaining user/group names/IDs.
378
379 <p>
380 Do <b>not</b> use <code>--with-modules</code> or <code>--with-shared</code>
381 multiple times in your configure command; only the last one appearing
382 in the configure command will be used. You must consolidate all of the
383 modules you wish to add into a single colon-delimited list.
384
385 <p><a name="HeaderLibOptions">
386 <b>Header and Library Options</b><br>
387 The <code>--with-includes</code> option is used to add additional directories
388 containing header files to the system-defined list of header file directories
389 used by the compiler. Likewise, the <code>--with-libraries</code> option
390 is used to add additional directories containing libraries to the list
391 of library directories searched by the linker. Both options take
392 colon-delimited paths as the parameter.
393
394 <p>
395 For example, on Solaris, you have to explicitly tell the compiler and linker
396 to use the <code>/usr/local/include</code> and <code>/usr/local/lib</code>
397 directories:
398 <pre>
399 $ ./configure --with-includes=/usr/local/include --with-libraries=/usr/local/lib ...
400 </pre>
401
402 <p>
403 Or you may have the MySQL or OpenSSL packages installed in custom locations,
404 and you need to tell <code>configure</code> about those locations:
405 <pre>
406 $ ./configure --with-modules=mod_sql:mod_sql_mysql:mod_tls \
407 --with-includes=/usr/local/mysql/include/mysql:/usr/local/openssl/include \
408 --with-libraries=/usr/local/mysql/lib/mysql:/usr/local/openssl/lib
409 </pre>
410 These options are commonly used to specify the locations for LDAP, OpenSSL,
411 database, and other software packages used by modules.
412
413 <p>
414 Just as using <code>--with-modules</code> multiple times does <b>not</b>
415 work, using <code>--with-includes</code> or <code>--with-libraries</code>
416 multiple times does <b>not</b> work. Consolidate all of the directories
417 for headers (or libraries) into a single colon-delimited list, and use
418 <b>one</b> <code>--with-includes</code> option and <b>one</b>
419 <code>--with-libraries</code> option.
420
421 <p>
422 <b>Environment Variables</b><br>
423 As with most other GNU autoconf-based build system, the ProFTPD
424 <code>configure</code> script honors these environment variables:
425 <ul>
426 <li>CPPFLAGS
427 <li>CFLAGS
428 <li>DESTDIR
429 <li>LDFLAGS
430 <li>LIBS
431 </ul>
432 Use of these environment variables is for the more advanced users, system
433 administrators, and software developers and packagersl who know the environment
434 variable semantics.
435
436 <p>
437 <b>Putting It All Together</b><br>
438 Now, let's configure the build system for a <code>proftpd</code> that
439 does not include IDENT support, is installed under <code>/opt/proftpd/</code>
440 as user and group 'ftpd', has statically linked SSL/TLS support and dynamically
441 loaded SQL backend modules:
442 <pre>
443 $ install_user=ftpd install_group=ftpd ./configure \
444 --prefix=/opt/proftpd \
445 --disable-ident \
446 --enable-dso \
447 --with-modules=mod_tls \
448 --with-shared=mod_sql:mod_sql_mysql:mod_sql_postgres \
449 --with-includes=/usr/local/openssl/include:/usr/local/mysql/include/mysql:/usr/local/postgres/include \
450 --with-libraries=/usr/local/openssl/lib:/usr/local/mysql/lib/mysql:/usr/local/postgres/lib
451 </pre>
452 Hint: if your configure command becomes long or complicated, you might try
453 storing it in a <code>sh</code> script file, say 'proftpd-conf.sh'.
454
455 <p>
456 Watch the output of the <code>configure</code> script. After the configure
457 command has run, you may wish to inspect the <code>config.h</code> file to
458 make sure <code>configure</code> didn't make any wrong "guesses" for your
459 platform. If the configure command fails, keep a copy of the generated
460 <code>config.log</code> file. Include that file, and the configure error,
461 when asking/troubleshooting the error via the mailing lists.
462
463 <p>
464 <b>Compiling</b><br>
465 Now you are ready to actually compile the source code into working executables,
466 using all of your selected options and features and capabilities. To do
467 this, imply run 'make' from the top-level source directory:
468 <pre>
469 $ cd proftpd-<i>version</i>/
470 $ make
471 </pre>
472 On some systems (<i>e.g.</i> BSDI), you may need to use GNU <code>make</code>
473 (often called <code>gmake</code> or <code>gnumake</code>) instead of the
474 default system <code>make</code>. Watch the output of the compile process and
475 make sure no errors occur. On some platforms (notably AIX and IRIX) you may
476 see some compilation or link warnings. These generally can be ignored.
477
478 <p>
479 If you are interested in testing the compiled executables, read
480 this <a href="Testing.html">howto</a> about the testsuite that comes with
481 the ProFTPD source code.
482
483 <p>
484 To install the compiled executables, use:
485 <pre>
486 $ cd proftpd-<i>version</i>/
487 $ make install
488 </pre>
489 You are now prepared to start up and use your compiled <code>proftpd</code>.
490
491 <p><a name="DeveloperOptions">
492 <b>Developer Options</b><br>
493 OK, so you think you want to use the <code>--enable-devel</code> configure
494 option? You must keep in mind that this option is intended only for
495 development purposes; it is <b>not recommended for use in production
496 builds or packages</b>. If you are using a <code>proftpd</code> installed
497 from a package, try this command:
498 <pre>
499 $ /usr/local/sbin/proftpd -V
500 </pre>
501 if you see "+ Developer support" in the output, it means that your
502 package provider used the <code>--enable-devel</code> option when they
503 should not have. Let the package provider know about this, and point them
504 to this document.
505
506 <p>
507 Still here? If so, you are ready to learn how <code>--enable-devel</code>
508 is used for development and debugging. The <code>--enable-devel</code>
509 option, like many of ProFTPD's configure options, takes a colon-delimited
510 list of option names. The full list of supported developer options is
511 shown here:
512 <pre>
513 $ ./configure --enable-devel=coredump:nodaemon:nofork:profile:stacktrace ...
514 </pre>
515 You can also use just <code>--enable-devel</code> by itself, without any
516 specific option names:
517 <pre>
518 $ ./configure --enable-devel ...
519 </pre>
520 When <code>--enable-devel</code> is used, the executables that are installed
521 by the ProFTPD build system will not be stripped of their debugging symbols,
522 as is usually done in non-developer builds.
523
524 <p>
525 Let's look at what each one of these developer options does.
526
527 <p>
528 Enabling coredumps using the <code>coredump</code> option is a <b>bad idea</b>.
529 ProFTPD goes out of its way to ensure that it does <b>not</b> generate coredump
530 files. Since the <code>proftpd</code> server is usually run with root
531 privileges (in order to use port 21, look up passwords, <i>etc</i>), any
532 coredump files generated could possibly contain sensitive information (such as
533 users' passwords). The only people who should be looking at coredump files are
534 developers, and even then there are better ways of debugging issues.
535 <b>Note</b> that if the <code>coredump</code> option is used, proftpd will
536 <b>not</b> switch the UID/GID to the <code>User</code>/<code>Group</code>
537 defined in the config file, nor to that of the logged-in user. Unix kernels
538 are notoriously picky about generating coredumps for processes that have
539 changed their effective UID/GID; they won't do it. Thus the ID switching
540 is disabled in order to make it possible to get a coredump. Again, it is
541 a <b>bad idea</b> to run a proftpd built with <code>coredump</code> in
542 production.
543
544 <p>
545 The <code>nodaemon</code> option makes it such that the <code>proftpd</code>
546 server <b>cannot</b> daemonize. It cannot detach from the terminal, and
547 cannot run in the background. This is mostly useful for running
548 <code>proftpd</code> under a debugger such as <code>gdb</code>.
549
550 <p>
551 The <code>nofork</code> option makes a <code>proftpd</code> that cannot
552 use the <code>fork(2)</code> system call to create a new process to handle
553 the client connection, turning <code>proftpd</code> into a single-process
554 server. Like the <code>nodaemon</code> option, this is useful mainly for
555 running <code>proftpd</code> under a debugger.
556
557 <p>
558 The <code>profile</code> option causes a profiling library to be linked into
559 the compiled <code>proftpd</code> executable. Running the executable will
560 then automatically write out profiling information suitable for use by
561 a profiler such as <code>gprof</code>.
562
563 <p>
564 Finally, there is the <code>stacktrace</code> option. It is possible, if the
565 GNU C library is used, to have a program automatically provide a stack trace
566 showing the function call stack, such as when the <code>SIGSEGV</code> signal
567 is received (<i>i.e.</i> the program segfaulted). Often times when debugging
568 issues like segfaults, the hardest part is pinpointing the exact source
569 of the segfault, and what functions were called to reach that point. Thus
570 seeing a stack trace (also called a "backtrace") is quite useful for
571 developers.
572
573 <p>
574 Let's say you configured the build for stacktrace support:
575 <pre>
576 $ ./configure --enable-devel=stacktrace ...
577 </pre>
578 If/when a SIGSEGV occurs, the logs should show something like this:
579 <pre>
580 golem.castaglia.org (127.0.0.1[127.0.0.1]) - ProFTPD terminating (signal 11)
581 golem.castaglia.org (127.0.0.1[127.0.0.1]) - FTP session closed.
582 golem.castaglia.org (127.0.0.1[127.0.0.1]) - -----BEGIN STACK TRACE-----
583 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [0] ./proftpd [0x809b1e1]
584 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [1] ./proftpd(call_module+0x53) [0x8072c63]
585 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [2] ./proftpd(strftime+0x14cf) [0x8051bef]
586 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [3] ./proftpd(pr_cmd_dispatch+0x167) [0x8051f2f]
587 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [4] ./proftpd(strftime+0x1fd3) [0x80526f3]
588 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [5] ./proftpd [0x8053e12]
589 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [6] ./proftpd [0x805484d]
590 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [7] ./proftpd [0x8057975]
591 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [8] ./proftpd(main+0x9d1) [0x8058625]
592 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [9] /lib/i686/libc.so.6(__libc_start_main+0x93) [0x40076507]
593 golem.castaglia.org (127.0.0.1[127.0.0.1]) - [10] ./proftpd(strcpy+0x31) [0x8051001]
594 golem.castaglia.org (127.0.0.1[127.0.0.1]) - -----END STACK TRACE-----
595 </pre>
596 These function call symbols or "frames" are generated automatically by the C
597 library; the hexadecimal numbers are memory addresses.
598
599 <p>
600 The key for tracking down the location of the segfault is the <i>first</i>
601 frame; in this case, "[0] ./proftpd [0x809b1e1]" and the memory address
602 0x809b1e1. Using the <code>addr2line</code> command (which you may need to
603 install separately on your system) and that memory address, you can determine
604 the location of the segfault source:
605 <pre>
606 $ addr2line -e /usr/local/sbin/proftpd 0x809b1e1
607 </pre>
608 In this particular case, I saw:
609 <pre>
610 $ addr2line -e /usr/local/sbin/proftpd 0x809b1e1
611 /home/tj/proftpd/cvs/proftpd/modules/mod_auth.c:1723
612 </pre>
613 which is the location of test code I added to deliberately trigger a segfault.
614
615 <p>
616 There are some other noteworthy requirements for this automatic stacktrace
617 support. First, each <code>proftpd</code> binary can be subtly different,
618 depending on the exact configure command, shared modules loaded, <i>etc</i>.
619 Thus the <code>addr2line</code> command <b>must</b> be run on the same
620 system as the segfaulting <code>proftpd</code> binary, and must be run on
621 that same binary. Using the memory address and <code>addr2line</code>
622 on a different <code>proftpd</code>, or on a different system, will not
623 work. Second, using the <code>stacktrace</code> developer option disables
624 the changing of the process title that <code>proftpd</code> normally does.
625 The obtaining of the stack symbols that is done uses the process title, and if
626 the <code>stacktrace</code> option did not disable that process title changing,
627 the output would be much less legible. The automatic stacktrace code
628 in the C library will not work if the process has been chrooted (<i>i.e.</i>
629 you use the <code>DefaultRoot</code> and/or <code>&lt;Anonymous&gt;</code>
630 directives); I suspect this has to do with hardcoded assumptions in the
631 C library itself which are broken in a chrooted process. Finally, use
632 of the <code>-fomit-frame-pointer</code> compiler option will cause the
633 stacktrace feature to not work; those omitted frame pointers contain
634 exactly the frame symbols/addresses that we want to capture.
635
636 <p>
637 The <code>stacktrace</code> feature is known to work on Linux platform.
638 On FreeBSD, you need to install the libexecinfo library from the Ports
639 collection. On Mac OSX, you must be running 10.5 in order to have the
640 proper C library support.
641
642 <p><a name="FAQ">
643 <b>Frequently Asked Questions</b><br>
644
645 <p>
646 <font color=red>Question</font>: Why do I get a configure error about a
647 "duplicate build request", like this:
648 <pre>
649 checking checking for duplicate module requests... yes
650 configure: error: duplicate build request for mod_delay -- aborting
651 </pre>
652 <font color=blue>Answer</font>: This happens when your
653 <code>--with-modules</code> list contains one of the automatically included
654 modules (see <a href="#ModuleOptions">above</a>). In this example, the
655 <code>mod_delay</code> module appeared in the <code>--with-modules</code>
656 list.
657
658 <p>
659 Note that older releases of ProFTPD did not check for these types of
660 "duplicate build requests". If you are having problems with your
661 <code>proftpd</code> and you see the same module appear multiple times in
662 the output from running:
663 <pre>
664 $ /usr/local/sbin/proftpd -l
665 </pre>
666 Then you should re-configure and re-compile your <code>proftpd</code>, making
667 sure that no automatically included modules appear in your
668 <code>--with-modules</code> configure option.
669
670 <p>
671 <font color=red>Question</font>: Why do I get a configure error like this:
672 <pre>
673 configure: error: source file './modules/d_auth_pam.c' cannot be found -- aborting
674 </pre>
675 <font color=blue>Answer</font>: Notice how the name of the module reported
676 there is "d_auth_pam.c", rather than "mod_auth_pam.c"? If you see a mangled
677 module name like this, it probably means that your <code>--with-modules</code>
678 or <code>--with-shared</code> module lists contain a double colon, <i>e.g.</i>:
679 <pre>
680 $ ./configure --with-modules=mod_sql<b>::</b>mod_sql_mysql:...
681 </pre>
682 or:
683 <pre>
684 $ ./configure --with-shared=mod_sql<b>::</b>mod_sql_mysql:...
685 </pre>
686 <i>Use only a single colon between module names</i>; this should fix this error.
687
688 <p>
689 <font color=red>Question</font>: I installed ProFTPD, and encountered this
690 error when trying to use <code>ftptop</code>:
691 <pre>
692 $ ftptop
693 ftptop: no curses or ncurses library on this system
694 </pre>
695 So I installed the <code>ncurses</code> library on my system, and compiled
696 ProFTPD again. But the error still occurs! Why?<br>
697 <font color=blue>Answer</font>: The ProFTPD build system discovers the
698 libraries it needs, like <code>curses</code> or <code>ncurses</code>, as part
699 of the running of the <code>configure</code> command; the results of those
700 discoveries are recorded in the generated <code>config.h</code> (and other)
701 files.
702
703 <p>
704 This means that if you install a needed library <i>after</i> building ProFTPD,
705 you need to <i>re-run <code>configure</code>, <code>make</code>, etc</i> in
706 order for ProFTPD to discover that new library and use it:
707 <pre>
708 $ cd /path/to/proftpd/
709 $ make clean
710 $ ./configure ...
711 $ make
712 $ make install
713 </pre>
714 The "make clean" step is necessary, to clean up any leftover state from the
715 previous build.
716
717 <p>
718 <font color=red>Question</font>: I can't seem to compile <code>mod_tls</code>
719 <b>and</b> <code>mod_sql</code>. Using one or the other works (<i>i.e.</i>
720 shows up in the <code>`proftpd -l`</code> list), but not both. I'm using the
721 following configure command:
722 <pre>
723 $ ./configure --with-modules=mod_tls --with-modules=mod_sql:mod_sql_mysql ...
724 </pre>
725 <font color=blue>Answer</font>: The problem is that the
726 <code>--with-modules</code> option cannot appear multiple times in the
727 configure command. If it does, only the last one seen on the command line
728 wins. In this case, the user would need to put all of the desired modules
729 into <b>one</b> colon-delimited list, <i>e.g.</i>:
730 <pre>
731 $ make clean
732 $ ./configure --with-modules=mod_tls:mod_sql:mod_sql_mysql ...
733 </pre>
734 And keep in mind that the same restriction holds true for the
735 <code>--with-includes</code> and <code>--with-libraries</code> options.
736
737 <p>
738 <font color=red>Question</font>: I try to start my <code>proftpd</code>,
739 but I get this error:
740 <pre>
741 warning: the mod_sql_mysql module has not been properly initialized. Please
742 make sure your --with-modules configure option lists mod_sql *before*
743 mod_sql_mysql, and recompile.
744 </pre>
745 <font color=blue>Answer</font>: The issue here is that the
746 <a href="../contrib/mod_sql.html"><code>mod_sql</code></a> family of modules
747 (including <code>mod_sql_mysql</code>, <code>mod_sql_postgres</code>,
748 <code>mod_sql_odbc</code>, and <code>mod_sql_sqlite</code>) is rather
749 particular about the order in which they appear in the
750 <code>--with-modules</code> list. The ordering affects the order in which
751 the modules are loaded when <code>proftpd</code> starts up. The above
752 error, for example, happens when <code>--with-modules</code> looks like:
753 <pre>
754 $ ./configure --with-modules=mod_sql_mysql:<b>mod_sql</b> (<i><font color=red>wrong</font></i>)
755 </pre>
756 but the <code>mod_sql</code> module needs to be loaded first, so that later,
757 when <code>mod_sql_mysql</code> loads, the expected <code>mod_sql</code>
758 code is present. Thus the proper ordering is to make sure that
759 <code>mod_sql</code> appears <i>before</i> any of the database-specific
760 backend modules:
761 <pre>
762 $ ./configure --with-modules=<b>mod_sql</b>:mod_sql_mysql (<i><font color=green>correct</font></i>)
763 </pre>
764
765 <p>
766 Note that this ordering issue occurs for the
767 <a href="../contrib/mod_quotatab.html"><code>mod_quotatab</code></a> and
768 <a href="../contrib/mod_wrap2.html"><code>mod_wrap2</code></a> families of
769 modules as well.
770
771 <p>
772 <font color=red>Question</font>: Why do I get a "Controls support required"
773 error when I try to compile <code>proftpd</code>?
774 <pre>
775 mod_ctrls.c:49:3: #error "Controls support required (use --enable-ctrls)"
776 </pre>
777 <font color=blue>Answer</font>: The error is trying to tell you that that
778 module (the <a href="../modules/mod_ctrls.html"><code>mod_ctrls</code></a>
779 module, in this case) requires <a href="Controls.html">Controls</a> support,
780 and that you need to supply the <code>--enable-ctrls</code> option in
781 your configure command when compiling <code>proftpd</code>.
782
783 <p>
784 <font color=red>Question</font>: How do I get a statically linked
785 <code>proftpd</code> binary?<br>
786 <font color=blue>Answer</font>: To do this, using the following:
787 <pre>
788 $ make clean
789 $ ./configure LDFLAGS="-Wl,-static" ...
790 </pre>
791 Do <b>not</b> try to use the "-static" value for the CFLAGS or LDFLAGS
792 environment variables, or try to edit the Make.rules file to tweak the
793 options. ProFTPD's build system uses libtool, and thus the above method
794 is the way to get a statically linked <code>proftpd</code> executable:
795 <pre>
796 $ make
797 $ ldd ./proftpd
798 not a dynamic executable
799 </pre>
800
801 <p>
802 <font color=red>Question</font>: I have a very long line in my
803 <code>proftpd.conf</code>, and when I try to start <code>proftpd</code> I
804 see this:
805 <pre>
806 warning: handling possibly truncated configuration data at line 17 of '/etc/proftpd.conf'
807 Fatal: unknown configuration directive ')"' on line 18 of '/etc/proftpd.conf'
808 </pre>
809 How can I avoid this error?<br>
810 <font color=blue>Answer</font>: If possible, you should try to break up your
811 long directive line into multiple lines, using a backslash. For example:
812 <pre>
813 Allow 1.2.3.4 5.6.7.8 9.10.11.12
814 </pre>
815 can also appear as:
816 <pre>
817 Allow \
818 1.2.3.4 \
819 5.6.7.8 \
820 9.10.11.12
821 </pre>
822 However, if this approach cannot be used (<i>e.g.</i> your configuration has
823 a single parameter which exceeds the 1024 byte buffer limit, and which
824 <b>cannot</b> be broken up), then you will have to recompile
825 <code>proftpd</code> with a larger buffer size. To do this, use the
826 <code>--enable-buffer-size</code> configure option, <i>e.g.</i>:
827 <pre>
828 $ ./configure --enable-buffer-size=2048 ...
829 </pre>
830
831 <p>
832 <font color=red>Question</font>: What is the difference between the
833 <code>--enable-shadow</code> and the <code>--enable-autoshadow</code> configure
834 options, and when do I use them?<br>
835 <font color=blue>Answer</font>: The <code>--enable-shadow</code> configure
836 option enables support for <em>shadow</em> files,
837 <i>e.g.</i> <code>/etc/shadow</code> and the related C library functions.
838 On other Unix platforms, though, use "transparent shadow" support, where
839 the normal C library functions are used; only when root privileges are used
840 to call those functions will the actual password be obtained from the shadow
841 files. Support for this approach is enabled by the
842 <code>--enable-autoshadow</code> option.
843
844 <p>
845 If you are not sure which to use, try using both <code>--enable-shadow</code>
846 and <code>--enable-autoshadow</code>.
847
848 <p>
849 <font color=red>Question</font>: Why can't I compile ProFTPD from source using
850 directory names that contain spaces?<br>
851 <pre>
852 $ cd /path/to/ProFTPD Source/
853 $ ./configure ...
854
855 configure: WARNING: Libtool does not cope well with whitespace in `pwd`
856 </pre>
857 <font color=blue>Answer</font>: Unfortunately, the <code>autoconf</code> and
858 <code>libtool</code> tools do not work with such directory names. The
859 solution is to rename the directories, to names that do not have whitespace in
860 them.
861
862 <p>
863 <hr>
864 <font size=2><b><i>
865 &copy; Copyright 2017-2020 The ProFTPD Project<br>
866 All Rights Reserved<br>
867 </i></b></font>
868 <hr>
869
870 </body>
871 </html>