Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 759217 - dev-util/cmake: PROCESSOR_AFFINITY doesn't work due to unbundled libuv
Summary: dev-util/cmake: PROCESSOR_AFFINITY doesn't work due to unbundled libuv
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-09 13:20 UTC by Guilherme Amadio
Modified: 2022-02-24 18:54 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Amadio gentoo-dev 2020-12-09 13:20:56 UTC
The CMake test property PROCESSOR_AFFINITY 
 (https://cmake.org/cmake/help/v3.18/prop_test/PROCESSOR_AFFINITY.html) doesn't work in Gentoo because of being ifdef'd out when not using their bundled version of libuv: https://github.com/Kitware/CMake/blob/master/Source/CTest/cmProcess.cxx#L109-L124

A patch is needed to avoid this problem in Gentoo.
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2020-12-09 14:23:23 UTC
Can you provide a patch?
Comment 2 Guilherme Amadio gentoo-dev 2020-12-09 14:47:18 UTC
I tried the obvious

--- a/Source/CTest/cmProcess.cxx	2020-12-09 15:31:06.329504850 +0100
+++ b/Source/CTest/cmProcess.cxx	2020-12-09 15:31:21.779474399 +0100
@@ -106,7 +106,6 @@
   options.stdio_count = 3; // in, out and err
   options.exit_cb = &cmProcess::OnExitCB;
   options.stdio = stdio;
-#if !defined(CMAKE_USE_SYSTEM_LIBUV)
   std::vector<char> cpumask;
   if (affinity && !affinity->empty()) {
     cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
@@ -119,9 +118,6 @@
     options.cpumask = nullptr;
     options.cpumask_size = 0;
   }
-#else
-  static_cast<void>(affinity);
-#endif
 
   status =
     uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);
--- EOF ---

but unfortunately it failed with the error below.

/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx: In member function ‘bool cmProcess::StartProcess(uv_loop_t&, std::vector<long unsigned int>*)’:
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:111:40: error: ‘uv_cpumask_size’ was not declared in this scope
     cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
                                        ^~~~~~~~~~~~~~~
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:111:40: note: suggested alternative: ‘uv_req_size’
     cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
                                        ^~~~~~~~~~~~~~~
                                        uv_req_size
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:115:13: error: ‘uv_process_options_t’ {aka ‘struct uv_process_options_s’} has no member named ‘cpumask’
     options.cpumask = cpumask.data();
             ^~~~~~~
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:116:13: error: ‘uv_process_options_t’ {aka ‘struct uv_process_options_s’} has no member named ‘cpumask_size’
     options.cpumask_size = cpumask.size();
             ^~~~~~~~~~~~
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:118:13: error: ‘uv_process_options_t’ {aka ‘struct uv_process_options_s’} has no member named ‘cpumask’
     options.cpumask = nullptr;
             ^~~~~~~
/tmp/portage/dev-util/cmake-3.19.1/work/cmake-3.19.1/Source/CTest/cmProcess.cxx:119:13: error: ‘uv_process_options_t’ {aka ‘struct uv_process_options_s’} has no member named ‘cpumask_size’
     options.cpumask_size = 0;
             ^~~~~~~~~~~~
make[2]: *** [Source/CMakeFiles/CTestLib.dir/build.make:95: Source/CMakeFiles/CTestLib.dir/CTest/cmProcess.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Maybe a full patch is not that hard, but I don't have the time to fix this now. I filed the bug so I wouldn't forget about it again after running into the problem myself. If I manage to find a solution, I will post it here or just create a pull request with the fix later.