香港云服務器在Red Hat系統安裝軟件的時候,突然提示“Cannot find a C compiler, aborting”。這是因為缺少gcc編譯器導致的。
gcc編譯器是將源代碼處理為機器可認識的二進制文件的重要程序。換言之,如果沒有gcc編譯器,就不能通過源代碼方式來安裝程序。一般的系統默認都會安裝之,但也有少量系統未安裝。
[root@localhost]# ./configure –prefix=/usr/local/axel
Cannot find a C compiler, aborting.
[root@localhost]# gcc –version //查看gcc版本
bash: gcc: command not found
我們可以自己下載gcc軟件包安裝,但因為gcc有大量的依賴包,因此推薦使用yum方式來安裝。
1,如果系統能連網,直接執行”yum install gcc*”安裝gcc即可
2,如果系統不能連網,Red Hat安裝光盤里自帶了gcc軟件包及其相關依賴包,我們只要將本地光盤設置為yum更新源,然后再執行”yum install gcc*”即可。
安裝完成以后的檢測:
[root@localhost]# gcc –version //查看c編譯器的版本
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost]# g++ –version //查看c++編譯器的版本
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.