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)
- 大佬,拉取你新的代码 然后再github actions构建 又报错了,有时间您看一下吧 HOT 1
- xz dependency unavailable HOT 1
- win版中构建的micro.sfx HOT 1
- Build error with Postgres because of libxml2 HOT 3
- libuuid fails to build on linux HOT 1
- FreeBSD Support Not Working - "Current OS is not supported" HOT 10
- bug: Linux x86_64 build failed HOT 6
- Compiled Windows executable isn't running HOT 1
- Windows Defender SmartScreen HOT 4
- SSL operation failed with code 5 HOT 10
- In extreme cases micro.sfx using `--with-upx-pack` will build the wrong binary
- Extension request: `gd` on Windows
- postgresql: Failed to get pkg-config information HOT 3
- ncurses 6.5 not working with libreadline
- xz build failed on Linux and macOS
- download bug: for-extensions=redis does not download zstd
- Extension request: `intl` on Windows HOT 2
- `intl` ICU build errors HOT 2
- SAPI embed Support on Windows HOT 2
- Add the parallel 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.