今天升级 Swoole 版本的时候,指定开启 OpenSSL 的时候报错了。以下是场景还原

安装

wget https://github.com/swoole/swoole-src/archive/v4.4.8.tar.gz
tar -xzf v4.4.8.tar.gz
cd swoole-src-4.4.8
phpize
./configure --enable-openssl --enable-sockets --enable-http2 --enable-mysqlnd

然后 make 的时候报错了 file

$ make

/bin/sh /Users/hedeqiang/Desktop/swoole-src-4.4.8/libtool --mode=compile g++  -I. -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -DPHP_ATOM_INC -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/include -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/main -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -I/usr/local/Cellar/php/7.3.10/include/php -I/usr/local/Cellar/php/7.3.10/include/php/main -I/usr/local/Cellar/php/7.3.10/include/php/TSRM -I/usr/local/Cellar/php/7.3.10/include/php/Zend -I/usr/local/Cellar/php/7.3.10/include/php/ext -I/usr/local/Cellar/php/7.3.10/include/php/ext/date/lib -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/include -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/thirdparty/hiredis  -DHAVE_CONFIG_H  -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11   -c /Users/hedeqiang/Desktop/swoole-src-4.4.8/php_swoole_cxx.cc -o php_swoole_cxx.lo
mkdir .libs
 g++ -I. -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -DPHP_ATOM_INC -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/include -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/main -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -I/usr/local/Cellar/php/7.3.10/include/php -I/usr/local/Cellar/php/7.3.10/include/php/main -I/usr/local/Cellar/php/7.3.10/include/php/TSRM -I/usr/local/Cellar/php/7.3.10/include/php/Zend -I/usr/local/Cellar/php/7.3.10/include/php/ext -I/usr/local/Cellar/php/7.3.10/include/php/ext/date/lib -I/Users/hedeqiang/Desktop/swoole-src-4.4.8 -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/include -I/Users/hedeqiang/Desktop/swoole-src-4.4.8/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /Users/hedeqiang/Desktop/swoole-src-4.4.8/php_swoole_cxx.cc  -fno-common -DPIC -o .libs/php_swoole_cxx.o
In file included from /Users/hedeqiang/Desktop/swoole-src-4.4.8/php_swoole_cxx.cc:1:
In file included from ./php_swoole_cxx.h:19:
./php_swoole.h:129:2: error: "Enable openssl support, require openssl library"
#error "Enable openssl support, require openssl library"
 ^
1 error generated.
make: *** [php_swoole_cxx.lo] Error 1

开始以为 OpenSSL 没有安装,结果发现并不是

brew install openssl

Warning: openssl 1.0.2t is already installed and up-to-date
To reinstall 1.0.2t, run `brew reinstall openssl`

最后忽然想起来制定下 OpenSSL 的路径就好了

brew 安装的 OpenSSL 默认在 /usr/local/Cellar/openss/版本号

我的是 1.0.2t,因此路径为 /usr/local/Cellar/openssl/1.0.2t

./configure --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2t --enable-sockets --enable-http2 --enable-mysqlnd

ok,果真如此,,之后就可以愉快的 make && make install 了。

file

只是记录下而已。权当笔记...

关于极客返利

极客返利 是由我个人开发的一款网课返利、返现平台。包含 极客时间返现、拉勾教育返现、掘金小册返现、GitChat返现。目前仅包含这几个平台。后续如果有需要可以考虑其他平台。 简而言之就是:你买课,我返现。让你花更少的钱,就可以买到课程。

https://geekfl.com

https://geek.laravelcode.cn

版权许可

本作品采用 知识共享署名 4.0 国际许可协议 进行许可。

转载无需与我联系,但须注明出处,注明文章来源 Mac 安装 Swoole 出现 Enable openssl support, require openssl library 的解决办法

联系我

编程怪事
暂无回复
0 / 180