When building MySQL on Solaris you can use either the Sun Studio or GNU cc compilers. For more information on specific notes and environments, use the following hints.
When building you should ensure that your
PATH
variable includes the necessary tools,
including ar for building libraries. Some
tools are located in /usr/ccs/bin
.
When running configure, you should specify the C and C++ compiler explicitly to ensure that the right C compiler combination is used:
CC=gcc CXX=g++ ./configure
For detailed information on performance tuning your MySQL installation for Solaris, you can use the information from Krish Shankar and the Sun Solaris MySQL Performance Tuning pages.
If you have an UltraSPARC system, you can get 4% better
performance by adding -mcpu=v8
-Wa,-xarch=v8plusa
to the CFLAGS
and CXXFLAGS
environment variables.
If you have Sun's Forte 5.00 (or newer) or Sun Studio compiler, you can run configure like this:
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \ CXX=CC CXXFLAGS="-noex -mt" \ ./configure --prefix=/usr/local/mysql --enable-assembler
To create a 64-bit SPARC binary with Sun's Forte or Sun Studio compiler, use the following configuration options:
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \ CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \ ./configure --prefix=/usr/local/mysql --enable-assembler
To create a 64-bit Solaris binary using
gcc, add -m64
to
CFLAGS
and CXXFLAGS
and
remove --enable-assembler
from the
configure line.
In the MySQL benchmarks, we obtained a 4% speed increase on
UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
using gcc 3.2 with the
-mcpu
flag.
If you create a 64-bit mysqld binary, it is 4% slower than the 32-bit binary, but can handle more threads and memory.
If you get a problem with fdatasync
or
sched_yield
, you can fix this by adding
LIBS=-lrt
to the
configure line
Solaris does not provide static versions of all system
libraries (libpthreads
and
libdl
), so you cannot compile MySQL with
--static
. If you try to do so, you get one of
the following errors:
ld: fatal: library -ldl: not found undefined reference to `dlopen' cannot find -lrt
If you link your own MySQL client programs, you may see the following error at runtime:
ld.so.1: fatal: libmysqlclient.so.#: open failed: No such file or directory
To avoid this problem, use one of the following methods:
Use the crle
tool to add the directory
containing the libmysqlclient
library
file to the list of standard library directories. You need
administrator privileges to do this. Make sure you update
the library information, rather than replace it with the
new path. For example, the following command adds the
directory to the list of standard directories searched for
libraries.
crle -u -l /usr/local/mysql/lib
For 64-bit libraries, add the -64
option:
crle -64 -u -l /usr/local/mysql/lib
Link clients with the
-Wl,r/full/path/to/libmysqlclient.so
flag
rather than with -Lpath
).
Copy libmysqlclient.so
to
/usr/lib
.
Add the path name of the directory where
libmysqlclient.so
is located to the
LD_RUN_PATH
environment variable before
running your client.
If you have problems with configure trying
to link with -lz
when you do not have
zlib
installed, you have two options:
If you want to be able to use the compressed communication
protocol, obtain and install zlib
from
ftp.gnu.org
.
To build without zlib
, run
configure with the
--with-named-z-libs=no
option when
building MySQL.
If you are using gcc and have problems with
loading user-defined functions (UDFs) into MySQL, try adding
-lgcc
to the link line for the UDF.
User Comments
here are simple instructions to download, compile, and install MySQL server from source code
http://www.geeksww.com/tutorials/database_management_systems/mysql/installation/downloading_compiling_and_installing_mysql_server_from_source_code.php
Add your own comment.