热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Centos7下编译php5.6.19出错,怎么解决?

第一次编译安装PHP的时候很顺利,因为要增加freetype,所以要重新编译,结果死活就是无法通过configure。centos7信息uname-aLinuxdev3.10.0-327.el7.x86_64#1SMPThuNov1922:10:57UTC2015x86_64x8...
第一次编译安装PHP的时候很顺利,因为要增加freetype,所以要重新编译,结果死活就是无法通过configure。

  1. centos7信息

uname -a

Linux dev 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

  1. 运行 ./configure 报错

configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

  1. 运行 grep error config.log

cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
configure:4076: error: in `/usr/local/src/php-5.6.19':
configure:4078: error: cannot run C compiled programs.

  1. 按照网上说的方法 在configure后面加上了 --host=x86_64 ,报错
    configure: error: in `/usr/local/src/php-5.6.19':

configure: error: C preprocessor "/lib/cpp" fails sanity check

  1. config.log中错误提示,差好几个头文件

cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
configure:4076: error: in `/usr/local/src/php-5.6.19':
configure:4078: error: cannot run C compiled programs.
[root@dev php-5.6.19]# grep error config.log
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-qlanglvl=extc89'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-qlanglvl=ansi'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-std'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
:0:1: error: missing '(' after predicate
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
:0:1: error: missing '(' after predicate
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-Xc'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:12:0: fatal error: assert.h: No such file or directory
| Syntax error
conftest.c:12:0: fatal error: assert.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
configure:4478: error: in `/usr/local/src/php-5.6.19':
configure:4480: error: C preprocessor "/lib/cpp" fails sanity check

  1. gcc安装信息

[root@dev php-5.6.19]# rpm -qa | grep glibc
compat-glibc-headers-2.12-4.el7.centos.x86_64
glibc-utils-2.17-106.el7_2.4.x86_64
glibc-common-2.17-106.el7_2.4.x86_64
glibc-devel-2.17-106.el7_2.4.x86_64
glibc-static-2.17-106.el7_2.4.x86_64
glibc-2.17-106.el7_2.4.x86_64
glibc-headers-2.17-106.el7_2.4.x86_64
compat-glibc-2.12-4.el7.centos.x86_64

[root@dev php-5.6.19]# gcc -v
Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)

回复内容:

第一次编译安装PHP的时候很顺利,因为要增加freetype,所以要重新编译,结果死活就是无法通过configure。

  1. centos7信息

uname -a

Linux dev 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

  1. 运行 ./configure 报错

configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

  1. 运行 grep error config.log

cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
configure:4076: error: in `/usr/local/src/php-5.6.19':
configure:4078: error: cannot run C compiled programs.

  1. 按照网上说的方法 在configure后面加上了 --host=x86_64 ,报错
    configure: error: in `/usr/local/src/php-5.6.19':

configure: error: C preprocessor "/lib/cpp" fails sanity check

  1. config.log中错误提示,差好几个头文件

cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
configure:4076: error: in `/usr/local/src/php-5.6.19':
configure:4078: error: cannot run C compiled programs.
[root@dev php-5.6.19]# grep error config.log
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
cc: error: unrecognized command line option '-qversion'
cc: fatal error: no input files
conftest.c:9:19: fatal error: stdio.h: No such file or directory
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-qlanglvl=extc89'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-qlanglvl=ansi'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-std'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
:0:1: error: missing '(' after predicate
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
:0:1: error: missing '(' after predicate
conftest.c:9:20: fatal error: stdarg.h: No such file or directory
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
cc: error: unrecognized command line option '-Xc'
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:12:0: fatal error: assert.h: No such file or directory
| Syntax error
conftest.c:12:0: fatal error: assert.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
conftest.c:10:21: fatal error: limits.h: No such file or directory
| Syntax error
configure:4478: error: in `/usr/local/src/php-5.6.19':
configure:4480: error: C preprocessor "/lib/cpp" fails sanity check

  1. gcc安装信息

[root@dev php-5.6.19]# rpm -qa | grep glibc
compat-glibc-headers-2.12-4.el7.centos.x86_64
glibc-utils-2.17-106.el7_2.4.x86_64
glibc-common-2.17-106.el7_2.4.x86_64
glibc-devel-2.17-106.el7_2.4.x86_64
glibc-static-2.17-106.el7_2.4.x86_64
glibc-2.17-106.el7_2.4.x86_64
glibc-headers-2.17-106.el7_2.4.x86_64
compat-glibc-2.12-4.el7.centos.x86_64

