php / php/php-src

Build fails on 32-bit Linux and FreeBSD with Clang

オープン
#14,467 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Category: Build System Status: Verified
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Clangを使用して、32ビットのLinuxまたはFreeBSD上で ./buildconf、./configure、make による失敗を再現してください。まず、configure.ac の242-257行付近と、影響を受けている ext/opcache および ext/standard のビルド出力を調査してください。報告された32ビットシステム上で、relocation または non-PIC エラーなしに PHP ソースが Clang で正常にビルドできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c
領域
build-system, operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。