1. 程式人生 > >MySQL 原始碼編譯安裝報錯 CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

MySQL 原始碼編譯安裝報錯 CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

今天編譯安裝mysql 5.6.27的時候報錯。

執行命令:

shell> cmake . \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_DATADIR=/usr/local/mysql/data \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DEXTRA_CHARSETS=all \
> -DENABLED_LOCAL_INFILE=1 \
> -DENABLE_DOWNLOADS=1
報錯資訊:

-- Not building NDB
-- Performing Test HAVE_PEERCRED
CMake Error at /usr/share/cmake/Modules/CMakeCXXInformation.cmake:17 (GET_FILENAME_COMPONENT):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Performing Test HAVE_PEERCRED - Failed
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Download failed, error: 7;"Couldn't connect to server"

解決方法:

yum install gcc-c++
rm -f CMakeCache.txt
重新編譯安裝