Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] Fails on arm64: error: no member named 'linux_id' in 'cpuinfo_processor' #23181

Open
yurivict opened this issue Dec 23, 2024 · 3 comments
Labels
build build issues; typically submitted using template

Comments

@yurivict
Copy link
Contributor

yurivict commented Dec 23, 2024

Describe the issue

Build fails with version 1.18.2.

Urgency

No response

Target platform

FreeBSD 14.1

Build script

cmake && gmake

Error / output

/wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.18.2/onnxruntime/core/platform/posix/env.cc:293:38: error: no member named 'linux_id' in 'cpuinfo_processor'
  293 |           th_aff.push_back(log_proc->linux_id);
      |                            ~~~~~~~~  ^
1 error generated.

log

Visual Studio Version

No response

GCC / Compiler Version

clang-18

@yurivict yurivict added the build build issues; typically submitted using template label Dec 23, 2024
@snnn
Copy link
Member

snnn commented Dec 23, 2024

Yeah, it is Linux only. I think we need to change this line https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/platform/posix/env.cc#L43 to use an explicit allowlist

#if defined(CPUINFO_SUPPORTED) && defined(__linux__) && !defined(__ANDROID__) 
#include <cpuinfo.h>
#define ORT_USE_CPUINFO
#endif

What do you think?

Actually, ANDROID might work. We should try to enable it. @skottmckay , FYI.

@skottmckay
Copy link
Contributor

Why is __linux__ not defined if you're building on FreeBSD?

https://github.com/pytorch/cpuinfo/blob/ca156f7bc9109c552973414a63d310f76ef0cbf8/include/cpuinfo.h#L615-L623

We have less restrictions in the #include of cpuinfo here.

https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/common/cpuid_info.cc#L53-L54

And the github readme from https://github.com/pytorch/cpuinfo says

Cross-platform availability:
Linux, Windows, macOS, Android, iOS and FreeBSD operating systems
x86, x86-64, ARM, and ARM64 architectures

Given that, I would expect this works for at least ANDROID and hopefully macOS/iOS as well.

@yurivict
Copy link
Contributor Author

yurivict commented Dec 24, 2024

Why is linux not defined if you're building on FreeBSD?

FreeBSD has __FreeBSD__ defined, not __linux__.
The problem only exists on arm64, it builds fine on other architectures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants