Dealing with Problems Compiling MySQL


Some problems with compiling MySQL could be because of not configuring properly. Hence, the solution is to reconfigure.

If CMake is run right after it was previously run, there is a possibility that it would use information that was gathered from its previous call. This information is present in CMakeCache.txt. When CMake begins, it looks for this file and reads the contents (if it exists), assuming that the information is correct. This assumption becomes wrong when the file is reconfigured.

Each time CMake is run, ‘make’ has to be executed again to recompile. The old object files from previous builds can be removed first because since they would have been compiled using different configuration options.

To prevent old object files or configuration information from being used by current installation, the following commands need to be run before re-running CMake −

On Unix

shell> make clean
shell> rm CMakeCache.txt

On Windows

shell> devenv MySQL.sln /clean
shell> del CMakeCache.txt

If it is built outside the source tree, the build directory has to be removed and recreated before rerunning CMake. On some systems, warnings may occur because of differences in system include files.

To define which C and C++ compilers to use, the CC and CXX environment variables can be defined. It has been shown below −

shell> CC=gcc
shell> CXX=g++
shell> export CC CXX

To specify user’s own C and C++ compiler flags, the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS CMake options can be used.

To see what flags need to be specified by the user, mysql_config along with the −−cflags and −−cxxflags options can be invoked.

To see which commands are being executed during the compile stage, run ‘make VERBOSE=1’ instead of running ‘make’ after using CMake to configure MySQL. If compilation fails, check whether the MYSQL_MAINTAINER_MODE option is enabled or not. This mode causes compiler warnings to become errors, hence disabling it may enable the compilation to happen.

Updated on: 09-Mar-2021

99 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements