Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/tritonn-1.0.6-mysql-5.0.45/INSTALL-SOURCE

Parent Directory Parent Directory | Revision Log Revision Log


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

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26