0003-Fix-build-when-__GLIBC_PREREQ-is-not-defined.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 84eaad62e95b9a80df2138db3fed2a186ef00b62 Mon Sep 17 00:00:00 2001
  2. From: Baruch Siach <baruch@tkos.co.il>
  3. Date: Tue, 17 Apr 2018 18:46:29 +0300
  4. Subject: [PATCH] Fix build when __GLIBC_PREREQ is not defined
  5. Rearrange the code so that __GLIBC_PREREQ is not used when not defined.
  6. This fixes build with musl libc.
  7. [baruch: backport to v0.2.20]
  8. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  9. ---
  10. Upstream status: combines upstream commits 480e69768176 and c4af196a2d
  11. ---
  12. driver/others/init.c | 8 +++++++-
  13. 1 file changed, 7 insertions(+), 1 deletion(-)
  14. diff --git a/driver/others/init.c b/driver/others/init.c
  15. index 4c75d72e4075..adce075f0ac0 100644
  16. --- a/driver/others/init.c
  17. +++ b/driver/others/init.c
  18. @@ -838,7 +838,11 @@ void gotoblas_affinity_init(void) {
  19. nums = sysconf(_SC_NPROCESSORS_CONF);
  20. -#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 3)
  21. +#if !defined(__GLIBC_PREREQ)
  22. + common->num_procs = nums;
  23. +#else
  24. +
  25. +#if !__GLIBC_PREREQ(2, 3)
  26. common->num_procs = nums;
  27. #elif __GLIBC_PREREQ(2, 7)
  28. cpusetp = CPU_ALLOC(nums);
  29. @@ -872,6 +876,8 @@ void gotoblas_affinity_init(void) {
  30. #endif
  31. +#endif
  32. +
  33. if(common -> num_procs > MAX_CPUS) {
  34. fprintf(stderr, "\nOpenBLAS Warning : The number of CPU/Cores(%d) is beyond the limit(%d). Terminated.\n", common->num_procs, MAX_CPUS);
  35. exit(1);
  36. --
  37. 2.17.0