php / php/php-src

Build fails on 32-bit Linux and FreeBSD with Clang

Offen
#14,467 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bug Category: Build System Status: Verified
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Fehler mit ./buildconf, ./configure und make auf 32-Bit-Linux oder FreeBSD unter Verwendung von Clang. Beginne mit der Untersuchung von configure.ac im Bereich der Zeilen 242–257 sowie der betroffenen Build-Ausgabe von ext/opcache und ext/standard. Als erledigt gilt die Aufgabe, wenn der PHP-Quellcode mit Clang auf den gemeldeten 32-Bit-Systemen erfolgreich erstellt wird, ohne dass Relocation- oder Non-PIC-Fehler auftreten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c
Bereich
build-system, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.