共計 1815 個字符,預計需要花費 5 分鐘才能閱讀完成。
這篇文章主要為大家展示了“Suse 如何安裝 gcc”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓丸趣 TV 小編帶領大家一起研究并學習一下“Suse 如何安裝 gcc”這篇文章吧。
1. 獲得程序
cpp-3.3.3-43.24.i586.rpm
glibc-devel-2.3.3-98.28.i586.rpm
gcc-3.3.3-43.24.i586.rpm
根據安裝過程中所缺的包,進行補充。
2. 準備安裝 GCC
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
error: Failed dependencies:
glibc-devel is needed by gcc-3.3.3-43.24
cpp = 3.3.3-43.24 is needed by gcc-3.3.3-43.24
3. 安裝 GCC 必須軟件
1)安裝 glibc-devel
#rpm -ivh glibc-devel-2.3.3-98.28.i586.rpm
Preparing… ########################################### [100%]
1:glibc-devel ########################################### [100%]
2)安裝 cpp
#rpm -ivh cpp-3.3.3-43.24.i586.rpm
Preparing… ########################################### [100%]
package cpp-3.3.3-43.41 (which is newer than cpp-3.3.3-43.24) is already installed
file /usr/bin/cpp from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
file /usr/lib/gcc-lib/i586-suse-linux/3.3.3/cc1 from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
file /usr/share/man/man1/cpp.1.gz from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
可以發現系統遭已安裝了 cpp,只是版本沖突。
3)執行 gcc 安裝
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
error: Failed dependencies:
cpp = 3.3.3-43.24 is needed by gcc-3.3.3-43.24
發現系統還是識別不了 cpp
4)強制安裝版本 cpp-3.3.3-43.24
# rpm -ivh cpp-3.3.3-43.24.i586.rpm –nodeps –force
Preparing… ########################################### [100%]
1:cpp ########################################### [100%]
5)再次安裝 gcc
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
Preparing… ########################################### [100%]
1:gcc ########################################### [100%]
6)測試 gcc
# which gcc
/usr/bin/gcc
#vi test.c
test.c 內容如下:
#include stdio.h
main()
{
printf(\nGCC is OK!\n\n
}
編譯 test.c
# gcc -O test.c -o test
生成可執行文件 test(通過 ls 命令可以看到) 運行 test
#./test
屏幕輸出
GCC is OK!
說明 GCC 程序編譯正確。
7)加入相應的環境變量 PATH,LD_LIBRARY_PATH 即可。
這樣就完成了 Suse 安裝 gcc 的步驟。
以上是“Suse 如何安裝 gcc”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!