"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "mysql-4.0.27/INSTALL-SOURCE" of archive mysql-4.0.27-win-src.zip:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 2.9 MySQL Installation Using a Source Distribution
2 ==================================================
3
4 * Menu:
5
6 * quick-install:: Source Installation Overview
7 * configure-options:: Typical `configure' Options
8 * installing-source-tree:: Installing from the Development Source Tree
9 * compilation-problems:: Dealing with Problems Compiling MySQL
10 * mit-pthreads:: MIT-pthreads Notes
11 * windows-source-build:: Installing MySQL from Source on Windows
12 * windows-client-compiling:: Compiling MySQL Clients on Windows
13
14 Before you proceed with an installation from source, first check
15 whether our binary is available for your platform and whether it works
16 for you. We put a great deal of effort into ensuring that our binaries
17 are built with the best possible options.
18
19 To obtain a source distribution for MySQL, *Note getting-mysql::.
20
21 MySQL source distributions are provided as compressed `tar' archives
22 and have names of the form `mysql-VERSION.tar.gz', where VERSION is a
23 number like `4.1.13'.
24
25 You need the following tools to build and install MySQL from source:
26
27 * GNU `gunzip' to uncompress the distribution.
28
29 * A reasonable `tar' to unpack the distribution. GNU `tar' is known
30 to work. Some operating systems come with a pre-installed version
31 of `tar' that is known to have problems. For example, Mac OS X
32 `tar' and Sun `tar' are known to have problems with long
33 filenames. On Mac OS X, you can use the pre-installed `gnutar'
34 program. On other systems with a deficient `tar', you should
35 install GNU `tar' first.
36
37 * A working ANSI C++ compiler. `gcc' 2.95.2 or later, `egcs' 1.0.2
38 or later or `egcs 2.91.66', SGI C++, and SunPro C++ are some of the
39 compilers that are known to work. `libg++' is not needed when
40 using `gcc'. `gcc' 2.7.x has a bug that makes it impossible to
41 compile some perfectly legal C++ files, such as `sql/sql_base.cc'.
42 If you have only `gcc' 2.7.x, you must upgrade your `gcc' to be
43 able to compile MySQL. `gcc' 2.8.1 is also known to have problems
44 on some platforms, so it should be avoided if a new compiler
45 exists for the platform.
46
47 `gcc' 2.95.2 or later is recommended when compiling MySQL 3.23.x.
48
49 * A good `make' program. GNU `make' is always recommended and is
50 sometimes required. If you have problems, we recommend GNU `make'
51 3.75 or newer.
52
53 If you are using a version of `gcc' recent enough to understand the
54 -fno-exceptions option, it is _very important_ that you use this option.
55 Otherwise, you may compile a binary that crashes randomly. We also
56 recommend that you also use -felide-constructors and -fno-rtti as well.
57 When in doubt, do the following:
58
59 CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
60 -fno-exceptions -fno-rtti" ./configure \
61 --prefix=/usr/local/mysql --enable-assembler \
62 --with-mysqld-ldflags=-all-static
63
64 On most systems, this gives you a fast and stable binary.
65
66 If you run into problems and need to file a bug report, please use the
67 instructions in *Note bug-reports::.
68
69 File: manual.info, Node: quick-install, Next: configure-options, Prev: installing-source, Up: installing-source
70
71 2.9.1 Source Installation Overview
72 ----------------------------------
73
74 The basic commands that you must execute to install a MySQL source
75 distribution are:
76
77 shell> groupadd mysql
78 shell> useradd -g mysql mysql
79 shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
80 shell> cd mysql-VERSION
81 shell> ./configure --prefix=/usr/local/mysql
82 shell> make
83 shell> make install
84 shell> cp support-files/my-medium.cnf /etc/my.cnf
85 shell> cd /usr/local/mysql
86 shell> bin/mysql_install_db --user=mysql
87 shell> chown -R root .
88 shell> chown -R mysql var
89 shell> chgrp -R mysql .
90 shell> bin/mysqld_safe --user=mysql &
91
92 For versions of MySQL older than 4.0, substitute `bin/safe_mysqld' for
93 `bin/mysqld_safe' in the final command.
94
95 If you start from a source RPM, do the following:
96
97 shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
98
99 This makes a binary RPM that you can install. For older versions of
100 RPM, you may have to replace the command `rpmbuild' with `rpm' instead.
101
102 *Note*: This procedure does not set up any passwords for MySQL
103 accounts. After following the procedure, proceed to *Note
104 post-installation::, for post-installation setup and testing.
105
106 A more detailed version of the preceding description for installing
107 MySQL from a source distribution follows:
108
109 1. Add a login user and group for `mysqld' to run as:
110
111 shell> groupadd mysql
112 shell> useradd -g mysql mysql
113
114 These commands add the `mysql' group and the `mysql' user. The
115 syntax for `useradd' and `groupadd' may differ slightly on
116 different versions of Unix, or they may have different names such
117 as `adduser' and `addgroup'.
118
119 You might want to call the user and group something other than
120 `mysql'. If so, substitute the appropriate name in the following
121 steps.
122
123 2. Pick the directory under which you want to unpack the distribution
124 and change location into it.
125
126 3. Obtain a distribution file using the instructions in *Note
127 getting-mysql::.
128
129 4. Unpack the distribution into the current directory:
130
131 shell> gunzip < /PATH/TO/MYSQL-VERSION.tar.gz | tar xvf -
132
133 This command creates a directory named `mysql-VERSION'.
134
135 With GNU `tar', no separate invocation of `gunzip' is necessary.
136 You can use the following alternative command to uncompress and
137 extract the distribution:
138
139 shell> tar zxvf /PATH/TO/MYSQL-VERSION-OS.tar.gz
140
141 5. Change location into the top-level directory of the unpacked
142 distribution:
143
144 shell> cd mysql-VERSION
145
146 Note that currently you must configure and build MySQL from this
147 top-level directory. You cannot build it in a different directory.
148
149 6. Configure the release and compile everything:
150
151 shell> ./configure --prefix=/usr/local/mysql
152 shell> make
153
154 When you run `configure', you might want to specify other options.
155 Run `./configure --help' for a list of options. *Note
156 configure-options::, discusses some of the more useful options.
157
158 If `configure' fails and you are going to send mail to a MySQL
159 mailing list to ask for assistance, please include any lines from
160 `config.log' that you think can help solve the problem. Also
161 include the last couple of lines of output from `configure'. To
162 file a bug report, please use the instructions in *Note
163 bug-reports::.
164
165 If the compile fails, see *Note compilation-problems::, for help.
166
167 7. Install the distribution:
168
169 shell> make install
170
171 If you want to set up an option file, use one of those present in
172 the `support-files' directory as a template. For example:
173
174 shell> cp support-files/my-medium.cnf /etc/my.cnf
175
176 You might need to run these commands as `root'.
177
178 If you want to configure support for `InnoDB' tables, you should
179 edit the `/etc/my.cnf' file, removing the `#' character before the
180 option lines that start with `innodb_...', and modify the option
181 values to be what you want. See *Note option-files::, and *Note
182 innodb-configuration::.
183
184 8. Change location into the installation directory:
185
186 shell> cd /usr/local/mysql
187
188 9. If you have not installed MySQL before, you must create the MySQL
189 grant tables:
190
191 shell> bin/mysql_install_db --user=mysql
192
193 If you run the command as `root', you should use the -user option
194 as shown. The value of the option should be the name of the login
195 account that you created in the first step to use for running the
196 server. If you run the command while logged in as that user, you
197 can omit the -user option.
198
199 Note that for MySQL versions older than 3.22.10,
200 `mysql_install_db' left the server running after creating the
201 grant tables. This is no longer true; you need to restart the
202 server after performing the remaining steps in this procedure.
203
204 10. Change the ownership of program binaries to `root' and ownership
205 of the data directory to the user that you run `mysqld' as.
206 Assuming that you are in the installation directory
207 (`/usr/local/mysql'), the commands look like this:
208
209 shell> chown -R root .
210 shell> chown -R mysql var
211 shell> chgrp -R mysql .
212
213 The first command changes the owner attribute of the files to the
214 `root' user. The second changes the owner attribute of the data
215 directory to the `mysql' user. The third changes the group
216 attribute to the `mysql' group.
217
218 11. If you want MySQL to start automatically when you boot your
219 machine, you can copy `support-files/mysql.server' to the location
220 where your system has its startup files. More information can be
221 found in the script itself, and in *Note automatic-start::.
222
223 12. You can set up new accounts using the `bin/mysql_setpermission'
224 script if you install the `DBI' and `DBD::mysql' Perl modules. For
225 instructions, see *Note perl-support::.
226
227 After everything has been installed, you should test your distribution.
228 To start the MySQL server, use the following command:
229
230 shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
231
232 For versions of MySQL older than 4.0, substitute `safe_mysqld' for
233 `mysqld_safe' in the command.
234
235 If that command fails immediately and prints `mysqld ended', you can
236 find some information in the `HOST_NAME.err' file in the data directory.
237
238 More information about `mysqld_safe' is given in *Note mysqld-safe::.
239
240 *Note*: The accounts that are listed in the MySQL grant tables
241 initially have no passwords. After starting the server, you should set
242 up passwords for them using the instructions in *Note
243 post-installation::.
244
245 File: manual.info, Node: configure-options, Next: installing-source-tree, Prev: quick-install, Up: installing-source
246
247 2.9.2 Typical `configure' Options
248 ---------------------------------
249
250 The `configure' script gives you a great deal of control over how you
251 configure a MySQL source distribution. Typically you do this using
252 options on the `configure' command line. You can also affect
253 `configure' using certain environment variables. See *Note
254 environment-variables::. For a list of options supported by
255 `configure', run this command:
256
257 shell> ./configure --help
258
259 Some of the more commonly used `configure' options are described here:
260
261 * To compile just the MySQL client libraries and client programs and
262 not the server, use the -without-server option:
263
264 shell> ./configure --without-server
265
266 If you have no C++ compiler, some client programs such as `mysql'
267 cannot be compiled because they require C++.. In this case, you
268 can remove the code in `configure' that tests for the C++ compiler
269 and then run `./configure' with the -without-server option. The
270 compile step should still try to build all clients, but you can
271 ignore any warnings about files such as `mysql.cc'. (If `make'
272 stops, try `make -k' to tell it to continue with the rest of the
273 build even if errors occur.)
274
275 * If you want to build the embedded MySQL library (`libmysqld.a'),
276 use the -with-embedded-server option.
277
278 * If you do not want your log files and database directories located
279 under `/usr/local/var', use a `configure' command something like
280 one of these:
281
282 shell> ./configure --prefix=/usr/local/mysql
283 shell> ./configure --prefix=/usr/local \
284 --localstatedir=/usr/local/mysql/data
285
286 The first command changes the installation prefix so that
287 everything is installed under `/usr/local/mysql' rather than the
288 default of `/usr/local'. The second command preserves the default
289 installation prefix, but overrides the default location for
290 database directories (normally `/usr/local/var') and changes it to
291 `/usr/local/mysql/data'.
292
293 You can also specify the locations at server startup time by using
294 a MySQL option file. See *Note option-files::.
295
296 * If you are using Unix and you want the MySQL socket file location
297 to be somewhere other than the default location (normally in the
298 directory `/tmp' or `/var/run'), use a `configure' command like
299 this:
300
301 shell> ./configure \
302 --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
303
304 The socket filename must be an absolute pathname. You can also
305 change the location of `mysql.sock' at server startup by using a
306 MySQL option file. See *Note problems-with-mysql-sock::.
307
308 * If you want to compile statically linked programs (for example, to
309 make a binary distribution, to get better performance, or to work
310 around problems with some Red Hat Linux distributions), run
311 `configure' like this:
312
313 shell> ./configure --with-client-ldflags=-all-static \
314 --with-mysqld-ldflags=-all-static
315
316 * If you are using `gcc' and do not have `libg++' or `libstdc++'
317 installed, you can tell `configure' to use `gcc' as your C++
318 compiler:
319
320 shell> CC=gcc CXX=gcc ./configure
321
322 When you use `gcc' as your C++ compiler, it does not attempt to
323 link in `libg++' or `libstdc++'. This may be a good thing to do
324 even if you have those libraries installed. Some versions of them
325 have caused strange problems for MySQL users in the past.
326
327 The following list indicates some compilers and environment
328 variable settings that are commonly used with each one.
329
330 * `gcc' 2.7.2:
331
332 CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
333
334 * `egcs' 1.0.3a:
335
336 CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors \
337 -fno-exceptions -fno-rtti"
338
339 * `gcc' 2.95.2:
340
341 CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
342 -felide-constructors -fno-exceptions -fno-rtti"
343
344 * `pgcc' 2.90.29 or newer:
345
346 CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
347 CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
348 -felide-constructors -fno-exceptions -fno-rtti"
349
350 In most cases, you can get a reasonably optimized MySQL binary by
351 using the options from the preceding list and adding the following
352 options to the `configure' line:
353
354 --prefix=/usr/local/mysql --enable-assembler \
355 --with-mysqld-ldflags=-all-static
356
357 The full `configure' line would, in other words, be something like
358 the following for all recent `gcc' versions:
359
360 CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
361 -felide-constructors -fno-exceptions -fno-rtti" ./configure \
362 --prefix=/usr/local/mysql --enable-assembler \
363 --with-mysqld-ldflags=-all-static
364
365 The binaries we provide on the MySQL Web site at
366 `http://dev.mysql.com/downloads/' are all compiled with full
367 optimization and should be perfect for most users. See *Note
368 mysql-binaries::. There are some configuration settings you can
369 tweak to build an even faster binary, but these are only for
370 advanced users. See *Note compile-and-link-options::.
371
372 If the build fails and produces errors about your compiler or
373 linker not being able to create the shared library
374 `libmysqlclient.so.N' (where N is a version number), you can work
375 around this problem by giving the -disable-shared option to
376 `configure'. In this case, `configure' does not build a shared
377 `libmysqlclient.so.N' library.
378
379 * By default, MySQL uses the `latin1' (cp1252 West European)
380 character set. To change the default set, use the -with-charset
381 option:
382
383 shell> ./configure --with-charset=CHARSET
384
385 CHARSET may be one of `big5', `cp1251', `cp1257', `czech',
386 `danish', `dec8', `dos', `euc_kr', `gb2312', `gbk', `german1',
387 `hebrew', `hp8', `hungarian', `koi8_ru', `koi8_ukr', `latin1',
388 `latin2', `sjis', `swe7', `tis620', `ujis', `usa7', or
389 `win1251ukr'. See *Note character-sets::.
390
391 As of MySQL 4.1.1, the default collation may also be specified.
392 MySQL uses the `latin1_swedish_ci' collation. To change this, use
393 the -with-collation option:
394
395 shell> ./configure --with-collation=COLLATION
396
397 To change both the character set and the collation, use both the
398 -with-charset and -with-collation options. The collation must be a
399 legal collation for the character set. (Use the `SHOW COLLATION'
400 statement to determine which collations are available for each
401 character set.)
402
403 If you want to convert characters between the server and the
404 client, you should use the `SET NAMES' statement. See *Note
405 set-option::, and *Note charset-connection::.
406
407 *Warning:* If you change character sets after having created any
408 tables, you have to run `myisamchk -r -q
409 --set-collation=COLLATION_NAME' on every `MyISAM' table. Your
410 indexes may be sorted incorrectly otherwise. This can happen if you
411 install MySQL, create some tables, and then reconfigure MySQL to
412 use a different character set and reinstall it. (Use
413 -set-character-set before MySQL 4.1.1.)
414
415 With the `configure' option -with-extra-charsets=LIST, you can
416 define which additional character sets should be compiled into the
417 server. LIST is one of the following:
418
419 * A list of character set names separated by spaces
420
421 * `complex' to include all character sets that can't be
422 dynamically loaded
423
424 * `all' to include all character sets into the binaries
425
426 * To configure MySQL with debugging code, use the -with-debug option:
427
428 shell> ./configure --with-debug
429
430 This causes a safe memory allocator to be included that can find
431 some errors and that provides output about what is happening. See
432 *Note debugging-server::.
433
434 * If your client programs are using threads, you must compile a
435 thread-safe version of the MySQL client library with the
436 -enable-thread-safe-client configure option. This creates a
437 `libmysqlclient_r' library with which you should link your threaded
438 applications. See *Note threaded-clients::.
439
440 * It is now possible to build MySQL with big table support using the
441 -with-big-tables option, beginning with the following MySQL
442 versions:
443
444 * *4.0 series*: 4.0.25
445
446 * *4.1 series*: 4.1.11
447
448 This option causes the variables used to keep table row counts to
449 be stored using `unsigned long long' rather than `unsigned long'.
450 What this does is to allow tables to hold up to approximately
451 1.844E+19 ((232)2) rows rather than 232 (~4.295E+09) rows.
452 Previously it was necessary to pass -DBIG_TABLES to the compiler
453 manually in order to enable this feature.
454
455 * Options that pertain to particular operating systems can be found
456 in the system-specific section of this manual. See *Note
457 operating-system-specific-notes::.
458
459 File: manual.info, Node: installing-source-tree, Next: compilation-problems, Prev: configure-options, Up: installing-source
460
461 2.9.3 Installing from the Development Source Tree
462 -------------------------------------------------
463
464 *Caution*: You should read this section only if you are interested in
465 helping us test new code. If you just want to get MySQL up and running
466 on your system, you should use a standard release distribution (either
467 a binary or source distribution).
468
469 To obtain our most recent development source tree, first download and
470 install the BitKeeper free client if you do not have it. The client can
471 be obtained from `http://www.bitmover.com/bk-client.shar'.
472
473 To install the BitKeeper client on Unix, use these commands:
474
475 shell> sh bk-client.shar
476 shell> cd bk_client-1.1
477 shell> make all
478 shell> PATH=$PWD:$PATH
479
480 To install the BitKeeper client on Windows, use these instructions:
481
482 1. Download and install Cygwin from http://cygwin.com
483 (http://cygwin.com/).
484
485 2. Make sure `gcc' and `make' have been installed under Cygwin. You
486 can test this by issuing `which gcc' and `which make' commands. If
487 either one is not installed, run Cygwin's package manager, select
488 `gcc', `make', or both, and install them.
489
490 3. Under Cygwin, execute these commands:
491
492 shell> sh bk-client.shar
493 shell> cd bk_client-1.1
494
495 Then edit the `Makefile' and change the line that reads `$(CC)
496 $(CFLAGS) -o sfio -lz sfio.c' to this:
497
498 $(CC) $(CFLAGS) -o sfio sfio.c -lz
499
500 Now run the `make' command and set the path:
501
502 shell> make all
503 shell> PATH=$PWD:$PATH
504
505 The BitKeeper free client is shipped with its source code. The only
506 documentation available for the free client is the source code itself.
507
508 After you have installed the BitKeeper client, you can access the MySQL
509 development source tree:
510
511 1. Change location to the directory you want to work from, and then
512 use one of the following commands to make a local copy of the
513 MySQL version branch of your choice:
514
515 To copy the 3.23 branch, use this command:
516
517 shell> sfioball -r+ bk://mysql.bkbits.net/mysql-3.23 mysql-3.23
518
519 To copy the 4.0 branch, use this command:
520
521 shell> sfioball -r+ bk://mysql.bkbits.net/mysql-4.0 mysql-4.0
522
523 To copy the 4.1 branch, use this command:
524
525 shell> sfioball -r+ bk://mysql.bkbits.net/mysql-4.1 mysql-4.1
526
527 In the preceding examples, the source tree is set up in the
528 `mysql-3.23/', `mysql-4.0/', or `mysql-4.1/' subdirectory of your
529 current directory.
530
531 The initial download of the source tree may take a while,
532 depending on the speed of your connection. Please be patient.
533
534 2. You need GNU `make', `autoconf' 2.58 (or newer), `automake' 1.8,
535 `libtool' 1.5, and `m4' to run the next set of commands. Even
536 though many operating systems come with their own implementation
537 of `make', chances are high that the compilation fails with
538 strange error messages. Therefore, it is highly recommended that
539 you use GNU `make' (sometimes named `gmake') instead.
540
541 Fortunately, a large number of operating systems ship with the GNU
542 toolchain preinstalled or supply installable packages of these.
543 They can also be downloaded from the following locations:
544
545 * `http://www.gnu.org/software/autoconf/'
546
547 * `http://www.gnu.org/software/automake/'
548
549 * `http://www.gnu.org/software/libtool/'
550
551 * `http://www.gnu.org/software/m4/'
552
553 * `http://www.gnu.org/software/make/'
554
555 If you are trying to configure MySQL 4.1, you also need GNU
556 `bison' 1.75 or later. Older versions of `bison' may report this
557 error:
558
559 sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
560
561 Note: The maximum table size is not actually exceeded; the error
562 is caused by bugs in older versions of `bison'.
563
564 Versions of MySQL before version 4.1 may also compile with other
565 `yacc' implementations (for example, BSD `yacc' 91.7.30). For
566 later versions, GNU `bison' is required.
567
568 The following example shows the typical commands required to
569 configure a source tree. The first `cd' command changes location
570 into the top-level directory of the tree; replace `mysql-5.0' with
571 the appropriate directory name.
572
573 shell> cd mysql-5.0
574 shell> aclocal; autoheader
575 shell> libtoolize --automake --force
576 shell> automake --force --add-missing; autoconf
577 shell> (cd innobase; aclocal; autoheader; autoconf; automake)
578 shell> (cd bdb/dist; sh s_all)
579 shell> ./configure # Add your favorite options here
580 shell> make
581
582 Or you can use `BUILD/autorun.sh' as a shortcut for the following
583 sequence of commands:
584
585 shell> aclocal; autoheader
586 shell> libtoolize --automake --force
587 shell> automake --force --add-missing; autoconf
588 shell> (cd innobase; aclocal; autoheader; autoconf; automake)
589 shell> (cd bdb/dist; sh s_all)
590
591 The command lines that change directory into the `innobase' and
592 `bdb/dist' directories are used to configure the `InnoDB' and
593 Berkeley DB (`BDB') storage engines. You can omit these command
594 lines if you to not require `InnoDB' or `BDB' support.
595
596 If you get some strange errors during this stage, verify that you
597 really have `libtool' installed.
598
599 A collection of our standard configuration scripts is located in
600 the `BUILD' subdirectory. You may find it more convenient to use
601 the `BUILD/compile-pentium-debug' script than the preceding set of
602 shell commands. To compile on a different architecture, modify the
603 script by removing flags that are Pentium-specific.
604
605 3. When the build is done, run `make install'. Be careful with this
606 on a production machine; the command may overwrite your live
607 release installation. If you have another installation of MySQL,
608 we recommend that you run `./configure' with different values for
609 the -prefix, -with-tcp-port, and -unix-socket-path options than
610 those used for your production server.
611
612 4. Play hard with your new installation and try to make the new
613 features crash. Start by running `make test'. See *Note
614 mysql-test-suite::.
615
616 5. If you have gotten to the `make' stage, but the distribution does
617 not compile, please enter the problem into our bugs database using
618 the instructions given in *Note bug-reports::. If you have
619 installed the latest versions of the required GNU tools, and they
620 crash trying to process our configuration files, please report
621 that also. However, if you execute `aclocal' and get a `command not
622 found' error or a similar problem, do not report it. Instead, make
623 sure that all the necessary tools are installed and that your
624 `PATH' variable is set correctly so that your shell can find them.
625
626 6. After initially copying the repository with `sfioball' to obtain
627 the source tree, you should use `update' periodically to update
628 your local copy. To do this any time after you have set up the
629 repository, use this command: (the example is for updating the 4.1
630 branch):
631
632 shell> update bk://mysql.bkbits.net/mysql-4.1
633
634 7. You can examine the change history for the tree with all the diffs
635 by viewing the `BK/ChangeLog' file in the source tree and looking
636 at the `ChangeSet' descriptions listed there. To examine a
637 particular changeset, you would have to use the `sfioball' command
638 to extract two particular revisions of the source tree, and then
639 use an external `diff' command to compare them. If you see diffs
640 or code that you have a question about, do not hesitate to send
641 email to the MySQL `internals' mailing list. See *Note
642 mailing-lists::. If you think you have a better idea on how to do
643 something, send an email message to the same address with a patch.
644
645 You can also browse changesets, comments, and source code online. For
646 example, to browse this information for MySQL 4.1, go to
647 `http://mysql.bkbits.net:8080/mysql-4.1'.
648
649 File: manual.info, Node: compilation-problems, Next: mit-pthreads, Prev: installing-source-tree, Up: installing-source
650
651 2.9.4 Dealing with Problems Compiling MySQL
652 -------------------------------------------
653
654 All MySQL programs compile cleanly for us with no warnings on Solaris
655 or Linux using `gcc'. On other systems, warnings may occur due to
656 differences in system include files. See *Note mit-pthreads::, for
657 warnings that may occur when using MIT-pthreads. For other problems,
658 check the following list.
659
660 The solution to many problems involves reconfiguring. If you do need to
661 reconfigure, take note of the following:
662
663 * If `configure' is run after it has previously been run, it may use
664 information that was gathered during its previous invocation. This
665 information is stored in `config.cache'. When `configure' starts
666 up, it looks for that file and reads its contents if it exists, on
667 the assumption that the information is still correct. That
668 assumption is invalid when you reconfigure.
669
670 * Each time you run `configure', you must run `make' again to
671 recompile. However, you may want to remove old object files from
672 previous builds first because they were compiled using different
673 configuration options.
674
675 To prevent old configuration information or object files from being
676 used, run these commands before re-running `configure':
677
678 shell> rm config.cache
679 shell> make clean
680
681 Alternatively, you can run `make distclean'.
682
683 The following list describes some of the problems when compiling MySQL
684 that have been found to occur most often:
685
686 * If you get errors such as the ones shown here when compiling
687 `sql_yacc.cc', you probably have run out of memory or swap space:
688
689 Internal compiler error: program cc1plus got fatal signal 11
690 Out of virtual memory
691 Virtual memory exhausted
692
693 The problem is that `gcc' requires a huge amount of memory to
694 compile `sql_yacc.cc' with inline functions. Try running
695 `configure' with the -with-low-memory option:
696
697 shell> ./configure --with-low-memory
698
699 This option causes -fno-inline to be added to the compile line if
700 you are using `gcc' and -O0 if you are using something else. You
701 should try the -with-low-memory option even if you have so much
702 memory and swap space that you think you can't possibly have run
703 out. This problem has been observed to occur even on systems with
704 generous hardware configurations, and the -with-low-memory option
705 usually fixes it.
706
707 * By default, `configure' picks `c++' as the compiler name and GNU
708 `c++' links with -lg++. If you are using `gcc', that behavior can
709 cause problems during configuration such as this:
710
711 configure: error: installation or configuration problem:
712 C++ compiler cannot create executables.
713
714 You might also observe problems during compilation related to
715 `g++', `libg++', or `libstdc++'.
716
717 One cause of these problems is that you may not have `g++', or you
718 may have `g++' but not `libg++', or `libstdc++'. Take a look at the
719 `config.log' file. It should contain the exact reason why your C++
720 compiler did not work. To work around these problems, you can use
721 `gcc' as your C++ compiler. Try setting the environment variable
722 `CXX' to `"gcc -O3"'. For example:
723
724 shell> CXX="gcc -O3" ./configure
725
726 This works because `gcc' compiles C++ source files as well as
727 `g++' does, but does not link in `libg++' or `libstdc++' by
728 default.
729
730 Another way to fix these problems is to install `g++', `libg++',
731 and `libstdc++'. However, we recommend that you not use `libg++' or
732 `libstdc++' with MySQL because this only increases the binary size
733 of `mysqld' without providing any benefits. Some versions of these
734 libraries have also caused strange problems for MySQL users in the
735 past.
736
737 Using `gcc' as the C++ compiler is also required if you want to
738 compile MySQL with RAID functionality (see *Note create-table::,
739 for more info on RAID table type) and you are using GNU `gcc'
740 version 3 and above. If you get errors like those following during
741 the linking stage when you configure MySQL to compile with the
742 option -with-raid, try to use `gcc' as your C++ compiler by
743 defining the `CXX' environment variable:
744
745 gcc -O3 -DDBUG_OFF -rdynamic -o isamchk isamchk.o sort.o libnisam.a
746 ../mysys/libmysys.a ../dbug/libdbug.a ../strings/libmystrings.a
747 -lpthread -lz -lcrypt -lnsl -lm -lpthread
748 ../mysys/libmysys.a(raid.o)(.text+0x79): In function
749 `my_raid_create':: undefined reference to `operator new(unsigned)'
750 ../mysys/libmysys.a(raid.o)(.text+0xdd): In function
751 `my_raid_create':: undefined reference to `operator delete(void*)'
752 ../mysys/libmysys.a(raid.o)(.text+0x129): In function
753 `my_raid_open':: undefined reference to `operator new(unsigned)'
754 ../mysys/libmysys.a(raid.o)(.text+0x189): In function
755 `my_raid_open':: undefined reference to `operator delete(void*)'
756 ../mysys/libmysys.a(raid.o)(.text+0x64b): In function
757 `my_raid_close':: undefined reference to `operator delete(void*)'
758 collect2: ld returned 1 exit status
759
760 * If your compilation fails with errors such as any of the
761 following, you must upgrade your version of `make' to GNU `make':
762
763 making all in mit-pthreads
764 make: Fatal error in reader: Makefile, line 18:
765 Badly formed macro assignment
766
767 Or:
768
769 make: file `Makefile' line 18: Must be a separator (:
770
771 Or:
772
773 pthread.h: No such file or directory
774
775 Solaris and FreeBSD are known to have troublesome `make' programs.
776
777 GNU `make' 3.75 is known to work.
778
779 * If you want to define flags to be used by your C or C++ compilers,
780 do so by adding the flags to the `CFLAGS' and `CXXFLAGS'
781 environment variables. You can also specify the compiler names
782 this way using `CC' and `CXX'. For example:
783
784 shell> CC=gcc
785 shell> CFLAGS=-O3
786 shell> CXX=gcc
787 shell> CXXFLAGS=-O3
788 shell> export CC CFLAGS CXX CXXFLAGS
789
790 See *Note mysql-binaries::, for a list of flag definitions that
791 have been found to be useful on various systems.
792
793 * If you get errors such as those shown here when compiling
794 `mysqld', `configure' did not correctly detect the type of the
795 last argument to `accept()', `getsockname()', or `getpeername()':
796
797 cxx: Error: mysqld.cc, line 645: In this statement, the referenced
798 type of the pointer value ''length'' is ''unsigned long'',
799 which is not compatible with ''int''.
800 new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
801
802 To fix this, edit the `config.h' file (which is generated by
803 `configure'). Look for these lines:
804
805 /* Define as the base type of the last arg to accept */
806 #define SOCKET_SIZE_TYPE XXX
807
808 Change `XXX' to `size_t' or `int', depending on your operating
809 system. (You must do this each time you run `configure' because
810 `configure' regenerates `config.h'.)
811
812 * The `sql_yacc.cc' file is generated from `sql_yacc.yy'. Normally,
813 the build process does not need to create `sql_yacc.cc' because
814 MySQL comes with a pre-generated copy. However, if you do need to
815 re-create it, you might encounter this error:
816
817 "sql_yacc.yy", line XXX fatal: default action causes potential...
818
819 This is a sign that your version of `yacc' is deficient. You
820 probably need to install `bison' (the GNU version of `yacc') and
821 use that instead.
822
823 * On Debian Linux 3.0, you need to install `gawk' instead of the
824 default `mawk' if you want to compile MySQL 4.1 or higher with
825 Berkeley DB support.
826
827 * If you need to debug `mysqld' or a MySQL client, run `configure'
828 with the -with-debug option, and then recompile and link your
829 clients with the new client library. See *Note debugging-client::.
830
831 * If you get a compilation error on Linux (for example, SuSE Linux
832 8.1 or Red Hat Linux 7.3) similar to the following one, you
833 probably do not have `g++' installed:
834
835 libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
836 incompatible pointer type
837 libmysql.c:1329: too few arguments to function `gethostbyname_r'
838 libmysql.c:1329: warning: assignment makes pointer from integer
839 without a cast
840 make[2]: *** [libmysql.lo] Error 1
841
842 By default, the `configure' script attempts to determine the
843 correct number of arguments by using `g++' (the GNU C++ compiler).
844 This test yields incorrect results if `g++' is not installed.
845 There are two ways to work around this problem:
846
847 * Make sure that the GNU C++ `g++' is installed. On some Linux
848 distributions, the required package is called `gpp'; on
849 others, it is named `gcc-c++'.
850
851 * Use `gcc' as your C++ compiler by setting the `CXX'
852 environment variable to `gcc':
853
854 export CXX="gcc"
855
856 You must run `configure' again after making either of those
857 changes.
858
859 File: manual.info, Node: mit-pthreads, Next: windows-source-build, Prev: compilation-problems, Up: installing-source
860
861 2.9.5 MIT-pthreads Notes
862 ------------------------
863
864 This section describes some of the issues involved in using
865 MIT-pthreads.
866
867 On Linux, you should _not_ use MIT-pthreads. Use the installed
868 LinuxThreads implementation instead. See *Note linux::.
869
870 If your system does not provide native thread support, you should build
871 MySQL using the MIT-pthreads package. This includes older FreeBSD
872 systems, SunOS 4.x, Solaris 2.4 and earlier, and some others. See *Note
873 which-os::.
874
875 Beginning with MySQL 4.0.2, MIT-pthreads is no longer part of the
876 source distribution. If you require this package, you need to download
877 it separately from
878 `http://www.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.tar.gz'
879
880 After downloading, extract this source archive into the top level of
881 the MySQL source directory. It creates a new subdirectory named
882 `mit-pthreads'.
883
884 * On most systems, you can force MIT-pthreads to be used by running
885 `configure' with the -with-mit-threads option:
886
887 shell> ./configure --with-mit-threads
888
889 Building in a non-source directory is not supported when using
890 MIT-pthreads because we want to minimize our changes to this code.
891
892 * The checks that determine whether to use MIT-pthreads occur only
893 during the part of the configuration process that deals with the
894 server code. If you have configured the distribution using
895 -without-server to build only the client code, clients do not know
896 whether MIT-pthreads is being used and use Unix socket file
897 connections by default. Because Unix socket files do not work
898 under MIT-pthreads on some platforms, this means you need to use
899 -h or -host with a value other than `localhost' when you run
900 client programs.
901
902 * When MySQL is compiled using MIT-pthreads, system locking is
903 disabled by default for performance reasons. You can tell the
904 server to use system locking with the -external-locking option.
905 This is needed only if you want to be able to run two MySQL
906 servers against the same data files, but that is not recommended,
907 anyway.
908
909 * Sometimes the pthread `bind()' command fails to bind to a socket
910 without any error message (at least on Solaris). The result is
911 that all connections to the server fail. For example:
912
913 shell> mysqladmin version
914 mysqladmin: connect to server at '' failed;
915 error: 'Can't connect to mysql server on localhost (146)'
916
917 The solution to this problem is to kill the `mysqld' server and
918 restart it. This has happened to us only when we forced the server
919 to shut down and then restarted it immediately.
920
921 * With MIT-pthreads, the `sleep()' system call isn't interruptible
922 with `SIGINT' (break). This is noticeable only when you run
923 `mysqladmin --sleep'. You must wait for the `sleep()' call to
924 terminate before the interrupt is served and the process stops.
925
926 * When linking, you might receive warning messages like these (at
927 least on Solaris); they can be ignored:
928
929 ld: warning: symbol `_iob' has differing sizes:
930 (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
931 file /usr/lib/libc.so value=0x140);
932 /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
933 ld: warning: symbol `__iob' has differing sizes:
934 (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
935 file /usr/lib/libc.so value=0x140);
936 /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
937
938 * Some other warnings also can be ignored:
939
940 implicit declaration of function `int strtoll(...)'
941 implicit declaration of function `int strtoul(...)'
942
943 * We have not gotten `readline' to work with MIT-pthreads. (This is
944 not needed, but may be interesting for someone.)
945