package/erlang: disable for uclibc, fix glibc-build

Commit 2cfa86a54882(package/erlang: bump version to 26.0.2) added a
patch to restore building on uClibc.

However, that patch is not upstream, and has been rejected:

    https://github.com/erlang/otp/pull/7500

    Please open a PR to https://github.com/asmjit/asmjit instead and we
    will get the fix next time we sync with upstream. We do not want
    theirs and our implementation to diverge.

Furthermore, it happens to work on uClibc, because uClibc does not
expose sys/auxv.h, but it fails to work on glibc, because the define is
not propagated to "sub-trees", and thus is never defined where it is
checked for, even when sys/auxv.h is available. This causes build
failures such as:

    asmjit/core/cpuinfo.cpp: In function ‘void asmjit::_abi_1_10::detectHWCaps(CpuInfo&, long unsigned int, const LinuxHWCapMapping*, size_t)’:
    asmjit/core/cpuinfo.cpp:840:24: error: ‘getauxval’ was not declared in this scope
      840 |   unsigned long mask = getauxval(type);
          |                        ^~~~~~~~~
    asmjit/core/cpuinfo.cpp: In function ‘void asmjit::_abi_1_10::detectARMCpu(CpuInfo&)’:
    asmjit/core/cpuinfo.cpp:972:21: error: ‘AT_HWCAP’ was not declared in this scope
      972 |   detectHWCaps(cpu, AT_HWCAP, hwCapMapping, ASMJIT_ARRAY_SIZE(hwCapMapping));
          |                     ^~~~~~~~
    asmjit/core/cpuinfo.cpp:973:21: error: ‘AT_HWCAP2’ was not declared in this scope
      973 |   detectHWCaps(cpu, AT_HWCAP2, hwCapMapping2, ASMJIT_ARRAY_SIZE(hwCapMapping2));
          |                     ^~~~~~~~~

Yet, sys/auxv.h was detected at configure time:

    checking for sys/auxv.h... yes

This defconfig is enough to reproduce the error:

    BR2_aarch64=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
    BR2_PACKAGE_ERLANG=y

Since upstream refused the patch, and there is no fix that was submitted
to the actual upstream (asmjit), drop the rejectred patch, and disable
for uClibc: the patch is incorrect, and we can't fix a build issue on
uClibc by introducing another on glibc.

Fixes:
    http://autobuild.buildroot.org/results/fc1/fc19bad2263bdfacea594217d5ddfde0e27895b1/
    http://autobuild.buildroot.org/results/114/11416d81d5b27fc0627b335a971154c088d5754a/

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Bernd Kuhls <bernd@kuhls.net>
Cc: Maxim Kochetkov <fido_max@inbox.ru>

Changes v1 -> v2:
  - update comment when unavailable

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Yann E. MORIN 2023-11-27 10:40:44 +01:00 committed by Peter Korsgaard
parent 127986f3ed
commit fb72418160
2 changed files with 3 additions and 46 deletions

View File

@ -1,44 +0,0 @@
From ede1e17794c2caf091e810bdfa49040c75f513eb Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd@kuhls.net>
Date: Sat, 15 Jul 2023 18:36:48 +0200
Subject: [PATCH] erts: check for sys/auxv.h
Upstream: https://github.com/erlang/otp/pull/7500
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
erts/configure.ac | 2 +-
erts/emulator/asmjit/core/cpuinfo.cpp | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/erts/configure.ac b/erts/configure.ac
index a63d391fb3..9d3e338633 100644
--- a/erts/configure.ac
+++ b/erts/configure.ac
@@ -1655,7 +1655,7 @@ AC_CHECK_HEADERS(fcntl.h limits.h unistd.h syslog.h dlfcn.h ieeefp.h \
sys/socket.h sys/sockio.h sys/socketio.h \
net/errno.h malloc.h arpa/nameser.h libdlpi.h \
pty.h util.h libutil.h utmp.h langinfo.h poll.h sdkddkver.h \
- elf.h)
+ elf.h sys/auxv.h)
AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr], [], [],
[#ifdef __WIN32__
diff --git a/erts/emulator/asmjit/core/cpuinfo.cpp b/erts/emulator/asmjit/core/cpuinfo.cpp
index fb2acfc09b..d8b72697ab 100644
--- a/erts/emulator/asmjit/core/cpuinfo.cpp
+++ b/erts/emulator/asmjit/core/cpuinfo.cpp
@@ -15,8 +15,10 @@
// Required by `getauxval()` on Linux.
#if defined(__linux__)
+#if defined(HAVE_SYS_AUXV_H)
#include <sys/auxv.h>
#endif
+#endif
//! Required to detect CPU and features on Apple platforms.
#if defined(__APPLE__)
--
2.39.2

View File

@ -15,11 +15,11 @@ config BR2_PACKAGE_ERLANG_ARCH_SUPPORTS
# erlang needs host-erlang
depends on BR2_PACKAGE_HOST_ERLANG_ARCH_SUPPORTS
comment "erlang needs a toolchain w/ dynamic library, threads, wchar"
comment "erlang needs a glibc or musl toolchain w/ dynamic library, threads, wchar"
depends on BR2_USE_MMU # fork()
depends on BR2_PACKAGE_ERLANG_ARCH_SUPPORTS
depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS \
|| !BR2_USE_WCHAR
|| !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_UCLIBC
config BR2_PACKAGE_ERLANG
bool "erlang"
@ -27,6 +27,7 @@ config BR2_PACKAGE_ERLANG
depends on BR2_USE_WCHAR
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on !BR2_TOOLCHAIN_USES_UCLIBC
depends on BR2_PACKAGE_ERLANG_ARCH_SUPPORTS
select BR2_PACKAGE_ZLIB
help