gcc 4.8.2 自动安装脚本

参考:

http://joelinoff.com/blog/?p=1003

http://blog.csdn.net/rumswell/article/details/16363185

Joe's Blog

Random thoughts about programming and technology

Skip to content

Bash script to install gcc 4.8.2 and boost 1.54.0 on CentOS 6.4

I recently installed gcc 4.8.2 and boost 1.54.0 on CentOS 6.4 to take advantage of the improved support for C++-11. It was painful to do manually so I automated the process with this script: http://projects.joelinoff.com/gcc-4.8.2/bld.sh. Hopefully this will make it easier for folks that want to experiment with the latest version of the GNU C++ compiler.

There is also a very simple Makefile: http://projects.joelinoff.com/gcc-4.8.2/Makefile that is not required but that I found useful.

This text version is also available so that you can cut-n-paste from a web page: http://projects.joelinoff.com/gcc-4.8.2/bld.sh.txt.

Please note that this is not a product. It is simply my best attempt to get it working in my development environments. For example, it does not check for packages because I try to build it on different systems that have different package managers (yum, apt, port, etc.). For example, this version almost worked on the Mac OS X 10.9 (Maverick). There was a problem late in the gcc build process that I have not had time to track down.

What this means is that if it doesn’t work for you, you will have to do some debugging. If you find a problem, please post a fix in the comment section here so that others can benefit from it.

1 Download and Install It

Here are the steps to download and install it. Root access is not required unless you need to install support packages.

The build process can take a long time depending on the speed of your CPU(s) and disks. On my test system it took more than 5 hours.

If the process fails it is most likely because packages are missing on the system.

If a problem does occur, install the package, then delete the src and bld directories and try again. If you have installed the option Makefile you can type “make clean” and then “make”.

The rtf (release to field) directory contains the releases for each package.

2 How to Use the Compiler

This section shows how to compile, link and execute a simple program using the newly installed compiler by setting up your environment properly.

You compile, link and run it as follows:

3 Disk Space Requirements

You will need about 4GB to download and build all of the packages. Once the build is finished you can reclaim most of the space because the released files only require about 500 MB. Here is the breakdown:

Note that the logs directory exists because I used the “make” command instead of running blds.sh directly.

Once it is built you can remove everything except the contents of the rtf directory tree to save disk space.

4 Packages

This is the list of packages that are installed in the release area.

5 Tested Platforms

These are the platforms that I actually tested the installation on.

DistroVersionArchStatusNotes
CentOS
5.5
x86_64Failedglibc incompatibility. It cannot work.
CentOS
6.4
x86_64PassedHad to manually install the glibc_devel.i686 and texinfo packages.
MAC OS X (Maverick)
10.9
x86_64FailedHad a problem late in the compilation process
File not found: CoreFoundation/CFBase.h

Unfortunately, I do not have the bandwidth to try to get this to work on other distros (even though I have several Ubuntu boxes at hand) but it should be fairly straightforward to port because it does not rely on distro specific package management.

If you port it to another distro, please send me the changes to that I can incorporate them.

Enjoy!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值