我正在尝试将一个简单的 C 程序从 64 位 Ubuntu Linux 交叉编译为 aarch64 (arm64)。有人可以帮我解释一下为什么我会收到此错误吗?
它说找不到“cpuid.h”。我试过在64位linux上编译它,它工作得很好。但是使用的时候aarch64-linux-gnu-gcc却报错。
我收到以下错误。
aarch64-linux-gnu-gcc -O1 -fno-stack-protector -march=armv8-a test.c -o test
test.c:4:10: fatal error: cpuid.h: No such file or directory
4 | #include <cpuid.h>
| ^~~~~~~~~
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
内容test.c:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cpuid.h>
// Requires that the user input the CPUID,
// plus the bytes "3" and "Q";
void succeed(char* string) {
printf("Yes, %s is correct!\n", string);
exit(0);
}
void fail(char* string) {
printf("No, …Run Code Online (Sandbox Code Playgroud)