Cygwin安装swoole(包括遇到的坑)

时间:2024-04-13 13:36:04

Cygwin安装swoole

完整的安装步骤如下(亲测通过):

前提:下载Cygwin工具和swoole源码
Cygwin 官方地址:http://www.cygwin.com/
swoole 官方下载地址:https://github.com/swoole/swoole-src/releases

一、安装Cygwin
Cygwin安装swoole(包括遇到的坑)Cygwin安装swoole(包括遇到的坑)Cygwin安装swoole(包括遇到的坑)Cygwin安装swoole(包括遇到的坑)Cygwin安装swoole(包括遇到的坑)
在这一步,需要注意,为了获得最快的下载速度,使用阿里云镜像(http://mirrors.aliyun.com/cygwin/)选择完成后,点击“下一步”,

Cygwin安装swoole(包括遇到的坑)
Cygwin安装swoole(包括遇到的坑)
选择要安装的扩展包,一共需要找六个
扩展包1: gcc: gcc-coreCygwin安装swoole(包括遇到的坑)
扩展包2: php:php 、 php-devel(这里是两个php与php-devel)
Cygwin安装swoole(包括遇到的坑)
扩展包3: pcre-devel:libpcre-devel(1和2都要选)
Cygwin安装swoole(包括遇到的坑)
扩展包4: autoconf
Cygwin安装swoole(包括遇到的坑)
扩展包5: c++:gcc-objc++ 、 libc++devel 、 libc++1
这里最好将所有的查询出来的都勾选,避免后面编译出错

扩展包6:wget 也是将查询出来的建议都勾选(安装了apt-cyg就能向使用Ubuntu一样使用apt-get install/remove命令安装卸载软件了,非常方便。)
Cygwin安装swoole(包括遇到的坑)
Cygwin安装swoole(包括遇到的坑)
安装完成,创建桌面和开始菜单快捷方式
Cygwin安装swoole(包括遇到的坑)
双击桌面快捷方式 Cygwin64 Terminal 打开类似linux的命令行,可以执行常见的linux命令
Cygwin安装swoole(包括遇到的坑)

二、安装swoole

Cygwin安装swoole(包括遇到的坑)
将解压出来的swoole源码复制到Cygwin安装目录中 /home/swoole-src-master
Cygwin安装swoole(包括遇到的坑)
切换到 /home/swoole-src-master 目录中准备开始安装
Cygwin安装swoole(包括遇到的坑)
执行 phpize 命令,生成编译的配置文件configure,这一步要注意关闭杀毒软件(会误报)
执行 ./configure && make && make install 进行配置并打包,最后安装
Cygwin安装swoole(包括遇到的坑)
Cygwin安装swoole(包括遇到的坑)
安装成功!!!

手动打开 /etc/php.ini ,添加扩展 extension=swoole.so
Cygwin安装swoole(包括遇到的坑)
再执行 php -m 命令即可查看php支持的模块,能看到swoole就算是成功了。
Cygwin安装swoole(包括遇到的坑)

总结

1.在Cygwin里面安装swoole时,报 configure: error: C++ preprocessor “/lib/cpp” fails sanity check 错误是因为未安装C++解释器造成的,只需要删除重新安装时选择C++解释器即可。
2.usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h 错误 前面两种都选择libpcre1-dev libpcre2-dev