Swoole-src: Mac pecl install swoole --报错:/private/tmp/pear/temp/swoole/include/server.h:908:53: error: no member named 's6_addr32' in 'struct in6_addr'

Created on 30 Sep 2018  ·  10Comments  ·  Source: swoole/swoole-src

Mac10.14
下面是安装过程:
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
enable debug/trace log support? [no] : yes
enable sockets supports? [no] : yes
enable openssl support? [no] : yes --with-openssl-dir=/usr/local/opt/openssl/bin/openssl
enable http2 support? [no] : no
enable async-redis support? [no] : yes
enable mysqlnd support? [no] : yes
enable postgresql coroutine client support? [no] : no
building in /private/tmp/pear/temp/pear-build-zhimmav1NUHm/swoole-4.2.1
running: /private/tmp/pear/temp/swoole/configure --with-php-config=/usr/local/opt/[email protected]/bin/php-config --enable-debug-log=yes --enable-sockets=yes --enable-openssl=yes --with-openssl-dir=/usr/local/opt/openssl/bin/openssl --enable-http2=no --enable-async-redis=yes --enable-mysqlnd=yes --enable-coroutine-postgresql=no

报错信息:
cc -I. -I/private/tmp/pear/temp/swoole -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-zhimmav1NUHm/swoole-4.2.1/include -I/private/tmp/pear/temp/pear-build-zhimmav1NUHm/swoole-4.2.1/main -I/private/tmp/pear/temp/swoole -I/usr/local/Cellar/[email protected]/7.1.22/include/php -I/usr/local/Cellar/[email protected]/7.1.22/include/php/main -I/usr/local/Cellar/[email protected]/7.1.22/include/php/TSRM -I/usr/local/Cellar/[email protected]/7.1.22/include/php/Zend -I/usr/local/Cellar/[email protected]/7.1.22/include/php/ext -I/usr/local/Cellar/[email protected]/7.1.22/include/php/ext/date/lib -I/usr/local/opt/openssl/bin/openssl/include -I/private/tmp/pear/temp/swoole -I/private/tmp/pear/temp/swoole/include -DHAVE_CONFIG_H -Wall -pthread -g -O2 -std=gnu89 -c /private/tmp/pear/temp/swoole/src/factory/base.c -fno-common -DPIC -o src/factory/.libs/base.o
In file included from /private/tmp/pear/temp/swoole/src/factory/base.c:18:
/private/tmp/pear/temp/swoole/include/server.h:908:53: error: no member named 's6_addr32' in 'struct in6_addr'
key = conn->info.addr.inet_v6.sin6_addr.s6_addr32[3];
~~~~~~~~~ ^
1 error generated.
make: * [src/factory/base.lo] Error 1
ERROR: `make' failed

,看到的各位,帮解决下

waiting for user action

Most helpful comment

如果是通过 brew 安装的 php, 可以使用如下环境变量, 让编译器编译时找到正确的 openssl 库

English Translation
If you install PHP via brew, You may need to set the following environment variables so that the compiler can find the correct OpenSSL library when compiling

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

All 10 comments

请贴一下操作系统信息, GCC版本等, 尊重issue模板给出的要求再提问.

MacOS 10.13.6 无法重现此问题。

我最近也碰到了这个问题
Mac mini
系统: 10.13.4
gcc:
$ gcc --version

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@zzzeee 是最新的swoole版本么

@twose 恩,swoole-4.2.7

In file included from /Users/mac/Sites/extension/swoole-src-4.2.7/src/factory/base.c:18:
/Users/mac/Sites/extension/swoole-src-4.2.7/include/server.h:915:53: error: no member named 's6_addr32' in 'struct in6_addr'
            key = conn->info.addr.inet_v6.sin6_addr.s6_addr32[3];
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.
make: *** [src/factory/base.lo] Error 1

@twose 我说一下我的安装过程:

  1. 下载 -> 解压 -> 进入目录
  2. phpize
  3. 编译
./configure \
--enable-openssl  \
--enable-http2  \
--enable-async-redis \
--enable-sockets \
--enable-mysqlnd

去除了文档中原有的设置项(--enable-coroutine), 看到文档说4.0.1后的版本移除了此编译选项(回复时请也说明下这个)

出现报错: error: 'openssl/ssl.h' file not found

解决方式(网上查找的资料):

cp -R /usr/local/Cellar/openssl/1.0.2n/include/openssl /usr/local/include/
cp -R /usr/local/Cellar/openssl/1.0.2n/include/openssl ~/extension/swoole-src-4.2.7/include

修改编译选项

./configure \
--with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config \
--enable-openssl \
--with-openssl-dir=/usr/local/include \
--enable-sockets \
--enable-mysqlnd
  1. make
    报错: swoole-src-4.2.7/include/server.h:915:53: error: no member named 's6_addr32' in 'struct in6_addr'

我现在的系统是 Mac 10.13.4, 如果没有好的解决方案, 我打算升级一下我的系统

@zzzeee

  1. openssl指定的路径是安装路径不是头文件路径
  2. 贴一下configure的日志, 这里好像没有检测到你是MAC系统导致的

@twose
问题解决了, 是with-openssl-dir的指向问题, 修改成安装路径(/usr/local/opt/openssl)即可

谢谢 ~~~

如果是通过 brew 安装的 php, 可以使用如下环境变量, 让编译器编译时找到正确的 openssl 库

English Translation
If you install PHP via brew, You may need to set the following environment variables so that the compiler can find the correct OpenSSL library when compiling

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Hi, I ran into the same issue, unfortunately I do not speak Chinese so I do not know how to fix that issue ?

Can someone translate it to me, please ?

Edit
Resolved with exporting constants:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
Was this page helpful?
0 / 5 - 0 ratings