Skip to content

Commit

Permalink
package/erlang: disable for uclibc, fix glibc-build
Browse files Browse the repository at this point in the history
Commit 2cfa86a(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:

    erlang/otp#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>
(cherry picked from commit fb72418)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  • Loading branch information
ymorin-orange authored and jacmet committed Dec 1, 2023
1 parent 7867302 commit a17063e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 46 deletions.
44 changes: 0 additions & 44 deletions package/erlang/0001-erts-check-for-sys-auxv.h.patch

This file was deleted.

5 changes: 3 additions & 2 deletions package/erlang/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ 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"
depends on BR2_USE_MMU # fork()
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
Expand Down

0 comments on commit a17063e

Please sign in to comment.