devinamatthews/tblis

sysctlbyname not found

mdav2 opened this issue · 2 comments

mdav2 commented

When trying to compile on Alpine Linux, I receive the following error:

src/util/thread.cxx: In constructor ‘{anonymous}::thread_configuration::thread_configuration()’:
src/util/thread.cxx:72:13: error: ‘sysctlbyname’ was not declared in this scope
             sysctlbyname("hw.physicalcpu", &num_threads, &len, NULL, 0);

Looking at src/util/thread.cxx I see that immediately prior to this call, a precompiler statement checks for TBLIS_HAS_SYSCTL, and uses that to determine whether to call sysctlbyname. Is this a bug? I was able to bypass it by disabling that branch.

This code is only suppose the be active on Darwin/BSD. I think it could be worked around by changing the TBLIS_HAS_SYSCTL on line 69 to TBLIS_HAS_SYSCTLBYNAME. Care to submit a patch?

mdav2 commented

Sure! That's exactly what I did to bypass the branch.