./swoole_config.h:22:2: error: #error “GCC 4.8 or later required”

Centos下php7安装swoole 扩展的时候,提示的错误。我记得gcc 版本升级过一次到4.8.5,无语。

root@netpc.com.cn swoole-4.3.5]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.8.5/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
Thread model: posix
gcc version 4.8.5 (GCC)

[root@netpc.com.cn swoole-4.3.5]# cc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-libgcj-multifile –enable-languages=c,c++,objc,obj-c++,java,fortran,ada –enable-java-awt=gtk –disable-dssi –disable-plugin –with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre –with-cpu=generic –host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)

老旧共存啊?!

先找下到底有多少gcc

[root@netpc.com.cn ~]# find / -name ‘gcc’
/usr/bin/gcc
/usr/libexec/gcc
/usr/lib/gcc
/usr/local/bin/gcc
/usr/local/libexec/gcc
/usr/local/lib/gcc
/usr/local/src/gcc-4.8.5/gcc-build-4.8.5/gcc
/usr/local/src/gcc-4.8.5/gcc
/usr/local/src/gcc-4.8.5/gcc/testsuite/ada/acats/tests/gc

接着替换下:

mv /usr/bin/gcc /usr/bin/gcc4.1.2
ln -s /usr/local/bin/gcc /usr/bin/gcc

搞定

此条目发表在服务器分类目录,贴了, 标签。将固定链接加入收藏夹。

发表回复