Build fails on 32-bit Linux and FreeBSD with Clang
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
./buildconf
./configure
make
Resulted in this output on FreeBSD 14 32-bit with Clang 16.0.6 (default compiler selected by the system):
ld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in ext/opcache/.libs/zend_accelerator_debug.o
>>> referenced by zend_accelerator_debug.c:58 (ext/opcache/zend_accelerator_debug.c:58)
>>> ext/opcache/.libs/zend_accelerator_debug.o:(zend_accel_error_va_args)
make: stopped in .../php-src
But I expected this output instead:
# builds successfullly
On Debian 32-bit with Clang this happens:
ext/standard/base64.o: unsupported non-PIC call to IFUNC `php_base64_encode_ex'
/usr/bin/ld: failed to set dynamic section sizes: bad value
/usr/bin/ld: /usr/bin/ld: ext/standard/base64.o: unsupported non-PIC call to IFUNC `ext/standard/base64.ophp_base64_encode_ex: unsupported non-PIC call to IFUNC `'php_base64_encode_ex
When using GCC it works ok. Issue is that there is a check to disable PIC mode for shared extensions on 32-bit Linux and FreeBSD: https://github.com/php/php-src/blob/bbbe56eecc6ff6b3971ba4f924d51c9aa11955c5/configure.ac#L242-L257
(Probably solution would be to skip the non-PIC mode for Clang on 32-bit)
PHP Version
PHP 8.2, 8.3 and 8.4-dev
Operating System
32-bit Linux and FreeBSD
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 Clang 在 32 位 Linux 或 FreeBSD 上通过 ./buildconf、./configure 和 make 重现该失败。首先检查 configure.ac 的第 242-257 行附近,以及受影响的 ext/opcache 和 ext/standard 构建输出。当 PHP 源代码能够在报告的 32 位系统上使用 Clang 成功构建,且没有 relocation 或 non-PIC 错误时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c
- 领域
- build-system, operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100