From 667e5e4f890f24a638ca04f638967f1083468bb0 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 5 May 2022 09:59:29 +0200 Subject: [PATCH] Merge pull request #21943 from vrabaud:3.4_proc * Fix compilation with non glibc. _SC_NPROCESSORS_ONLN is non standard as defined on https://man7.org/linux/man-pages/man3/sysconf.3.html It seems to only be on glibc, cf https://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html * Fix to defined(_SC_NPROCESSORS_ONLN) --- modules/core/src/parallel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index 95df5454c2..a4a7baf0f6 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -942,7 +942,7 @@ int getNumberOfCPUs_() #endif -#if !defined(_WIN32) && !defined(__APPLE__) +#if !defined(_WIN32) && !defined(__APPLE__) && defined(_SC_NPROCESSORS_ONLN) static unsigned cpu_count_sysconf = (unsigned)sysconf( _SC_NPROCESSORS_ONLN ); ncpus = minNonZero(ncpus, cpu_count_sysconf);