Comments (5)
I patched some php source code then it's broken. (kqueue not found)
from static-php-cli.
libcat是个魔改版的libuv 我觉得多半是没法和libuv静态链接 建议直接conflict
from static-php-cli.
@dixyes 我用的就是自带的 libcat 编译的,但是我可能 patch 了某个地方或者少了什么参数,导致我在 macOS 上 configure 的时候找不到 kqueue,最终导致 make 时缺少一个库而没办法链接。需要找一下,但我目前还有很多其他的工作和任务要做,先把问题写下,一个一个来。
from static-php-cli.
如果是单独的swow编译炸了,那应该是构建系统bug,可以整理下编译环境的脚本操作啥的提个issue
from static-php-cli.
@dixyes 应该是老生常谈的和 Swoole 不兼容问题了,复现操作如下:
- 环境:macOS Ventura 13.3.1
- 硬件:M2 MacBook Air
# 下载源码后解压
tar -zxvf php-8.1.18.tar.gz
cd php-8.1.18
# 把所有可能需要编译的外部扩展都移动到 ext,包含下面的
# zstd,从 https://github.com/kjdev/php-ext-zstd master 分支克隆
mv ext-zstd/ php-8.1.18/ext/zstd
# micro,从 https://github.com/dixyes/phpmicro master 分支克隆
mv micro php-8.1.18/sapi/
# mongodb,从 GitHub 下载 mongodb/mongo-php-driver 的最新 Release 的 tar.gz
mv mongodb php-8.1.18/ext/
# protobuf,从 pecl 下载:http://pecl.php.net/get/protobuf
mv protobuf php-8.1.18/ext/
# inotify,从 pecl 下载:http://pecl.php.net/get/inotify
mv inotify php-8.1.18/ext/
# redis,从 https://github.com/phpredis/phpredis 5.3.7 分支克隆
mv redis php-8.1.18/ext/
# swoole,从 GitHub 下载发行版的 tar:swoole/swoole-src(当前版本儿是 4.8.13)
mv swoole php-8.1.18/ext/
# swow,从 https://github.com/swow/swow ci 分支克隆
mv swow php-8.1.18/ext/swow-src
ln -s php-8.1.18/ext/swow-src/ext php-8.1.18/ext/swow
# yaml,从 https://github.com/php/pecl-file_formats-yaml php7 分支克隆
mv yaml php-8.1.18/ext/
# 打 phpmicro 的部分 patch
cd php-8.1.18
cat sapi/micro/patches/static_opcache_81.patch | patch -p1
cat sapi/micro/patches/cli_checks_81.patch | patch -p1
cat sapi/micro/patches/disable_huge_page.patch | patch -p1
cat sapi/micro/patches/zend_stream.patch | patch -p1
cat sapi/micro/patches/macos_iconv.patch | patch -p1
# 构建
./buildconf --force
vim configure # 手动编辑关闭capstone
./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --host=aarch64-apple-darwin CFLAGS='--target=arm64-apple-darwin -Werror=unknown-warning-option' --disable-all --disable-cgi --disable-phpdbg --enable-cli --enable-fpm --enable-micro --enable-swow --disable-swow-ssl --disable-swow-curl PKG_CONFIG_PATH="/Users/jerry/project/git-project/static-php-cli/buildroot/lib/pkgconfig/" CC='clang' CXX='clang++' CFLAGS='--target=arm64-apple-darwin -Wimplicit-function-declaration'
make clean
make -j8 EXTRA_CFLAGS="-g -Os -fno-ident" EXTRA_LIBS=" -lresolv" cli
最终报错:
clang: warning: argument unused during compilation: '-fno-ident' [-Wunused-command-line-argument]
Undefined symbols for architecture arm64:
"_uv__fs_event_close", referenced from:
_uv_close in core.o
"_uv__io_check_fd", referenced from:
_uv_poll_init in poll.o
"_uv__io_fork", referenced from:
_uv_loop_fork in loop.o
"_uv__io_poll", referenced from:
_uv_run in core.o
_uv_crun in core.o
"_uv__kqueue_init", referenced from:
_uv__platform_loop_init in darwin.o
"_uv__platform_invalidate_fd", referenced from:
_uv__io_close in core.o
_uv__poll_stop in poll.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
我使用 lwmbs 的指令执行了一遍,使用类似的手动一条一条执行构建方案,最终得出的结论:
- lwmbs 没有把所有扩展放到 ext,这个问题有可能是这几个扩展中有互相干扰的情况。
- 不将其他不需要的扩展放入 ext 目录编译即可成功。这时候对比发现
./configure
下有关 Swow 的 check 有一条:checking for kqueue in -lc... no
。将 Swoole 移除后为yes
。推测可能是和 Swoole 互相干扰,而--disable-all
并不能起到互不干扰的作用。应该是 autoconf 阶段有冲突内容,具体还没有深入研究。 - Linux 下没有这个问题。
from static-php-cli.
Related Issues (20)
- freetype is buggy for bulk(huge) HOT 1
- postgresql bug in bulk build for macOS x86_64 HOT 7
- macOS 环境下 静态编译 libldap imap 库 存在 编译bug
- macOS does not support mongodb extension HOT 1
- gd 扩展无法在 Actions 构建 HOT 9
- 这个新的分支和以前旧的分支构建上有什么区别吗? HOT 26
- ext-snappy configuration may break features of other extensions
- 是否支持libwebp,--with-webp编译选项 HOT 4
- 如何自定义每个依赖库的编译选项,添加自己想要的其他库? HOT 9
- [CRIT] Source [pkg-config] not downloaded or not locked, you should download it first ! HOT 11
- error shown when using the built in composer and php HOT 1
- Redis compression and serializer options not enabled in phpredis HOT 2
- Add backup url for unstable sources
- Unable to Build PHP Static with GitHub Actions - [CRIT] ext [igbinary] is not supported yet HOT 1
- 大佬,actions构建的 apcu 扩展 如何把apc.enable_cli=1写入php.ini里面,我应该改那个文件呢? HOT 1
- Bulk build failed: libxml2 with icu HOT 1
- 构建postgresql扩展报错 src/Makefile.shlib:461: *** 遗漏“endif” HOT 2
- uv 和 swoole 同时启用的时候会导致 uv 找不到,分开各自编译都是ok的 HOT 2
- imagick 和 swoole 同时编译报错,去掉 lib.json 中 brotli 的 `-static` 后缀就可以正常编译了 HOT 2
- 【feature】 support UI extension HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from static-php-cli.