在WSL中安装swool报错 error: unrecognized command line option '-V' 的解决方法

Windows Subsystem for Linux Ubuntu中使用pecl安装swool时遇到错误“error: C compiler cannot create executables”、“error: unrecognized command line option ‘-V‘”

解决方法

先看解决方法, 将gcc版本降低到4.8即可,因为高版本gcc取消了-V参数:

sudo apt install gcc-4.8 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
wget https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz
wget https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz
cd swoole-src-2.1.1/
phpize
./configure
make
make install

详细解决思路

详细解决思路如下,有兴趣的童鞋请继续看:

pecl install swool

checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... no
configure: error: in /home/www/swoole-src-2.1.1‘: configure: error: C compiler cannot create executables Seeconfig.log‘ for more details

不知道这个config.log文件在哪里,而且发现swool的版本也是1.x而不是2.x。于是下载swool的源码,重新进行编译安装

wget  https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz
cd swoole-src-2.1.1
phpize
./configure

依然报上面的错误,不过这次可以找到错误日志了

cat 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
#省略部分代码 ...
configure:2582: cc    conftest.c  >&5
cc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
#省略部分代码 ...
configure:2629: error: in `/home/www/swoole-src-2.1.1':
configure:2631: error: C compiler cannot create executables
See `config.log' for more details
#省略部分代码 ...

于是,从第一个错误开始寻找,google搜索“error: unrecognized command line option ‘-V‘”
找了半天都没有找到解决方案(主要是英文烂),有说要安装openssl的, 有说要装pkg-config的,还有几个记不清了,都装了还是报错,几乎要放弃
终于看到一个帖子说gcc高于4.9的版本貌似取消了-V参数,迎来了曙光~
使用gcc --version 查看版本发现是5.4.0
问题找到:
wsl ubuntu的版本为16.04,apt默认安装的gcc版本为5.4.0,该版本gcc不支持-V参数
立刻搜索“apt修改软件版本”, 找到~Ubuntu安装切换多个软件版本 http://blog.csdn.net/honyniu/article/details/46370491

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20

重新安装,搞定收工

在WSL中安装swool报错 error: unrecognized command line option '-V' 的解决方法

原文地址:https://www.cnblogs.com/dodos/p/8605880.html

时间: 2024-10-16 14:27:00

在WSL中安装swool报错 error: unrecognized command line option '-V' 的解决方法的相关文章

error: unrecognized command line option "-std=c11" 解决办法

今天在安装php版本 grpc扩展的时候报错如下: cc1: error: unrecognized command line option "-std=c11" cc1: warnings being treated as errors cc1: error: unrecognized command line option "-Wno-parentheses-equality" 开始搜寻解决方案,经查,出现这个 编译错误的原因在g++ gcc 版本不够高. 解决

python安装locustio报错error: invalid command 'bdist_wheel'的解决方法

locust--scalable user load testing tool writen in Python(是用python写的.规模化.可扩展的测试性能的工具) 安装locustio需要的环境条件是:Python2.6+,但是不支持Python3. 今天在cmd里运行pip install locustio,报错提示:error: invalid command 'bdist_wheel'. 原因:pip和setuptools的版本较低. 解决方案:升级pip和setuptools. 一

安装vcredist_x86,报错提示:Command line option syntax error.Type Command /?for Help

在安装loadrunner11的时候,提示缺少vc2005_sp1_with_atl_fix_redist组件,可以直接点击确定进行安装组件,或者进入loadrunner目录下lrunner\Chs\prerequisites\vc2005_sp1_redist手动安装vcredist_x86.exe,这时候出现了报错:Command line option syntax error.Type Command /?for Help 解决方案: 修改环境变量 修改完之后就可以正常安装啦 参考地址:

brew安装mongodb报错Error: No available formula with the name 'mongodb'

原因:MongoDB不再是开源的了,并且已经从Homebrew中移除 #43770 设定  $ brew tap mongodb/brew 安装 $ brew install [email protected]2     brew安装mongodb报错Error: No available formula with the name 'mongodb' 原文地址:https://www.cnblogs.com/zgaspnet/p/11769704.html

安装MySQL-python报错error: command 'gcc' failed with exit status 1

[[email protected] MySQL-python-1.2.3]# python setup.py install function) .... _mysql.c:133: error: 'ER_SYNTAX_ERROR' undeclared (first use in this function) _mysql.c:380: error: '_mysql_ConnectionObject' has no member named 'connection' _mysql.c:382

安装nghttp2 报错error: Libtool library used but 'LIBTOOL' is undefined

nghttp2 报错error: Libtool library used but 'LIBTOOL' is undefined 如果重新安装libtool和autoconf升级到2.69后,还是报错, 则进行下面的操作: 1,查看aclocal的路径 aclocal --print-ac-dir 显示/usr/local/share/libtool/m4 ls看看里面没有m4文件. 则copy /usr/share/libtool/m4里面的m4文件到此目录下. 2,cd到nghtt2目录 执

Eclipse中mvn install 报错error in opening zip file

报错信息 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project wms: Compilation failure [ERROR] Failure executing javac, but could not parse the error: [ERROR] 错误: 读取C:\Users\Administrato

mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法

首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2) 运行如下解决:参考 http://www.thinksaas.cn/group/topic/347978/ unset TMPDIR mysql_install_db --v

安卓中运行报错Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决

安卓中运行报错Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决 安卓中运行报错Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决