This section does not apply to MySQL Enterprise Server users.
Before you proceed with an installation from source, first check
whether our binary is available for your platform and whether it
works for you. We put a great deal of effort into ensuring that
our binaries are built with the best possible options.
MySQL source distributions are provided as compressed
tar archives and have names of the form
mysql-VERSION.tar.gz,
where VERSION is a number like
5.0.64.
You need the following tools to build and install MySQL from
source:
GNU gunzip to uncompress the distribution.
A reasonable tar to unpack the
distribution. GNU tar is known to work.
Some operating systems come with a preinstalled version of
tar that is known to have problems. For
example, the tar provided with early
versions of Mac OS X tar, SunOS 4.x and
Solaris 8 and earlier are known to have problems with long
filenames. On Mac OS X, you can use the preinstalled
gnutar program. On other systems with a
deficient tar, you should install GNU
tar first.
A working ANSI C++ compiler. gcc 2.95.2 or
later, SGI C++, and SunPro C++ are some of the compilers that
are known to work. libg++ is not needed
when using gcc. gcc
2.7.x has a bug that makes it impossible to compile some
perfectly legal C++ files, such as
sql/sql_base.cc. If you have only
gcc 2.7.x, you must upgrade your
gcc to be able to compile MySQL.
gcc 2.8.1 is also known to have problems on
some platforms, so it should be avoided if a newer compiler
exists for the platform. gcc 2.95.2 or
later is recommended.
A good make program. GNU
make is always recommended and is sometimes
required. (BSD make fails, and
vendor-provided make implementations may
fail as well.) If you have problems, we recommend GNU
make 3.75 or newer.
libtool 1.5.24 or later is also
recommended.
If you are using a version of gcc recent enough
to understand the -fno-exceptions option, it is
very important that you use this option.
Otherwise, you may compile a binary that crashes randomly. We also
recommend that you use -felide-constructors and
-fno-rtti along with
-fno-exceptions. When in doubt, do the following:
If you have problems compiling on an Athlon (gcc segfaulting), try changing to the directory enclosing the problem file, compiling the file with no optimization (i.e. removing -O2 and/or -O3). Then change back to the base directory and run make again. Worked for me!
Alternatively, turn optimization off for the entire build using -O0
--enable-assembler on OpenBSD 3.2 causeed errors in the make process. Took it out, worked okay. Not sure of the effects on performance yet, as I have not run 4.0 long enough yet. Hopefully it will be better than 3.23, because it crashed while outputting large ammounts of records often.
Posted by [name withheld] on November 6 2003 11:03am
I tried following your instructions on RHL 8.0 and got the notorius gcc switch problem can't use -c and -o. Removed -c from the compile directive in the Makefile AND voila! What version of GCC are you using to build MySQL and what options are you handing off to ./configure?
Posted by [name withheld] on August 21 2005 8:35pm
If you are intending to utilize SSL with your MySQL and have difficulties passing the arguments to the configuration script, then modify the following sections. Open up `./configure' with your favorite editor (This modification are done to the mysql-4.1.3 configuration file with OpenSSL 0.9.4 package for Slackware 10.1):
/usr/bin/openssl The actual openssl binary /usr/include/openssl The header files /usr/lib For libssl.so* and libssl.a
Find the following variables near line 37187:
incs="$openssl_includes" libs="$openssl_lib"
and hardcode the the appropriate locations to them, i.e.:
incs="/usr/include/openssl" libs="/usr/lib"
A few lines below add the OpenSSL library path to the following list:
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl /usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib /usr/freeware/lib32 /usr/local/lib/ ; do if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then OPENSSL_LIB=$d fi done
To:
for d in /usr/lib /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl /usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib /usr/freeware/lib32 /usr/local/lib/ ; do if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then OPENSSL_LIB=$d fi done
NOTE that I added `/usr/lib' where my libssl* files reside to the list.
A few lines below, you'll find this statement:
if test -f $incs/openssl/ssl.h ; then
Again, $incs already has `openssl' included in its path so change it to:
if test -f $incs/ssl.h ; then
Now rerun the ./configure.
Posted by Dilantha Nanayakkara on March 11 2007 3:47am
User Comments
If you have problems compiling on an Athlon (gcc segfaulting), try changing to the directory enclosing the problem file, compiling the file with no optimization (i.e. removing -O2 and/or -O3). Then change back to the base directory and run make again. Worked for me!
Alternatively, turn optimization off for the entire build using -O0
--enable-assembler on OpenBSD 3.2 causeed errors in the make process. Took it out, worked okay. Not sure of the effects on performance yet, as I have not run 4.0 long enough yet. Hopefully it will be better than 3.23, because it crashed while outputting large ammounts of records often.
I just successfully ran make on OpenBSD 3.4 for i386, mysql-4.0.14 with the following options:
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ -felide-constructors -fno-exceptions -fno-rtti"
then I did
./configure --prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static
Make install succeeded, now I'm on to the test/verify initial installation chapter :)
I tried following your instructions on RHL 8.0 and got the notorius gcc switch problem can't use -c and -o. Removed -c from the compile directive in the Makefile AND voila! What version of GCC are you using to build MySQL and what options are you handing off to ./configure?
If you are intending to utilize SSL with your MySQL and have
difficulties passing the arguments to the configuration script, then modify the following sections. Open up `./configure' with your favorite editor (This modification are done to the mysql-4.1.3 configuration file with OpenSSL 0.9.4 package for Slackware 10.1):
/usr/bin/openssl The actual openssl binary
/usr/include/openssl The header files
/usr/lib For libssl.so* and libssl.a
Find the following variables near line 37187:
incs="$openssl_includes"
libs="$openssl_lib"
and hardcode the the appropriate locations to them, i.e.:
incs="/usr/include/openssl"
libs="/usr/lib"
A few lines below add the OpenSSL library path to the following list:
for d in /usr/ssl/lib /usr/local/ssl/lib
/usr/lib/openssl /usr/lib /usr/lib64 /opt/ssl/lib
/opt/openssl/lib /usr/freeware/lib32 /usr/local/lib/ ;
do
if test -f $d/libssl.a || test -f $d/libssl.so ||
test -f $d/libssl.dylib ; then
OPENSSL_LIB=$d
fi
done
To:
for d in /usr/lib /usr/ssl/lib /usr/local/ssl/lib
/usr/lib/openssl /usr/lib /usr/lib64 /opt/ssl/lib
/opt/openssl/lib /usr/freeware/lib32 /usr/local/lib/ ;
do
if test -f $d/libssl.a || test -f $d/libssl.so ||
test -f $d/libssl.dylib ; then
OPENSSL_LIB=$d
fi
done
NOTE that I added `/usr/lib' where my libssl* files reside to the list.
A few lines below, you'll find this statement:
if test -f $incs/openssl/ssl.h ; then
Again, $incs already has `openssl' included in its path so change it to:
if test -f $incs/ssl.h ; then
Now rerun the ./configure.
When running ./configure on Ubuntu Server 6.10 Edgy it complains
checking for termcap functions library... configure: error: No curses/termcap library found
You can overcome this by installing ncurses-dev by running
sudo aptitude install ncurses-dev
Add your own comment.