lfreist / hwinfo

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
MIT License
438 stars 76 forks source link

Why can't build hwinfo library on MACOS? #47

Closed fiantyogalihp closed 1 year ago

fiantyogalihp commented 1 year ago

i got error when build hwinfo library after clone it on MAC:

`/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:25:10: error: out-of-line definition of 'currentClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU' int CPU::currentClockSpeed_kHz() { ^~~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:31:18: error: out-of-line definition of 'getVendor' does not match any declaration in 'hwinfo::CPU' std::string CPU::getVendor() { ^~~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:47:18: error: out-of-line definition of 'getModelName' does not match any declaration in 'hwinfo::CPU' std::string CPU::getModelName() { ^~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:88:10: error: out-of-line definition of 'getNumPhysicalCores' does not match any declaration in 'hwinfo::CPU' int CPU::getNumPhysicalCores() { ^~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:102:26: error: use of undeclared identifier 'getNumLogicalCores' int numCores = getNumLogicalCores() / static_cast(LVL_CORES & regs_2[1]); ^

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:112:24: error: use of undeclared identifier 'getNumLogicalCores' int numCores = getNumLogicalCores() / static_cast(1 + ((regs_3[0] >> 26) & 0x3f)); ^

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:142:10: error: out-of-line definition of 'getNumLogicalCores' does not match any declaration in 'hwinfo::CPU' int CPU::getNumLogicalCores() { ^~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:179:10: error: out-of-line definition of 'getMaxClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU' int CPU::getMaxClockSpeed_kHz() { ^~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:189:10: error: out-of-line definition of 'getRegularClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU' int CPU::getRegularClockSpeed_kHz() { ^~~~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:198:10: error: out-of-line definition of 'getCacheSize_Bytes' does not match any declaration in 'hwinfo::CPU' int CPU::getCacheSize_Bytes() { return -1; } ^~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:208:9: error: out-of-line definition of 'Socket' does not match any declaration in 'hwinfo::Socket' Socket::Socket(uint8_t id) : _id(id) { ^~~~

/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:216:9: error: out-of-line definition of 'Socket' does not match any declaration in 'hwinfo::Socket' Socket::Socket(uint8_t id, const class CPU& cpu) : _id(id) { _cpu = cpu; }`

lfreist commented 1 year ago

Hi,

I have made some major changes to the API of hwinfo which are not yet applied for the MacOS stuff. If you checkout this commit: https://github.com/lfreist/hwinfo/tree/51e0f9b4ae3c8ac5b82d923dcc091f980e94c962 you should be able to build hwinfo on mac and use it with an older API version.

I am currently working on the MacOS parts but it will take some time, since I only have sporadic access to a Mac.

Sorry for the inconvenience!