Related Documentation Download this Excerpt
PDF (US Ltr) - 279.8Kb
PDF (A4) - 280.2Kb
EPUB - 97.2Kb
HTML Download (TGZ) - 63.4Kb
HTML Download (Zip) - 79.7Kb

Building MySQL from Source  /  Notes on Installing MySQL on Solaris from Source

Chapter 7 Notes on Installing MySQL on Solaris from Source

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
  • 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: fatal:
    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/ flag rather than with -Lpath).

    • Copy to /usr/lib.

    • Add the path name of the directory where 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

    • 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.

Download this Excerpt
PDF (US Ltr) - 279.8Kb
PDF (A4) - 280.2Kb
EPUB - 97.2Kb
HTML Download (TGZ) - 63.4Kb
HTML Download (Zip) - 79.7Kb
User Comments
  Posted by DBA Lead on November 29, 2010
Sign Up Login You must be logged in to post a comment.