1、编译nginx前, ./configure检查提示找不到C编译器

[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... not found

2、重装gcc编译器后,还是提示找不到C编译器

[root@test nginx-1.12.]# yum -y reinstall gcc gcc-c++ autoconf automake make
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors..com
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch :2.69-.el7 will be reinstalled
---> Package automake.noarch :1.13.-.el7 will be reinstalled
---> Package gcc.x86_64 :4.8.-.el7_6. will be reinstalled
---> Package gcc-c++.x86_64 :4.8.-.el7_6. will be reinstalled
---> Package make.x86_64 :3.82-.el7 will be reinstalled
--> Finished Dependency Resolution
Installed:
autoconf.noarch :2.69-.el7 automake.noarch :1.13.-.el7 gcc.x86_64 :4.8.-.el7_6.
gcc-c++.x86_64 :4.8.-.el7_6. make.x86_64 :3.82-.el7 Complete!
[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... not found

3、网上找一个hello world C程序代码,尝试编译,提示 cannot find 'ld'

[root@test ~]# vim hello_world.c
---------------------------------------
#include <stdio.h>
void main()
{
printf("Hello World \n");
}
---------------------------------------
[root@test ~]# gcc hello_world.c
collect2: fatal error: cannot find 'ld'
compilation terminated.

4、到另一台可正常编译电脑,查找ld位置

[root@xdc tmp]# which ld
/usr/bin/ld

5、回到问题机器,发现/usr/bin/ld有这个文件,但是which ld,找不到该文件

[root@test]# ll /usr/bin/ld
lrwxrwxrwx. root root May : /usr/bin/ld -> /etc/alternatives/ld
[root@test nginx-1.12.]# which ld
/usr/bin/which: no ld in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

6、ll /usr/bin/ld 发现该文件最终链接到/usr/bin/ld.bfd,但是,最终的源文件没有可执行权限

[root@test nginx-1.12.]# ll /usr/bin/ld
lrwxrwxrwx. root root May : /usr/bin/ld -> /etc/alternatives/ld
[root@test nginx-1.12.]# ll /etc/alternatives/ld
lrwxrwxrwx. root root May : /etc/alternatives/ld -> /usr/bin/ld.bfd
[root@test nginx-1.12.]# ll /usr/bin/ld.bfd
-rw-rw-rw-. root root Oct /usr/bin/ld.bfd

7、给/usr/bin/ld.bfd文件添加执行权限,编译helloworld成功,./configure 通过gcc环境检查

[root@test ~]# chmod +x /usr/bin/ld.bfd   //添加执行权限
[root@test ~]# which ld
/usr/bin/ld
[root@test ~]# gcc hello_world.c //编译成功
[root@test ~]# ./
a.out create.sh nginx-1.12./ .pki/ .ssh/
[root@test ~]# ./a.out
Hello World
[root@test ~]# cd nginx-1.12./
[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8. (Red Hat 4.8.-) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found

8、如果gcc编译时,提示找不到下面其中一个或多个文件,也可通过 yum -y reinstall binutils 重新安装工具集

GNU Binutils


The GNU Binutils are a collection of binary tools. The main ones are:

  • ld - the GNU linker.
  • as - the GNU assembler.

But they also include:

  • addr2line - Converts addresses into filenames and line numbers.
  • ar - A utility for creating, modifying and extracting from archives.
  • c++filt - Filter to demangle encoded C++ symbols.
  • dlltool - Creates files for building and using DLLs.
  • gold - A new, faster, ELF only linker, still in beta test.
  • gprof - Displays profiling information.
  • nlmconv - Converts object code into an NLM.
  • nm - Lists symbols from object files.
  • objcopy - Copies and translates object files.
  • objdump - Displays information from object files.
  • ranlib - Generates an index to the contents of an archive.
  • readelf - Displays information from any ELF format object file.
  • size - Lists the section sizes of an object or archive file.
  • strings - Lists printable strings from files.
  • strip - Discards symbols.
  • windmc - A Windows compatible message compiler.
  • windres - A compiler for Windows resource files.

已安装gcc编译器,但./configure还是提示找不到编译器(分析)的更多相关文章

  1. Debian/Ubuntu 已安装gcc/g++ 4.8.1

    gcc 4.8.1 是第一个全然支持C++11(C++14非常可能在gcc 4.9.0開始支持.)的编译器,Windows上能够安装mingw版的.在sourceforge 上有下载.安装也比較方便. ...

  2. linux查看是否已安装GCC及安装GCC

    输入:gcc -v;如果提示未找到命令即表示没有安装 使用:yum install gcc即可

  3. 安装了包,pycharm却提示找不到包

    这段时间,我爬虫爬到了一个论坛的数据,有个分析需要知道他的字符编码,因此使用到了 chardet,我在终端很顺利的安装了这个,但是在pycharm里使用的时候老是提示有错误,向下面这样: 其实这个是因 ...

  4. VMwareTools安装失败提示找不到C headers和gcc目录

    在VMware虚拟机上安装好linux系统后,发现往往不能全屏,也不能设置共享文件夹进行文件共享,这时候可以通过安装VMwareTools这个工具来实现文件拖拽.共享和全屏. 安装的过程不再赘述,关键 ...

  5. 编译安装pgbouncer-checking for OpenSSL... configure: error: not found

    花了一上午时间将pgbouncer的参数通读了一遍,对他有个大致的了解:1.配置分为连接池和pgbouncer两个部分[database]\[pgbouncer ].2.一条记录对应创建一个连接池,连 ...

  6. 【转载·】Linux yum 安装 gcc 、gcc-c++

      2017年09月29日 22:45:54 上善若水 阅读数:6653更多 个人分类: Linux学习 所属专栏: Linux学习杂技   版权声明:本文为博主原创文章,未经博主允许不得转载. ht ...

  7. Linux安装gcc编译器详解

    本人使用的是CentOS 6.5 64位系统,由于在安装系统的时候并没有勾选安装gcc编译器,因此需要自行安装gcc编译器. 使用yum安装gcc 对于配备了yum的Linux发行版而言,安装gcc编 ...

  8. Linux下安装gcc 、g++ 、gfortran编译器

    一.ubuntu下gcc/g++/gfortran的安装 1.安装 (1).gcc ubuntu下自带gcc编译器.可以通过“gcc -v”命令来查看是否安装. (2).g++ 安装g++编译器,可以 ...

  9. 子进程 已安装 post-installation 脚本 返回错误状态 1,dpkg: 处理软件包 python-crypto (--configure)时出错: 该软件包正处于非常不稳定的状态;

    这几天在学习redis的时候,装软件总是报错,两个问题都和dpkg有关,上网查阅了些解决办法,发现整体来说执行以下方法均可解决. 虽然每个人需要安装的包不同,但是出现此类问题的不同也只有安装包的名字, ...

随机推荐

  1. Mac Book触摸板失灵的解决办法(触摸板按下失灵)

    1. 先关机 2. 同时按住 command+option+R+P 3. 按电源键开机,同时手指保持按住前几个按钮的姿势. 4. 等待电脑发出四下“deng”的声音后松开即可.每次发声间隔大概6~7秒 ...

  2. 用python爬取豆瓣电影Top 250

    首先,打开豆瓣电影Top 250,然后进行网页分析.找到它的Host和User-agent,并保存下来. 然后,我们通过翻页,查看各页面的url,发现规律: 第一页:https://movie.dou ...

  3. vue使用技巧:Promise + async + await 解决组件间串行编程问题

    业务场景描述 大家都通过互联网投递过简历,比如在智联.58.猎聘等平台.投递心仪的职位前一般都需要前提创建一份简历,简历编辑界面常规的布局最上面是用户的个人基本信息,如姓名.性别.年龄.名族等,接着是 ...

  4. jquery事件委托详解

    jQuery事件委托处理流程 上一章分析jQuery.event.add的时候已经分析了事件绑定,再把绑定的部分源码抽出来 if ( !(eventHandle = elemData.handle) ...

  5. axiso 的使用

    Vue官方推荐的ajax请求框架叫做:axios axios的Get请求语法: axios.get("/item/category/list?pid=0") // 请求路径和请求参 ...

  6. jmeter学习笔记(三)配置元件之HTTP信息头管理

    使用jmeter模拟发送http请求时,有些请求是需要带上HTTP请求头里面的信息.比如页面需要登录信息的,那个就需要用户登录信息authorization.这个时候是需要使用到HTTP信息头管理器. ...

  7. spark 机器学习 knn 代码实现(二)

    通过knn 算法规则,计算出s2表中的员工所属的类别原始数据:某公司工资表 s1(训练数据)格式:员工ID,员工类别,工作年限,月薪(K为单位)       101       a类       8年 ...

  8. 第六篇:Python函数进阶篇

    在了解完了 Python函数基础篇之后,本篇的存在其实是为了整合知识,由于该篇的知识是否杂乱,故大家可以通过点开点连接直接进入其详细介绍,该篇主要大致的介绍一下几个知识点:  一.Python的迭代器 ...

  9. C++——多态实现原理分析

    前言 虚函数执行速度要稍慢一些.为了实现多态性,每一个派生类中均要保存相应虚函数的入口地址表,函数的调用机制也是间接实现.所以多态性总是要付出一定代价,但通用性是一个更高的目标. 实验环境 Windo ...

  10. Make 和 Makefile快速入门

    前言 一个项目,拥有成百上千的源程序文件,编译链接这些源文件都是有规则的.Makefile是整个工程的编译规则集合,只需要一个make命令,就可以实现“自动化编译”.make是一个解释makefile ...