简体   繁体   English

Tesseract cross-compile aarch64 (arm64-v8a) error this header is for x86 only

[英]Tesseract cross-compile aarch64 (arm64-v8a) error this header is for x86 only

I'm trying to cross compile Tesseract for arm64-v8a architecture settings are as follow.我正在尝试为 arm64-v8a 架构设置交叉编译 Tesseract,如下所示。

set(ANDROID_TOOLCHAIN_NAME aarch64-linux-android)
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)

Compiler checks working as follow.编译器检查工作如下。

Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Failed
Performing Test HAVE_AVX
Performing Test HAVE_AVX - Success
Performing Test HAVE_AVX2
Performing Test HAVE_AVX2 - Success
Performing Test HAVE_FMA
Performing Test HAVE_FMA - Success
Performing Test HAVE_SSE4_1
Performing Test HAVE_SSE4_1 - Success
Performing Test HAVE_NEON
Performing Test HAVE_NEON - Success

and tesseract simddetect.cpp have following macros.和 tesseract simddetect.cpp 具有以下宏。

#if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_FMA) || defined(HAVE_SSE4_1)
#define HAS_CPUID
#endif

#if defined(HAS_CPUID)
#if defined(__GNUC__)
# include <cpuid.h>
#elif defined(_WIN32)
# include <intrin.h>
#endif
#endif

#if defined(HAVE_NEON) && !defined(__aarch64__)
#ifdef ANDROID
#include <cpu-features.h>
#else
/* Assume linux */
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
#endif 

SIMDDetect SIMDDetect::detector;

#if defined(__aarch64__)
// ARMv8 always has NEON.
bool SIMDDetect::neon_available_ = true;
#elif defined(HAVE_NEON)
// If true, then Neon has been detected.
bool SIMDDetect::neon_available_;
#else
// If true, then AVX has been detected.
bool SIMDDetect::avx_available_;
bool SIMDDetect::avx2_available_;
bool SIMDDetect::avx512F_available_;
bool SIMDDetect::avx512BW_available_;
// If true, then FMA has been detected.
bool SIMDDetect::fma_available_;
// If true, then SSe4.1 has been detected.
bool SIMDDetect::sse_available_;
#endif

compiler error编译器错误

cpuid.h:11:2#error this header is for x86 only

Why tesseract include cpuid.h if it is only x86 file?如果只是 x86 文件,为什么 tesseract 包含 cpuid.h? what could be the fix for this error?什么可以解决这个错误?

Based on error message problem is seems to be in your toolchain:根据错误消息问题似乎在您的工具链中:

  1. You try to build 64bit arm version ( arm64-v8a , aarch64-linux-android )您尝试构建 64 位 arm 版本( arm64-v8aaarch64-linux-android
  2. But your compiler provide only x86 only version of cpuid.h (#error this header is for x86 only)但是您的编译器仅提供 x86 的 cpuid.h 版本(#error 此 header 仅适用于 x86)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM