( Compilation problems

Info Catalog ( Installing source tree ( Installing source ( MIT-pthreads
 2.8.4 Dealing with Problems Compiling MySQL
 All MySQL programs compile cleanly for us with no warnings on Solaris
 or Linux using `gcc'.  On other systems, warnings may occur due to
 differences in system include files.  See  MIT-pthreads for
 warnings that may occur when using MIT-pthreads.  For other problems,
 check the following list.
 The solution to many problems involves reconfiguring.  If you do need to
 reconfigure, take note of the following:
    * If `configure' is run after it has previously been run, it may use
      information that was gathered during its previous invocation.  This
      information is stored in `config.cache'.  When `configure' starts
      up, it looks for that file and reads its contents if it exists, on
      the assumption that the information is still correct.  That
      assumption is invalid when you reconfigure.
    * Each time you run `configure', you must run `make' again to
      recompile.  However, you may want to remove old object files from
      previous builds first because they were compiled using different
      configuration options.
 To prevent old configuration information or object files from being
 used, run these commands before re-running `configure':
      shell> rm config.cache
      shell> make clean
 Alternatively, you can run `make distclean'.
 The following list describes some of the problems when compiling MySQL
 that have been found to occur most often:
    * If you get errors such as the ones shown here when compiling
      `', you probably have run out of memory or swap space:
           Internal compiler error: program cc1plus got fatal signal 11
           Out of virtual memory
           Virtual memory exhausted
      The problem is that `gcc' requires a huge amount of memory to
      compile `' with inline functions.  Try running
      `configure' with the `--with-low-memory' option:
           shell> ./configure --with-low-memory
      This option causes `-fno-inline' to be added to the compile line
      if you are using `gcc' and `-O0' if you are using something else.
      You should try the `--with-low-memory' option even if you have so
      much memory and swap space that you think you can't possibly have
      run out.  This problem has been observed to occur even on systems
      with generous hardware configurations and the `--with-low-memory'
      option usually fixes it.
    * By default, `configure' picks `c++' as the compiler name and GNU
      `c++' links with `-lg++'.  If you are using `gcc', that behavior
      can cause problems during configuration such as this:
           configure: error: installation or configuration problem:
           C++ compiler cannot create executables.
      You might also observe problems during compilation related to
      `g++', `libg++', or `libstdc++'.
      One cause of these problems is that you may not have `g++', or you
      may have `g++' but not `libg++', or `libstdc++'.  Take a look at
      the `config.log' file.  It should contain the exact reason why
      your C++ compiler didn't work.  To work around these problems, you
      can use `gcc' as your C++ compiler.  Try setting the environment
      variable `CXX' to `"gcc -O3"'.  For example:
           shell> CXX="gcc -O3" ./configure
      This works because `gcc' compiles C++ sources as well as `g++'
      does, but does not link in `libg++' or `libstdc++' by default.
      Another way to fix these problems is to install `g++', `libg++',
      and `libstdc++'.  We would, however, like to recommend that you
      not use `libg++' or `libstdc++' with MySQL because this will only
      increase the binary size of `mysqld' without giving you any
      benefits.  Some versions of these libraries have also caused
      strange problems for MySQL users in the past.
      Using `gcc' as the C++ compiler is also required if you want to
      compile MySQL with RAID functionality (see  CREATE TABLE
      for more info on RAID table type) and you are using GNU `gcc'
      version 3 and above. If you get errors like those following during
      the linking stage when you configure MySQL to compile with the
      option `--with-raid', try to use `gcc' as your C++ compiler by
      defining the `CXX' environment variable:
           gcc -O3 -DDBUG_OFF -rdynamic -o isamchk isamchk.o sort.o  libnisam.a
           ../mysys/libmysys.a ../dbug/libdbug.a ../strings/libmystrings.a
            -lpthread -lz -lcrypt -lnsl -lm -lpthread
           ../mysys/libmysys.a(raid.o)(.text+0x79): In function
           `my_raid_create':: undefined reference to `operator new(unsigned)'
           ../mysys/libmysys.a(raid.o)(.text+0xdd): In function
           `my_raid_create':: undefined reference to `operator delete(void*)'
           ../mysys/libmysys.a(raid.o)(.text+0x129): In function
           `my_raid_open':: undefined reference to `operator new(unsigned)'
           ../mysys/libmysys.a(raid.o)(.text+0x189): In function
           `my_raid_open':: undefined reference to `operator delete(void*)'
           ../mysys/libmysys.a(raid.o)(.text+0x64b): In function
           `my_raid_close':: undefined reference to `operator delete(void*)'
           collect2: ld returned 1 exit status
    * If your compile fails with errors such as any of the following,
      you must upgrade your version of `make' to GNU `make':
           making all in mit-pthreads
           make: Fatal error in reader: Makefile, line 18:
           Badly formed macro assignment
           make: file `Makefile' line 18: Must be a separator (:
           pthread.h: No such file or directory
      Solaris and FreeBSD are known to have troublesome `make' programs.
      GNU `make' Version 3.75 is known to work.
    * If you want to define flags to be used by your C or C++ compilers,
      do so by adding the flags to the `CFLAGS' and `CXXFLAGS'
      environment variables.  You can also specify the compiler names
      this way using `CC' and `CXX'.  For example:
           shell> CC=gcc
           shell> CFLAGS=-O3
           shell> CXX=gcc
           shell> CXXFLAGS=-O3
           shell> export CC CFLAGS CXX CXXFLAGS
      See  MySQL binaries, for a list of flag definitions that
      have been found to be useful on various systems.
    * If you get an error message like this, you need to upgrade your
      `gcc' compiler:
           client/libmysql.c:273: parse error before `__attribute__'
      `gcc' 2.8.1 is known to work, but we recommend using `gcc' 2.95.2
      or `egcs' 1.0.3a instead.
    * If you get errors such as those shown here when compiling `mysqld',
      `configure' didn't correctly detect the type of the last argument
      to `accept()', `getsockname()', or `getpeername()':
           cxx: Error:, line 645: In this statement, the referenced
                type of the pointer value ''length'' is ''unsigned long'',
                which is not compatible with ''int''.
           new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
      To fix this, edit the `config.h' file (which is generated by
      `configure').  Look for these lines:
           /* Define as the base type of the last arg to accept */
           #define SOCKET_SIZE_TYPE XXX
      Change `XXX' to `size_t' or `int', depending on your operating
      system.  (Note that you will have to do this each time you run
      `configure' because `configure' regenerates `config.h'.)
    * The `' file is generated from `sql_yacc.yy'.  Normally
      the build process doesn't need to create `', because
      MySQL comes with an pre-generated copy.  However, if you do need
      to re-create it, you might encounter this error:
           "sql_yacc.yy", line XXX fatal: default action causes potential...
      This is a sign that your version of `yacc' is deficient.  You
      probably need to install `bison' (the GNU version of `yacc') and
      use that instead.
    * On Debian Linux 3.0, you need to install `gawk' instead of the
      default `mawk' if you want to compile MySQL 4.1 or higher with
      Berkeley DB support.
    * If you need to debug `mysqld' or a MySQL client, run `configure'
      with the `--with-debug' option, then recompile and link your
      clients with the new client library.   Debugging client.
    * If you get a compilation error on Linux (for example, SuSE Linux
      8.1 or Red Hat Linux 7.3) similar to the following one:
           libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
           incompatible pointer type
           libmysql.c:1329: too few arguments to function `gethostbyname_r'
           libmysql.c:1329: warning: assignment makes pointer from integer
           without a cast
           make[2]: *** [libmysql.lo] Error 1
      By default, the `configure' script attempts to determine the
      correct number of arguments by using `g++' the GNU C++ compiler.
      This test yields wrong results if `g++' is not installed. There
      are two ways to work around this problem:
         * Make sure that the GNU C++ `g++' is installed. On some Linux
           distributions, the required package is called `gpp'; on
           others, it is named `gcc-c++'.
         * Use `gcc' as your C++ compiler by setting the `CXX'
           environment variable to `gcc':
                export CXX="gcc"
      Please note that you need to run `configure' again afterward.
Info Catalog ( Installing source tree ( Installing source ( MIT-pthreads
automatically generated byinfo2html