Gcc for Centos ultimate Optimization

Source: Internet
Author: User
Tags vps

Now gcc is 4.7.1. First install gcc:

1. Download gcc-4.7.1-20120825.tar.bz2, decompress the package, you also need to download and install libgmp3-dev libmp fr-dev libmp C-dev flex bison zlib readline automake autoconfig cmake zlib1g-dev many software in your aptitude install build-essential kernel-package and other inland river compiling environments that are already installed

2. Run mkdir gcc-build to compile the Directory and go to cd gcc-build.

3, ../gcc-4.7.1 */configure
-- Prefix =/usr \
-- Libexecdir =/usr/lib \
-- Enable-shared \
-- Enable-threads = posix \
-- Enable-_ cxa_atexit \
-- Enable-clocale = gnu \
-- Enable-languages ages = c, c ++ \
-- Disable-multilib \
-- Disable-bootstrap \
-- With-system-zlib \
-- Build = x86_64-linux-gnu \
-- Enable-lto \
-- With-cpu = athlon64 \

Note: 1. Here we have enabled the latest lto optimization to support Linux kernel compilation. lto optimization will be used for all future compilation and several processes will be automatically allocated for compilation, you can also set the number of processes by yourself using-flto = n, which can improve the performance of the program by about 5%, but may greatly increase the Compilation Time, especially php compiling 5.2.X.

2. We disabled multi-platform 32 64 to support disable-multilib. Otherwise, install gcc-mulitlib.

3. Modify the Makefile generated by gcc-build to remove all-g files. By default, the built-in gcc, cpp, and so on are only K. If you do not debug gcc of gcc4.7.1. cpp should be 1.7M horrible. It will only be around K after it is removed!

After the installation is complete, change the original gcc cpp c ++ connection under/usr/bin to ln-s/usr/gcc */bin/gcc ......... ................ then we can edit/etc/profile. Add CFLAGS = '-O2-pipe-march = athlon64-fomit-frame-pointer (in fact, enabling O2 is already enabled, for fear that some systems need to be specially formulated ). There is no need to enable the O3 level, which is easy to make mistakes. After modification, the source profile takes effect.

However, it is recommended that you do not care too much about the performance improvement of gcc, especially when the kernel compilation uses O2 or the major OS versions are different from rhel, centos and so on are using O2 debian using OS I suggest if you compile the kernel or change it to OS for the main kernel, or debian kernel, rhel or O2, this type of release version makes great changes to the kernel, basically breaking away from the standard main kernel ..... As for the O3 or Ofast level, if you are not crazy, you can't see the effect. If you are not crazy, it will also reduce the performance and cause errors ....

The above tests are all conducted in debian6.0.5. Please be careful with your reference. Deployment errors have nothing to do with yourself. The pursuit of excellence is endless!

Final attach the latest masterpiece, streamlined debian kernel 2.6.32 configuration file, for everyone in vps to play linux ultimate performance http://down.51cto.com/data/497058 compiled after the kernel size is 1.19 M, less than the previous 2.4M by half the size, this kernel is dedicated to optimizing the virtual environment (vm. If it is kvm, enable viro device). At the same time, refer to the linode vps Kernel configuration file and disable netfilter and lsm security functions, basically, it is also dead when it is enabled under vps.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.