Skip to content

uv 和 swoole 同时启用的时候会导致 uv 找不到,分开各自编译都是ok的 #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
minbaby opened this issue Jan 4, 2024 · 2 comments · Fixed by #308
Closed
Labels
bug Something isn't working kind/extension Issues related to extensions

Comments

@minbaby
Copy link
Contributor

minbaby commented Jan 4, 2024

今天更新了一下仓库,然后在编译8.1的时候报了如下的错

git commit: dabdb51 (xz use github)

[12:06:12] [INFO] Build OS:       Linux (x86_64)
[12:06:12] [INFO] Build SAPI:     cli
[12:06:12] [INFO] Extensions (5): zlib, openssl, curl, swoole, uv
[12:06:12] [INFO] Libraries (7):  zlib, openssl, brotli, nghttp2, curl, libcares, libuv
[12:06:12] [INFO] Strip Binaries: yes
[12:06:12] [INFO] Enable ZTS:     no
[12:06:12] [INFO] Hardcoded INI:  openssl.capath=/etc/ssl/certs
[12:06:12] [WARN] Some extensions will be enabled due to dependencies: zlib,openssl,curl

报错

checking Whether to enable the "dtrace" debug... no
checking for pkg-config... /home/min-work/code/php/static-php-cli/buildroot/bin/pkg-config
checking for libuv... from option: found in /home/min-work/code/php/static-php-cli/buildroot
checking for uv_version in -luv... no
configure: error: wrong uv library version or library not found

   SPC\exception\RuntimeException

  Command run failed with code[1]: cd '/home/min-work/code/php/static-php-cli/source/php-src' && LD_LIBRARY_PATH=/usr/local/musl/x86_64-linux-musl/lib ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg --enable-cli --disable-fpm --disable-embed --disable-micro --with-zlib --with-zlib-dir="/home/min-work/code/php/static-php-cli/buildroot" --with-openssl=/home/min-work/code/php/static-php-cli/buildroot --with-openssl-dir=/home/min-work/code/php/static-php-cli/buildroot --with-curl --enable-swoole --enable-swoole-coro-time --enable-thread-context --enable-swoole-curl --enable-openssl --enable-cares --with-brotli-dir=/home/min-work/code/php/static-php-cli/buildroot --with-nghttp2-dir=/home/min-work/code/php/static-php-cli/buildroot --disable-swoole-pgsql --disable-swoole-sqlite --with-uv="/home/min-work/code/php/static-php-cli/buildroot" CFLAGS='' CPPFLAGS='-I/home/min-work/code/php/static-php-cli/buildroot/include' LDFLAGS='-L/home/min-work/code/php/static-php-cli/buildroot/lib' LIBS='-ldl -lpthread'
@minbaby minbaby changed the title uv 和 swoole 同时启用的时候会导致 uv 找不到 uv 和 swoole 同时启用的时候会导致 uv 找不到,分开各自编译都是ok的 Jan 4, 2024
@crazywhalecc crazywhalecc added bug Something isn't working kind/extension Issues related to extensions labels Jan 4, 2024
@crazywhalecc
Copy link
Owner

crazywhalecc commented Jan 4, 2024

初步判断可能是由于 swoole 的配置文件指向错误的 brotli 导致的问题(编译 brotli 依赖时生成的是 libbrotlicommon.a,而不是 libbrotli.a,所以无法读取 -lbrotli),但不知道为什么不带 uv 时可以正常编译。

https://github.com/swoole/swoole-src/blob/e1ee8c3f709cbde3a46c77e5ee3c322b8d485af5/config.m4#L986C18-L986C18

另外,刚才也发现 uv 扩展依赖 sockets 扩展,后面我会修复它,加上依赖关系。

https://github.com/amphp/ext-uv/blob/670a609efc36c9043be37bae4126f06ed30fde21/config.m4#L45C22-L45C22

@minbaby
Copy link
Contributor Author

minbaby commented Jan 5, 2024

初步判断可能是由于 swoole 的配置文件指向错误的 brotli 导致的问题(编译 brotli 依赖时生成的是 libbrotlicommon.a,而不是 libbrotli.a,所以无法读取 -lbrotli),但不知道为什么不带 uv 时可以正常编译。

https://github.com/swoole/swoole-src/blob/e1ee8c3f709cbde3a46c77e5ee3c322b8d485af5/config.m4#L986C18-L986C18

另外,刚才也发现 uv 扩展依赖 sockets 扩展,后面我会修复它,加上依赖关系。

https://github.com/amphp/ext-uv/blob/670a609efc36c9043be37bae4126f06ed30fde21/config.m4#L45C22-L45C22

经验证确实是 brotli 的问题,我手动改了一下软链接,再进行编译就可以正常通过了,就是报 uv 的错就很诡异,等我再研究研究,看看看不能提个 pr

        shell()->cd(BUILD_ROOT_PATH . '/lib')
            ->exec('ln -sf libbrotlicommon.a libbrotlicommon-static.a')
            ->exec('ln -sf libbrotlicommon.a libbrotli.a')
            ->exec('ln -sf libbrotlicommon.a libbrotli-static.a')
            ->exec('ln -sf libbrotlidec.a libbrotlidec-static.a')
            ->exec('ln -sf libbrotlienc.a libbrotlienc-static.a');

minbaby added a commit to minbaby/static-php-cli that referenced this issue Jan 5, 2024
@crazywhalecc crazywhalecc linked a pull request Jan 5, 2024 that will close this issue
3 tasks
crazywhalecc added a commit that referenced this issue Jan 5, 2024
* fix #307 uv 和 swoole 同时启用的时候会提示 uv 找不到

* Update test-extensions.php

* update cs-fixer config for newer version

* revert composer.lock to fit 8.1

---------

Co-authored-by: Jerry Ma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/extension Issues related to extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants