{
  "id": "cmake/check-cxx-source-compiles-arch-specific",
  "signature": "CMake Error: check_cxx_source_compiles failed with: 'error: #error Architecture not supported'",
  "signature_zh": "CMake 错误：check_cxx_source_compiles 失败，错误信息为：'error: #error Architecture not supported'",
  "regex": "check_cxx_source_compiles failed with:.*#error Architecture not supported",
  "domain": "cmake",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "CMake's TryCompile check uses a source snippet that contains an architecture guard (#ifdef __arm__ etc.) which fails on the current target CPU, causing the feature detection to return false and abort.",
  "root_cause_type": "generic",
  "root_cause_zh": "CMake 的 TryCompile 检查使用的源代码片段包含架构守卫（#ifdef __arm__ 等），在当前目标 CPU 上失败，导致特性检测返回 false 并中止。",
  "versions": [
    {
      "version": "CMake 3.27",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.28",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "GCC 12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Clang 16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set CMAKE_CXX_FLAGS to -march=native or -march=armv8-a",
      "why_fails": "The error is in the test source itself, not in the flags. Changing march doesn't remove the #error directive.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Delete CMakeCache.txt and reconfigure",
      "why_fails": "The cache is not the problem; the test source is hardcoded in the Find module or CMake module.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Override the test by setting the variable that check_cxx_source_compiles would define, e.g. set(HAVE_ARCH_SUPPORT 1) in CMakeCache.txt or via -DHAVE_ARCH_SUPPORT=ON on command line.",
      "success_rate": 0.7,
      "how": "Override the test by setting the variable that check_cxx_source_compiles would define, e.g. set(HAVE_ARCH_SUPPORT 1) in CMakeCache.txt or via -DHAVE_ARCH_SUPPORT=ON on command line.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Patch the CMake module file (e.g., /usr/share/cmake-3.28/Modules/FindSomething.cmake) to remove the architecture check or add your arch to the #ifndef list.",
      "success_rate": 0.85,
      "how": "Patch the CMake module file (e.g., /usr/share/cmake-3.28/Modules/FindSomething.cmake) to remove the architecture check or add your arch to the #ifndef list.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "通过设置 check_cxx_source_compiles 会定义的变量来覆盖测试，例如在 CMakeCache.txt 中设置 set(HAVE_ARCH_SUPPORT 1) 或通过命令行 -DHAVE_ARCH_SUPPORT=ON。",
    "修补 CMake 模块文件（例如 /usr/share/cmake-3.28/Modules/FindSomething.cmake），移除架构检查或将你的架构添加到 #ifndef 列表中。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.78,
  "resolvable": "partial",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}