Skip to contentSkip to conversation

package/php: fix build on i386

PATCH New Bernd Kuhls 1 participant 1 message Nov 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/php: fix build on i386

Fixes build error:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-i686-musl/host/opt/ext-toolchain/bin/../lib/gcc/i686-buildroot-linux-musl/15.3.0/../../../../i686-buildroot-linux-musl/bin/ld:
ext/pcre/.libs/php_pcre.o: warning:
relocation in read-only section `.text'
/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-i686-musl/host/opt/ext-toolchain/bin/../lib/gcc/i686-buildroot-linux-musl/15.3.0/../../../../i686-buildroot-linux-musl/bin/ld:
read-only segment has dynamic relocations

For details see:
https://bugzilla.redhat.com/show_bug.cgi?id=2428281

No autobuilders errors were recorded, nonetheless a backport to LTS branches is advised because other packages needing the same fix showed autobuilder errors for older branches.

The build error can be reproduced using this defconfig:

BR2_i386=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_I686_MUSL_STABLE=y BR2_PACKAGE_PHP=y BR2_PACKAGE_PHP_SAPI_APACHE=y BR2_PACKAGE_APACHE=y

---
 package/php/php.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
package/php/php.mk +9 -1
index 1bb25d0863..3094bc999d 100644
@@ -77,6 +77,7 @@ PHP_CONFIG_SCRIPTS = php-config
 
 PHP_CFLAGS = $(TARGET_CFLAGS)
 PHP_CXXFLAGS = $(TARGET_CXXFLAGS)
+PHP_LDFLAGS = $(TARGET_LDFLAGS)
 
 # We need to force dl "detection"
 ifeq ($(BR2_STATIC_LIBS),)
@@ -93,6 +94,10 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 PHP_CFLAGS += -marm
 endif
 
+ifeq ($(BR2_i386),y)
+PHP_LDFLAGS += -Wl,-z,notext
+endif
+
 PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli)
 PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),--enable-cgi,--disable-cgi)
 PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm)
@@ -361,7 +366,10 @@ endef
 PHP_POST_INSTALL_TARGET_HOOKS += PHP_CERTIFICATES_FIXUP
 endif
 
-PHP_CONF_ENV += CFLAGS="$(PHP_CFLAGS)" CXXFLAGS="$(PHP_CXXFLAGS)"
+PHP_CONF_ENV += \
+	CFLAGS="$(PHP_CFLAGS)" \
+	CXXFLAGS="$(PHP_CXXFLAGS)" \
+	LDFLAGS="$(PHP_LDFLAGS)"
 
 HOST_PHP_CONF_OPTS = \
 	--disable-all \
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot