diff mbox series

[1/1] package/php: Fix build on arm

Message ID 20240825083041.1020638-1-bernd@kuhls.net
State Changes Requested
Headers show
Series [1/1] package/php: Fix build on arm | expand

Commit Message

Bernd Kuhls Aug. 25, 2024, 8:30 a.m. UTC
Fixes:
http://autobuild.buildroot.org/results/5e8ef91d84018ccdf85f2156292feb3460bfe698/

Without this patch configure wrongfully detects aarch64 support:

    checking for aarch64 CRC32 API... yes

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 package/php/php.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni Aug. 25, 2024, 9:55 a.m. UTC | #1
Hello Bernd,

On Sun, 25 Aug 2024 10:30:41 +0200
Bernd Kuhls <bernd@kuhls.net> wrote:

> diff --git a/package/php/php.mk b/package/php/php.mk
> index 0487c03b61..6266ef4e7f 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -64,6 +64,10 @@ PHP_CONF_ENV += ac_cv_c_bigendian_php=yes
>  else
>  PHP_CONF_ENV += ac_cv_c_bigendian_php=no
>  endif
> +# fix configure check for aarch64 CRC32 API
> +ifeq ($(BR2_arm)$(BR2_armeb),y)
> +PHP_CONF_ENV += ac_cv_func___crc32d=no
> +endif

Thanks, but this sort of thing really needs to be fixed in the upstream
configure.ac. Indeed if you have to override cache variables like this,
it means that the configure.ac check is defective.

Could you try instead:

diff --git a/configure.ac b/configure.ac
index 491963daae2..2693ba09f4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -696,7 +696,19 @@ AC_FUNC_ALLOCA
 PHP_TIME_R_TYPE
 
 AC_CACHE_CHECK([for aarch64 CRC32 API], [php_cv_func___crc32d],
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <arm_acle.h>], [__crc32d(0, 0);])],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <arm_acle.h>
+# if defined(__GNUC__)
+#  if!defined(__clang__)
+#   pragma GCC push_options
+#   pragma GCC target ("+nothing+crc")
+#  elif defined(__APPLE__)
+#   pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
+#  else
+#   pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
+#  endif
+# endif
+], [__crc32d(0, 0);])],
 [php_cv_func___crc32d=yes],
 [php_cv_func___crc32d=no])])
 AS_VAR_IF([php_cv_func___crc32d], [yes],

Could you try this, and check it works as expected on ARM 32-bit, and
AArch64 ?

Thanks a lot!

Thomas
diff mbox series

Patch

diff --git a/package/php/php.mk b/package/php/php.mk
index 0487c03b61..6266ef4e7f 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -64,6 +64,10 @@  PHP_CONF_ENV += ac_cv_c_bigendian_php=yes
 else
 PHP_CONF_ENV += ac_cv_c_bigendian_php=no
 endif
+# fix configure check for aarch64 CRC32 API
+ifeq ($(BR2_arm)$(BR2_armeb),y)
+PHP_CONF_ENV += ac_cv_func___crc32d=no
+endif
 PHP_CONFIG_SCRIPTS = php-config
 
 PHP_CFLAGS = $(TARGET_CFLAGS)