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
PATHvariable includes the necessary tools, including ar for building libraries. Some tools are located in
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
If you have an UltraSPARC system, you can get 4% better performance by adding
-mcpu=v8 -Wa,-xarch=v8plusato the
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
--enable-assemblerfrom 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
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
sched_yield, you can fix this by adding
LIBS=-lrtto the configure line
Solaris does not provide static versions of all system libraries (
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:
crletool to add the directory containing the
libmysqlclientlibrary 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
crle -64 -u -l /usr/local/mysql/lib
Link clients with the
-Wl,r/full/path/to/libmysqlclient.soflag rather than with
If you have problems with configure trying to link with
-lzwhen you do not have
zlibinstalled, you have two options:
If you want to be able to use the compressed communication protocol, obtain and install
To build without
zlib, run configure with the
--with-named-z-libs=nooption when building MySQL.
If you are using gcc and have problems with loading user-defined functions (UDFs) into MySQL, try adding
-lgccto the link line for the UDF.