[root@dev php-5.6.19]# gcc -v
Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)

看起来像是gcc的问题,建议你先安装并更新一下yum源,然后安装或更新下如下软件

yum update

yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng
libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel
gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2
libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

推荐阅读
  • 本文介绍了Linux系统中正则表达式的基础知识,包括正则表达式的简介、字符分类、普通字符和元字符的区别,以及在学习过程中需要注意的事项。同时提醒读者要注意正则表达式与通配符的区别,并给出了使用正则表达式时的一些建议。本文适合初学者了解Linux系统中的正则表达式,并提供了学习的参考资料。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • CentOS 7部署KVM虚拟化环境之一架构介绍
    本文介绍了CentOS 7部署KVM虚拟化环境的架构,详细解释了虚拟化技术的概念和原理,包括全虚拟化和半虚拟化。同时介绍了虚拟机的概念和虚拟化软件的作用。 ... [详细]
  • CEPH LIO iSCSI Gateway及其使用参考文档
    本文介绍了CEPH LIO iSCSI Gateway以及使用该网关的参考文档,包括Ceph Block Device、CEPH ISCSI GATEWAY、USING AN ISCSI GATEWAY等。同时提供了多个参考链接,详细介绍了CEPH LIO iSCSI Gateway的配置和使用方法。 ... [详细]
  • Centos7搭建ELK(Elasticsearch、Logstash、Kibana)教程及注意事项
    本文介绍了在Centos7上搭建ELK(Elasticsearch、Logstash、Kibana)的详细步骤,包括下载安装包、安装Elasticsearch、创建用户、修改配置文件等。同时提供了使用华为镜像站下载安装包的方法,并强调了保证版本一致的重要性。 ... [详细]
  • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
    本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
  • 本文介绍了在无法联网的情况下,通过下载rpm包离线安装zip和unzip的方法。详细介绍了如何搜索并下载合适的rpm包,以及如何使用rpm命令进行安装。 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • 学习SLAM的女生,很酷
    本文介绍了学习SLAM的女生的故事,她们选择SLAM作为研究方向,面临各种学习挑战,但坚持不懈,最终获得成功。文章鼓励未来想走科研道路的女生勇敢追求自己的梦想,同时提到了一位正在英国攻读硕士学位的女生与SLAM结缘的经历。 ... [详细]
  • Oracle分析函数first_value()和last_value()的用法及原理
    本文介绍了Oracle分析函数first_value()和last_value()的用法和原理,以及在查询销售记录日期和部门中的应用。通过示例和解释,详细说明了first_value()和last_value()的功能和不同之处。同时,对于last_value()的结果出现不一样的情况进行了解释,并提供了理解last_value()默认统计范围的方法。该文对于使用Oracle分析函数的开发人员和数据库管理员具有参考价值。 ... [详细]
  • LVS实现负载均衡的原理LVS负载均衡负载均衡集群是LoadBalance集群。是一种将网络上的访问流量分布于各个节点,以降低服务器压力,更好的向客户端 ... [详细]
  • 本文详细介绍了在Centos7上部署安装zabbix5.0的步骤和注意事项,包括准备工作、获取所需的yum源、关闭防火墙和SELINUX等。提供了一步一步的操作指南,帮助读者顺利完成安装过程。 ... [详细]
  • 在Windows10系统上使用VMware创建CentOS虚拟机的详细步骤教程
    本文详细介绍了在Windows10系统上使用VMware创建CentOS虚拟机的步骤,包括准备条件、安装VMware、下载CentOS ISO文件、创建虚拟机并进行自定义配置、设置虚拟机的ISO与网络、进行安装和配置等。通过本文的指导,读者可以轻松地创建自己的CentOS虚拟机并进行相应的配置和操作。 ... [详细]
  • 本文介绍在使用vmware中配置centos6.5时遇到的网络问题,包括host-only和natip的配置,以及无法上网的原因。同时提供了解决方法,包括去掉host-only配置文件中的gateway。 ... [详细]
  • LINUX学习之centos7营救模式
    今天卸载软件的时候,不小心把GNOME的一些组件给卸了,导致桌面无法正常开启,会卡在启动过程中,而我的开机启动模式又是设置为图形界面,所以一开LINUX就卡住了,进入不了命令行界面 ... [详细]
author-avatar
追忆幽梦_554
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有