linux下编译gcc6.2.0

在archlinx的下gcc已经更新到6.2.1了,win10的WSL下还是gcc4.8。官方源没有比较新的版本,于是自己编译使用。

GCC6的几个新特性

GCC 6 现在的默认值是 C++ 14. GCC 6 现在包括 C++ Concepts.

C++运行时库现在支持特殊的数学函数 (ISO/IEC 29124:2010)

支持 C++17 的实验功能

准备

可以去gnu官网下载gcc6.2.0的源码,但国内访问速度比较慢。可以进中科大的镜像站去下载。

下载并解压

wget http://mirrors.ustc.edu.cn/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.bz2
tar -xjvf gcc-6.2.0.tar.bz2

解压之后进入源码目录,运行下面命令下载依赖包

./contrib/download_prerequisites	#必须在源码根目录下运行此命令

编译gcc前需安装build-essential,bison,flex,texinfo

生成Makefile

在源码目录下建立一个build目录(也可以在别的目录下),然后进入build目录运行configure脚本生成Makefile文件。

mkdir build && cd build
../configure --prefix=/usr/local/gcc6 --enable-checking=release --enable-languages=c,c++ --enable-threads=posix --disable-multilib
# --prefix=/usr/local/gcc6 指定安装路径
# --enable-languages=c,c++ 支持的编程语言
# --enable-threads=posix 使用POSIX/Unix98作为线程支持库
# --disable-multilib 取消多目标库编译(取消32位库编译)

下面是archlinux自带gcc的编译配置命令(gcc -v查看)。

--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release

如果配置的时候出现cannot find crt1.o cannot find crti.o cannot find crtn.o的错误,那么需要指定--build的参数,比如x86_64

编译安装

上一步生成Makefile没有问题后,就可以直接编译安装了。

make -j8	#使用8个线程并行编译
make install #安装(可能需要root权限)

错误与解决办法

makeinfo没有安装

/mnt/d/gcc/gcc-6.2.0/missing: 81: /mnt/d/gcc/gcc-6.2.0/missing: makeinfo: not found
WARNING: 'makeinfo' is missing on your system.
You should only need it if you modified a '.texi' file, or
any other file indirectly affecting the aspect of the manual.
You might want to install the Texinfo package:
<http://www.gnu.org/software/texinfo/>
The spurious makeinfo call might also be the consequence of
using a buggy 'make' (AIX, DU, IRIX), in which case you might
want to install GNU make:
<http://www.gnu.org/software/make/>

解决办法

sudo apt-get install texinfo

linux下编译gcc6.2.0的更多相关文章

  1. linux下编译qt5.6.0静态库——configure配置

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  2. linux下编译qt5.6.0静态库——configure配置(超详细,有每一个模块的说明)(乌合之众)

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  3. linux下编译qt5.6.0静态库(使用./configure --help来看看都有哪些参数。超详细,有每一个模块的说明。如果改变了安装的目录,需要到安装目录下的bin目录下创建文件qt.conf)(乌合之众)good

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  4. Linux下编译安装mysql-5.0.45.tar.gz

    安装环境:VMware9(桥接模式) + Linux bogon 2.6.32-642.3.1.el6.x86_64(查看linux版本信息:uname -a) 先给出MySQL For Linux ...

  5. Linux下编译安装Vim8.0

    什么是Vim? Vim 是经典的 UNIX 编辑器 Vi 的深度改良版本.它增加了许多功能,包括:多级撤销.格式高亮.命令行历史.在线帮助.拼写检查.文件名补完.块操作.脚本支持,等等.除了字符界面版 ...

  6. LINUX下编译安装PHP各种报错大集合

    本文为大家整理汇总了一些linux下编译安装php各种报错大集合 ,感兴趣的同学参考下. nginx1.6.2-mysql5.5.32二进制,php安装报错解决: 123456 [root@clien ...

  7. 如何在Kali Linux下编译Windows Exploit

    前言 微软的Windows在企业或是个人应用领域占据着最大的市场份额,在渗透测试过程中你会经常遇到很多Windows的工作站和服务器.另一方面,大多数渗透测试人员主要使用基于Linux的发行版渗透测试 ...

  8. linux下编译安装boost库

    linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...

  9. Linux下编译安装Apache Http Server

    Linux下编译安装Apache Http Server [TOC] 1.下载httpd-2.4.12.tar.bz2 wget http://mirror.bit.edu.cn/apache/htt ...

随机推荐

  1. [LeetCode] Longest Increasing Subsequence 最长递增子序列

    Given an unsorted array of integers, find the length of longest increasing subsequence. For example, ...

  2. [LeetCode] Strobogrammatic Number 对称数

    A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside ...

  3. [LeetCode] Combine Two Tables 联合两表

    Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...

  4. c#线程带参数

    c#线程带参数 ThreadStart threadStart = delegate { LoadPicture(ds.Tables[0]); }; Thread thread = new Threa ...

  5. Js数组

    参考:http://www.w3school.com.cn/jsref/jsref_obj_array.asp 一.数组定义 1.  var arr= [1,2,3]; 2.  var arr= ne ...

  6. 读《单页web应用》-回顾作用域

    js中没有块级作用域,只有全局作用域和函数作用域.全局变量可以在任何地方访问,局部变量只能在声明它的地方访问. var a=1; function func(){ var a=2; } console ...

  7. mongodb安装启动遇到的问题

    好不容易下载到了mongodb,配置的时候遇到了不少问题. 下载的是解压包,不是官网的,有一个bin目录,解压到一个自己想要的目录,如d:\mongo,首先把bin复制进来,然后创建data目录,da ...

  8. NOIP2016滚粗记

    想了好久还是决定要写... Day0 Day-5得感冒一直没好,连磕5天药丸. 早晨得知爸妈都要上班并不能送我到校的消息,于是计划10:30集合,定表8:45准备自己走去学校. 然后平常睡得有点晚,结 ...

  9. Django模版语言 格式化显示 后台datatime()时间

    Django模版语言 格式化显示 后台datatime()时间 场景描述:

  10. IDEA中maven搭建Spring+SpringMVC+mybatis项目

    一.介绍 使用IDEA搭建maven web项目,整合框架Spring+SpringMVC+mybatis 项目结构图: