swoole 扩展 make 安装时遇到的问题
最开始我是使用brew安装环境的,但是在执行下面这句话的时候提示:“No formula found for "swoole".”
brew search swoole
然后使用pecl 进行安装
pecl install swoole
又出错:
No releases available for package "pecl.php.net/swoole"
install failed
最后选择make安装
/Users/xxx/package/swoole/src/os/sendfile.c:23:5: error: conflicting types for 'swoole_sendfile'
int swoole_sendfile(int out_fd, int in_fd, off_t offset, off_t size)
/Users/xxx/package/swoole/include/swoole.h:2166:5: note: previous declaration is here
int swoole_sendfile(int out_fd, int in_fd, off_t offset, size_t size);
一路很不顺利,然后我就去看了这两个文件的出错了的地方
sendfile.c
int swoole_sendfile(int out_fd, int in_fd, off_t *offset, off_t size)
swoole.h
#if defined(HAVE_KQUEUE) || !defined(HAVE_SENDFILE) int swoole_sendfile(int out_fd, int in_fd, off_t *offset, size_t size); #else
然后我发现最后的这个size的类型不一致,我尝试将下面的 size_t 改为 off_t
最后make成功了.....