安裝 mysql-5.5.33報錯:CMake Error: CMAKE_CXX_COMPILER not set

系統環境:Centos 6.5 64位

數據庫版本:mysql-5.5.33.tar.gz

準備工作:

# yum install cmake

新建用戶以安全方式運行進程:

# groupadd -r mysql

# useradd -g mysql -r -s /sbin/nologin -M -d /data/mysql mysql

# chown -R mysql:mysql /data/mysql

卸載系統中舊的mysql版本

# rpm -e mysql-libs --nodeps

將源碼包放到 /usr/local/src下並解壓

# tar xf mysql-5.5.33.tar.gz && cd mysql-5.5.33

編譯安裝mysql

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

>-DSYSCONFDIR=/etc -DMYSQL_DATADIR=/data/mysql \

>-DWITH_INNOBASE_STORAGE_ENGINE=1 \

>-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

>-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

>-DWITH_READLINE=1 -DWITH_SSL=system \

>-DWITH_ZLIB=system -DWITH_LIBWRAP=0 \

>-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

>-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

檢查系統環境過程中報錯:

CMake Error at /usr/share/cmake/Modules/CMakeCXXInformation.cmake:37 (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

-- Configuring incomplete, errors occurred!

See also "/usr/local/src/mysql-5.5.33/CMakeFiles/CMakeOutput.log".

See also "/usr/local/src/mysql-5.5.33/CMakeFiles/CMakeError.log".

個人感覺比較詭異,在網上查了片刻,有的是需要安裝 gcc相關的編譯器,感覺似乎是這樣

# yum install gcc gcc-c++

刪除產生的CMakeCache.txt文件,然後重新運行cmake

# rm -r CMakeCache.txt


-- Configuring done

CMake Warning (dev) in sql/CMakeLists.txt:

  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link

  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the

  cmake_policy command to set the policy and suppress this warning.


  Target "mysqld" has an INTERFACE_LINK_LIBRARIES property which differs from

  its LINK_INTERFACE_LIBRARIES properties.


  INTERFACE_LINK_LIBRARIES:


    -lpthread;sql;mysys


  LINK_INTERFACE_LIBRARIES:


    rt


This warning is for project developers.  Use -Wno-dev to suppress it.


-- Generating done

-- Build files have been written to: /usr/local/src/mysql-5.5.33

說明編譯環境ok

接下來可以 make && makeinstall 了,這個需要時間會長一點,看機器的性能了。


爲了在安裝過程中儘量少出現報錯,最好先 yum安裝一些必需的編譯工具和庫文件(安裝的比較多,方便以後編譯安裝php、nginx等):

# yum install make  autoconf automake curl curl-devel gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel  perl kernel-headers compat*  cpp glibc libgomp libstdc++-devel keyutils-libs-devel libsepol-devel libselinux-devel krb5-devel  libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libpng* ncurses* libtool* libxml2-devel  bison libaio-devel


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章