Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 58d0a6a

Browse files
committed
attempting to address error : error: 'sysctlbyname' was not declared in this scope; did you mean 'SYS_sysctlbyname'?
ld: library not found for -lrt collect2: error: ld returned 1 exit status [2/164] Building CXX object models/mpt/CMakeFiles/mpt.dir/__/model_utils/util.cpp.o FAILED: models/mpt/CMakeFiles/mpt.dir/__/model_utils/util.cpp.o /usr/local/opt/gcc/bin/g++-13 -DNE_GELU_USE_VEC -DNE_SIMD_VEC_DOT_F16 -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/core/. -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/library/jblas -O3 -DNDEBUG -std=c++17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -fPIC -mf16c -mfma -mavx -mavx2 -fopenmp -MD -MT models/mpt/CMakeFiles/mpt.dir/__/model_utils/util.cpp.o -MF models/mpt/CMakeFiles/mpt.dir/__/model_utils/util.cpp.o.d -o models/mpt/CMakeFiles/mpt.dir/__/model_utils/util.cpp.o -c /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp: In function 'int32_t get_num_physical_cores()': /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp:36:16: error: 'sysctlbyname' was not declared in this scope; did you mean 'SYS_sysctlbyname'? 36 | int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0); | ^~~~~~~~~~~~ | SYS_sysctlbyname [3/164] Building CXX object models/llama/CMakeFiles/llama.dir/__/model_utils/util.cpp.o FAILED: models/llama/CMakeFiles/llama.dir/__/model_utils/util.cpp.o /usr/local/opt/gcc/bin/g++-13 -DNE_GELU_USE_VEC -DNE_SIMD_VEC_DOT_F16 -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/core/. -I/Users/nezda/code/itrex/intel_extension_for_transformers/llm/library/jblas -O3 -DNDEBUG -std=c++17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -fPIC -mf16c -mfma -mavx -mavx2 -fopenmp -MD -MT models/llama/CMakeFiles/llama.dir/__/model_utils/util.cpp.o -MF models/llama/CMakeFiles/llama.dir/__/model_utils/util.cpp.o.d -o models/llama/CMakeFiles/llama.dir/__/model_utils/util.cpp.o -c /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp: In function 'int32_t get_num_physical_cores()': /Users/nezda/code/itrex/intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp:36:16: error: 'sysctlbyname' was not declared in this scope; did you mean 'SYS_sysctlbyname'? 36 | int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0); | ^~~~~~~~~~~~ | SYS_sysctlbyname Signed-off-by: Luke Nezda <[email protected]>
1 parent 971ed32 commit 58d0a6a

File tree

1 file changed

+2
-2
lines changed
  • intel_extension_for_transformers/llm/runtime/graph/models/model_utils

1 file changed

+2
-2
lines changed

intel_extension_for_transformers/llm/runtime/graph/models/model_utils/util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ int32_t get_num_physical_cores() {
3333
#elif defined(__APPLE__) && defined(__MACH__)
3434
int32_t num_physical_cores;
3535
size_t len = sizeof(num_physical_cores);
36-
int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0);
36+
int result = syscall(SYS_sysctlbyname, "hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0);
3737
if (result == 0) {
3838
return num_physical_cores;
3939
}
40-
result = sysctlbyname("hw.physicalcpu", &num_physical_cores, &len, NULL, 0);
40+
result = syscall(SYS_sysctlbyname, "hw.physicalcpu", &num_physical_cores, &len, NULL, 0);
4141
if (result == 0) {
4242
return num_physical_cores;
4343
}

0 commit comments

Comments
 (0)