how to install gcc for linux(copy gcc website)
来源:互联网 发布:手机套淘宝网 编辑:程序博客网 时间:2024/06/08 14:56
Installing GCC
This page is intended to offer guidance to avoid some common problems when installing GCC, the official installation docs are in theInstalling GCC section of the main GCC documentation.
For most people the easiest way to install GCC is to install a package made for your operating system. The GCC project does not provide pre-built binaries of GCC, only source code, but all GNU/Linux distributions include packages for GCC. The BSD-based systems include GCC in their ports collections. For other operating systems theInstalling GCC: Binaries page lists some third-party sources of GCC binaries.
If you cannot find suitable binaries for your system, or you need a newer version than is available, you will need to build GCC from source in order to install it.
Building GCC
Many people rush into trying to build GCC without reading the installation docs properly and make one or more of these common mistakes:
do not run ./configure, this is not supported, you need to run configure from outside the source directory (this is aFAQ)
if GCC links dynamically to the GMP, MPFR or MPC support libraries then the relevant shared libraries must be in the dynamic linker's path, both when building gccand when using the installed compiler (this is also aFAQ)
Support libraries
See Installing GCC: Prequisites for the software required to build GCC. If you do not have the GMP, MPFR and MPC support libraries already installed as part of your operating system then there are two simple ways to proceed, and one difficult, error-prone way. For some reason most people choose the difficult way. The easy ways are:
If it provides sufficiently recent versions, use your OS package management system to install the support libraries in standard system locations. For Debian-based systems, including Ubuntu, you should install the packageslibgmp-dev,libmpfr-dev and libmpc-dev. For RPM-based systems, including Fedora and SUSE, you should installgmp-devel,mpfr-devel andlibmpc-devel (ormpc-devel on SUSE) packages. The packages will install the libraries and headers in standard system directories so they can be found automatically when building GCC.
Alternatively, after extracting the GCC source archive, simply run the./contrib/download_prerequisites script in the GCC source directory. That will download the support libraries and create symlinks, causing them to be built automatically as part of the GCC build process.
The difficult way, which is not recommended, is to download the sources for GMP, MPFR and MPC, then configure and install each of them in non-standard locations, then configure GCC with--with-gmp=/some/silly/path/gmp --with-mpfr=/some/silly/path/mpfr --with-mpc=/some/silly/path/mpc, then be forced to setLD_LIBRARY_PATH=/some/silly/path/gmp:/some/silly/path/mpfr:/some/silly/path/mpc/lib in your environment forever. This is silly and causes major problems for anyone who doesn't understand how dynamic linkers find libraries at runtime. Do not do this. If building GCC fails when using any of the--with-gmp or--with-mpfr or --with-mpc options then you probably shouldn't be using them.
Configuration
See Installing GCC: Configuration for the full documentation. A major benefit of runningsrcdir/configure from outside the source directory (instead of running./configure) is that the source directory will not be modified in any way, so if your build fails or you want to re-configure and build again, you simply delete everything in theobjdir and start again.
For example, configuring and building GCC 4.6.2 should be as simple as:
tar xzf gcc-4.6.2.tar.gzcd gcc-4.6.2./contrib/download_prerequisitescd ..mkdir objdircd objdir$PWD/../gcc-4.6.2/configure --prefix=/opt/gcc-4.6.2 makemake installIf your build fails and your configure command has lots of complicated options you should try removing options and keep it simple. Do not add lots of configure options you don't understand, they might be the reason your build fails.
- how to install gcc for linux(copy gcc website)
- How to install gcc-arm-linux-gnueabihf on Ubuntu 12.04
- install gcc for ubuntu linux
- How to Copy a Website
- How to install install gcc 4.8 under ubuntu operating system
- How to install older version gcc on fedora
- How to Install the Latest GCC on Windows
- how to use gcc
- Gcc How to
- install arm-linux-gcc
- Linux install gcc
- Mac如何通过Xcode安装GCC编译器 How to install gcc on mac with xcode
- how to install eva QQ (for Linux)
- How to install libpcap for Linux?
- HOW TO configure a website for HTTPS?
- ZT: How to use GCC
- How do I install GCC via Homebrew?
- How to compile GCC-4.3.3 in the Linux?
- linux目录结构
- Linux之编辑器Vim篇(配置与高级技巧)
- POJ1456
- sp_executesql中使用游标
- Android中检测手机制式和移动网络类型
- how to install gcc for linux(copy gcc website)
- UVa 10344 - 23 out of 5, 智力小游戏:算23点
- 留一手教你在美国亚马逊网购,让国内代购都去吃屎!
- 亚马逊经济:从仓库到庞大的零售帝国
- 位运算
- VC2008下配置boost库使用正则表达式
- Servlet作用
- bochs相关
- [BetterExplained]如何有效地记忆与学习