gcc包括C、C++、Objective-C、Fortran、Java、Ada和Go語(yǔ)言的前端,所謂強(qiáng)大,本文是我從別人的一篇文章看到的,他是通過(guò)一個(gè)shell腳本和一個(gè)Makefile就一鍵安裝編譯gcc了,好東西要分享出來(lái).
今天看到一篇文章,作者通過(guò)一個(gè)shell腳本和一個(gè)Makefile,可以自動(dòng)下載需要的所有安裝包并且編譯gcc:
- $ # Download the scripts using wget.
- $ mkdir /opt/gcc-4.9.2
- $ cd /opt/gcc-4.9.2
- $ wget http://projects.joelinoff.com/gcc-4.9.2/bld.sh
- $ wget http://projects.joelinoff.com/gcc-4.9.2/Makefile
- $ chmod a+x bld.sh
- $ make
- [output snipped]
- $ # The compiler is installed in /opt/gcc-4.9.2/rtf/bin
我試了一下,果然很方便,只要有一臺(tái)可以聯(lián)網(wǎng)的機(jī)器就可以了,感興趣的朋友可以試一試.
1)編譯libiconv時(shí)可能會(huì)有“'gets' undeclared here“錯(cuò)誤,請(qǐng)參考這篇文章。
2)如果機(jī)器是64位的,但是缺少32位的庫(kù)文件,這樣在編譯gcc時(shí)會(huì)出現(xiàn)錯(cuò)誤:“configure: error: I suspect your system does not have 32-bit developement libraries (libc and headers). If you have them, rerun configure with –enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with –disable-multilib.”。提示需要配置“--disable-multilib”.
新聞熱點(diǎn)
疑難解答
圖片精選