cpuinfo icon indicating copy to clipboard operation
cpuinfo copied to clipboard

CPUINFO_SUPPORTED_PLATFORM not set on OSX as CMAKE_SYSTEM_PROCESSOR is not set

Open Timen opened this issue 1 year ago • 1 comments

CMAKE_SYSTEM_PROCESSOR is not set by cmake on apple platforms which causes this warning:

   MESSAGE(WARNING
      "Target processor architecture is not specified. "
      "cpuinfo will compile, but cpuinfo_initialize() will always fail.")

at this line: https://github.com/pytorch/cpuinfo/blob/ef634603954d88d2643d5809011288b890ac126e/CMakeLists.txt#L90

There is actually a check if we are building for iOS that causes this warning to not be emitted and CPUINFO_SUPPORTED_PLATFORM be set to true, however this is not the case on OSX, is this on purpose?

Timen avatar Nov 21 '23 14:11 Timen

Just throwing in my two cents, I'm not entirely sure of the history of the line you've referenced. It looks like they were trying to fix the iOS build but the context of what was broken is lost.

Looking at CMake documentation, CMAKE_SYSTEM_PROCESSOR should be defined if you're not cross-compiling. I'm assuming that means you are and thus need a "a CMAKE_TOOLCHAIN_FILE should set the CMAKE_SYSTEM_PROCESSOR variable to match target architecture". Arguably, it may be the case that iOS needs this as well.

Perhaps you can provide some details of how you're configuring your build here for the maintainers?

prashanthswami avatar Nov 27 '23 19:11 prashanthswami