源码安装cmake

上传cmake-2.8.10.2.tar.gz到/usr/local/src目录

[root@localhost src]# tar zxvf cmake-2.8.10.2.tar.gz
[root@localhost src]# ll
total 29928
drwxr-xr-x. 9 root root     4096 Jan 29 19:37 cmake-2.8.10.2
-rw-r--r--. 1 root root  5768373 Jan 29 19:30 cmake-2.8.10.2.tar.gz
-rw-r--r--. 1 root root 24870769 Jan 29 19:30 mysql-5.5.29.tar.gz
[root@localhost src]# cd cmake-2.8.10.2
[root@localhost cmake-2.8.10.2]# ll
total 2980
-rwxr-xr-x.   1  501 games   54084 Nov 27 21:26 bootstrap
-rw-r--r--.   1  501 games  190526 Nov 27 21:26 ChangeLog.manual
-rw-r--r--.   1  501 games 2603523 Nov 27 21:26 ChangeLog.txt
-rw-r--r--.   1  501 games    5395 Nov 27 21:26 CMakeCPack.cmake
-rw-r--r--.   1  501 games    2536 Nov 27 21:26 CMakeCPackOptions.cmake.in
-rw-r--r--.   1  501 games     153 Nov 27 21:26 CMakeGraphVizOptions.cmake
-rw-r--r--.   1  501 games   24542 Nov 27 21:26 CMakeLists.txt
-rw-r--r--.   1  501 games    4481 Nov 27 21:26 CMakeLogo.gif
-rw-r--r--.   1  501 games     796 Nov 27 21:26 cmake_uninstall.cmake.in
-rw-r--r--.   1  501 games    2204 Nov 27 21:26 CompileFlags.cmake
-rwxr-xr-x.   1  501 games      99 Nov 27 21:26 configure
-rw-r--r--.   1  501 games    2637 Nov 27 21:26 Copyright.txt
-rw-r--r--.   1  501 games    1050 Nov 27 21:26 CTestConfig.cmake
-rw-r--r--.   1  501 games    3258 Nov 27 21:26 CTestCustom.cmake.in
-rw-r--r--.   1  501 games     145 Nov 27 21:26 CTestCustom.ctest.in
-rw-r--r--.   1  501 games     809 Nov 27 21:26 DartConfig.cmake
-rw-r--r--.   1  501 games    4144 Nov 27 21:26 DartLocal.conf.in
drwxr-xr-x.   3 root root     4096 Jan 29 19:37 Docs
-rw-r--r--.   1  501 games   28046 Nov 27 21:26 doxygen.config
drwxr-xr-x.   4 root root     4096 Jan 29 19:37 Example
drwxr-xr-x.   9 root root    20480 Jan 29 19:37 Modules
-rw-r--r--.   1  501 games    1946 Nov 27 21:26 Readme.txt
drwxr-xr-x.   7 root root    32768 Jan 29 19:37 Source
drwxr-xr-x.   2 root root     4096 Jan 29 19:37 Templates
drwxr-xr-x. 150 root root     4096 Jan 29 19:37 Tests
drwxr-xr-x.  15 root root     4096 Jan 29 19:37 Utilities
//安装cmake缺少gcc-c++
[root@localhost cmake-2.8.10.2]# ./configure
---------------------------------------------
CMake 2.8.10.2, Copyright 2000-2012 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/src/cmake-2.8.10.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
//yum安装gcc-c++,参见:http://dongbao100.iteye.com/admin/blogs/1777702
[root@localhost cmake-2.8.10.2]# yum install gcc-c++
Loaded plugins: fastestmirror
Determining fastest mirrors
cdrom                                                    | 4.0 kB     00:00 ... 
cdrom/primary_db                                         | 3.5 MB     00:00 ... 
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.i686 0:4.4.6-4.el6 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.6-4.el6 for package: gcc-c++-4.4.6-4.el6.i686
--> Running transaction check
---> Package libstdc++-devel.i686 0:4.4.6-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch         Version               Repository     Size
================================================================================
Installing:
 gcc-c++                 i686         4.4.6-4.el6           cdrom         4.3 M
Installing for dependencies:
 libstdc++-devel         i686         4.4.6-4.el6           cdrom         1.5 M

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 5.8 M
Installed size: 18 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------
Total                                            28 MB/s | 5.8 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libstdc++-devel-4.4.6-4.el6.i686                             1/2 
  Installing : gcc-c++-4.4.6-4.el6.i686                                     2/2 
  Verifying  : gcc-c++-4.4.6-4.el6.i686                                     1/2 
  Verifying  : libstdc++-devel-4.4.6-4.el6.i686                             2/2 

Installed:
  gcc-c++.i686 0:4.4.6-4.el6                                                    

Dependency Installed:
  libstdc++-devel.i686 0:4.4.6-4.el6                                            

Complete!

 继续安装cmake,出现如下错误:

[root@localhost cmake-2.8.10.2]# ./configure 
---------------------------------------------
CMake 2.8.10.2, Copyright 2000-2012 Kitware, Inc.
Found GNU toolchain
C compiler on this system is: gcc 
C++ compiler on this system is: g++ 
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate Makefile processor on this system.
Please specify one using environment variable MAKE.
---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.10.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------

 解决办法,安装make即可

[root@localhost cmake-2.8.10.2]# yum install make

 继续安装cmake

[root@localhost cmake-2.8.10.2]# ./configure

编译安装

[root@localhost cmake-2.8.10.2]# gmake
[root@localhost cmake-2.8.10.2]# gmake install

安装成功

猜你喜欢

转载自dongbao100.iteye.com/blog/1778204