[Buildroot] [PATCH] package/Erlang: disable for uclibc, fix glibc-build

yann.morin at orange.com yann.morin at orange.com
Mon Nov 27 09:27:02 UTC 2023


From: "Yann E. MORIN" <yann.morin at orange.com>

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 at orange.com>
Cc: Bernd Kuhls <bernd at kuhls.net>
Cc: Maxim Kochetkov <fido_max at inbox.ru>
---
 .../0001-erts-check-for-sys-auxv.h.patch      | 44 -------------------
 package/erlang/Config.in                      |  1 +
 2 files changed, 1 insertion(+), 44 deletions(-)
 delete mode 100644 package/erlang/0001-erts-check-for-sys-auxv.h.patch

diff --git a/package/erlang/0001-erts-check-for-sys-auxv.h.patch b/package/erlang/0001-erts-check-for-sys-auxv.h.patch
deleted file mode 100644
index af4b66d05d..0000000000
--- a/package/erlang/0001-erts-check-for-sys-auxv.h.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From ede1e17794c2caf091e810bdfa49040c75f513eb Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd at 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 at 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
-
diff --git a/package/erlang/Config.in b/package/erlang/Config.in
index d3fe0dbec1..490d903027 100644
--- a/package/erlang/Config.in
+++ b/package/erlang/Config.in
@@ -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
-- 
2.34.1

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


More information about the buildroot mailing list