0002-fix-build-with-uclibc-ng.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From b9ad9bbfed92199a1a58504306d026cd2597539e Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 30 Mar 2022 21:56:20 +0200
  4. Subject: [PATCH] Fix build with uclibc-ng (#1145)
  5. uclibc-ng doesn't provide getauxval which results in the following build
  6. failure on arm or ppc with any user of abseil-cpp such as grpc:
  7. /home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/10.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libabsl_random_internal_randen_hwaes.so.2111.0.0: undefined reference to `getauxval'
  8. To fix this build failure, check that __UCLIBC__ is not defined before
  9. using getauxval (as Babel is not able to check function availability)
  10. Fixes:
  11. - http://autobuild.buildroot.org/results/775f3ca3dedebff29e212b29dfa896b7613b7a02
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. [Retrieved from:
  14. https://github.com/abseil/abseil-cpp/commit/b9ad9bbfed92199a1a58504306d026cd2597539e]
  15. ---
  16. absl/debugging/internal/vdso_support.cc | 2 +-
  17. absl/random/internal/randen_detect.cc | 7 ++++++-
  18. 2 files changed, 7 insertions(+), 2 deletions(-)
  19. diff --git a/absl/debugging/internal/vdso_support.cc b/absl/debugging/internal/vdso_support.cc
  20. index c655cf452..e63ac4a3b 100644
  21. --- a/absl/debugging/internal/vdso_support.cc
  22. +++ b/absl/debugging/internal/vdso_support.cc
  23. @@ -33,7 +33,7 @@
  24. #endif
  25. #include <unistd.h>
  26. -#if defined(__GLIBC__) && \
  27. +#if !defined(__UCLIBC__) && defined(__GLIBC__) && \
  28. (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
  29. #define ABSL_HAVE_GETAUXVAL
  30. #endif
  31. diff --git a/absl/random/internal/randen_detect.cc b/absl/random/internal/randen_detect.cc
  32. index 9bb58fc68..6dababa35 100644
  33. --- a/absl/random/internal/randen_detect.cc
  34. +++ b/absl/random/internal/randen_detect.cc
  35. @@ -24,6 +24,11 @@
  36. #include "absl/random/internal/platform.h"
  37. +#if !defined(__UCLIBC__) && defined(__GLIBC__) && \
  38. + (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
  39. +#define ABSL_HAVE_GETAUXVAL
  40. +#endif
  41. +
  42. #if defined(ABSL_ARCH_X86_64)
  43. #define ABSL_INTERNAL_USE_X86_CPUID
  44. #elif defined(ABSL_ARCH_PPC) || defined(ABSL_ARCH_ARM) || \
  45. @@ -31,7 +36,7 @@
  46. #if defined(__ANDROID__)
  47. #define ABSL_INTERNAL_USE_ANDROID_GETAUXVAL
  48. #define ABSL_INTERNAL_USE_GETAUXVAL
  49. -#elif defined(__linux__)
  50. +#elif defined(__linux__) && defined(ABSL_HAVE_GETAUXVAL)
  51. #define ABSL_INTERNAL_USE_LINUX_GETAUXVAL
  52. #define ABSL_INTERNAL_USE_GETAUXVAL
  53. #endif