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. 一、ribbon如何集成在openfeign中使用

    所有文章 https://www.cnblogs.com/lay2017/p/11908715.html 正文 ribbon是springcloud封装的一个基于http客户端负载均衡的组件.spri ...

  2. echarts字体适配

    var html = document.getElementsByTagName("html")[0]; var width = html.clientWidth; var too ...

  3. (转)使用SDWebImage和YYImage下载高分辨率图,导致内存暴增的解决办法

    http://blog.csdn.net/guojiezhi/article/details/52033796

  4. 在SAP除了使用Cordova生产移动应用外,还有这种方式

    本文和Jerry过去的文章不太一样,算不上Jerry的知识分享,只是记录一下Jerry用React-Native把应用安装到Android手机上遇到的一些问题,方便以后查看. Jerry的同事Leo用 ...

  5. HTML基础之HTML常用标签

    下面小编为大家整理一些HTML的常用标签 a.布局标签 div标签定义文档中的分区或节(division/section),可以把文档分割为独立的.不同的部分,主要用于布局. aside标签的内容可用 ...

  6. DNS服务——服务端 和 客户端 配置

    参考:Linux下DNS主从服务器搭建详解 前言 电脑经常会出现一些网络小毛病.有的时候,QQ能正常上网,但是网页却打不开.这种时候十有八九是DNS出问题了. QQ在DNS不可用的时候,可以跳过DNS ...

  7. 用python批量插入数据到数据库中

    既然使用python操作数据库必不可少的得使用pymysql模块 可使用两种方式进行下载安装: 1.使用pip方式下载安装 pip install pymysql 2.IDE方式 安装完成后就可以正常 ...

  8. IDEA快捷键之关闭标签页和选定单词

    下面所说的快捷键仅作为演示使用,个人可根据喜好自行设置 使用Alt + W 选中某个单词 点击IDEA左上角的File 打开Settings 在左侧点击KeyMap 打开右侧的Editor Actio ...

  9. charles 手机证书下载安装

    本文参考:charles 手机证书下载安装 本文的Charles,适应windows/MAC/IOS/Android,避免抓包HTTPS失败和乱码: 用的版本是V4.1.2,其它版本原理类似: cha ...

  10. 个性化召回算法实践(一)——CF算法

    协同过滤推荐(Collaborative Filtering Recommendation)主要包括基于用户的协同过滤算法与基于物品的协同过滤算法. 下面,以movielens数据集为例,分别实践这两 ...