歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

cmake編譯時遇到的問題解決

編譯cmake首先需要gcc環境,可以執行 gcc --version命令看看。

如果沒有,可以使用yum或從cd中進行安裝,此處是在虛擬機中從cd中進行安裝,將cd鏈接到虛擬機都會吧,此處略去,,,,,

鏈接好虛擬機啟動後登陸,運行如下命令即可:

cd
mkdir cd-dvd
mount /dev/cdrom cd-dvd
cd cd-dvd/Packages

rpm -ivh kernel-headers-2.6.32-279.el6.x86_64.rpm
rpm -ivh glibc-headers-2.12-1.80.el6.x86_64.rpm  --force --nodeps
rpm -ivh glibc-devel-2.12-1.80.el6.x86_64.rpm  --force --nodeps
rpm -ivh libgomp-4.4.6-4.el6.x86_64.rpm
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -ivh gcc-4.4.6-4.el6.x86_64.rpm


rpm -ivh cpp-4.4.6-4.el6.x86_64.rpm --force --nodeps
rpm -ivh libmpcdec-1.2.6-6.1.el6.x86_64.rpm --force --nodeps

rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm

rpm -ivh libstdc++-devel-4.4.6-4.el6.x86_64.rpm
rpm -ivh gcc-c++-4.4.6-4.el6.x86_64.rpm --force --nodeps

中途遇到的幾個問題:

1、/usr/libexec/gcc/x86_64-RedHat-linux/4.4.6/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory

    最後發現是需要安裝mpfr-2.4.1-6.el6.x86_64.rpm

2、---------------------------------------------
CMake 3.0.2, Copyright 2000-2014 Kitware, Inc.
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/cmake-3.0.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------

最後發現是需要安裝gcc-c++環境

rpm -ivh libstdc++-devel-4.4.6-4.el6.x86_64.rpm
rpm -ivh gcc-c++-4.4.6-4.el6.x86_64.rpm --force --nodeps

ok,進入cmake目錄執行./bootstrp,執行結束後運行make命令進行編譯,編譯完成後執行make install進行安裝,,,,,,,,大功告成!!!!!!!

Copyright © Linux教程網 All Rights Reserved