加入收藏 | 设为首页 | 会员中心 | 我要投稿 财气旺网 - 财气网 (https://www.caiqiwang.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

介绍一段一键编译安装gcc的shell脚本代码

发布时间:2022-06-19 02:08:03 所属栏目:教程 来源:互联网
导读:gcc包括C、C++、Objective-C、Fortran、Java、Ada和Go语言的前端,所谓强大,本文是我从别人的一篇文章看到的,他是通过一个shell脚本和一个Makefile就一键安装编译gcc了,好东西要分享出来. 今天看到一篇文章,作者通过一个shell脚本和一个Makefile,可以自动下载
  gcc包括C、C++、Objective-C、Fortran、Java、Ada和Go语言的前端,所谓强大,本文是我从别人的一篇文章看到的,他是通过一个shell脚本和一个Makefile就一键安装编译gcc了,好东西要分享出来.
 
  今天看到一篇文章,作者通过一个shell脚本和一个Makefile,可以自动下载需要的所有安装包并且编译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
  我试了一下,果然很方便,只要有一台可以联网的机器就可以了,感兴趣的朋友可以试一试.
 
  1)编译libiconv时可能会有“'gets' undeclared here“错误,请参考这篇文章。
 
  2)如果机器是64位的,但是缺少32位的库文件,这样在编译gcc时会出现错误:“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”.

(编辑:财气旺网 - 财气网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!