Merged
统一CXX11_ABI计算逻辑,修复三方库构建配置问题 #289
zhaoyingdongAdd on Aug 19
统一CXX11_ABI计算逻辑,修复三方库构建配置问题 #289
Merged
zhaoyingdongAdd on Aug 19
Merged fromDeleted :masterintocann/cmakemaster
zhaoyingdongCollaborators
Aug 19

当前PR是否有AI参与:

[x] 否

[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :

PR功能描述 / 为什么需要这个合入**:

1、统一CXX11_ABI计算逻辑,修复三方库构建配置问题
2、eigen头文件改为SYSTEM包含,避免-w静默自研代码告警

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #

希望检视人员了解:

改动类型 / Change Type

测试信息 / Testing

检查清单 / Checklist

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zhaoyingdong's contribution.)
ZzhaoyingdongCollaborators
Aug 19 Created pull request, commit 881cb1cd
atomgit-bot
atomgit-bot
Aug 19 Comments:

变更摘要

本 PR 主要聚焦 CMake 构建配置的梳理与修复:在 function/prepare.cmake 的 init_cann_project() 宏中新增 CANN_CXX11_ABI 变量的统一计算逻辑(将 USE_CXX11_ABI 的布尔写法归一化为 0/1,并按 PRODUCT_SIDE 是否为 device 提供默认值),随后将 intf_pub/intf_pub_linux.cmake 及 benchmark、boost、grpc、gtest、gtest_shared、mockcpp、protobuf、symengine 等三方库的 _GLIBCXX_USE_CXX11_ABI 编译宏统一改为引用该变量,解决三方库构建配置不一致的问题;同时将 eigen 头文件改为 SYSTEM 包含方式,并统一了各三方库的 PATCH_COMMAND 补丁命令写法。

主要改动

  • 统一 CXX11 ABI 计算逻辑: 在 init_cann_project() 中新增 CANN_CXX11_ABI 计算(0/1 归一化及 device 侧默认值),intf_pub_linux.cmake 由各自计算的 CXX11_ABI_VALUE 改为直接引用 CANN_CXX11_ABI(保留未调用 init_cann_project() 时的兜底默认计算),benchmark、boost、grpc、gtest、gtest_shared、mockcpp、symengine 等文件中的 USE_CXX11_ABI 或硬编码 ABI 值(如 _GLIBCXX_USE_CXX11_ABI=0)也统一替换为 ${CANN_CXX11_ABI}。
  • eigen 头文件改为 SYSTEM 包含: third_party/eigen.cmake 移除 target_compile_options(Eigen INTERFACE -w),改为 target_include_directories(Eigen SYSTEM INTERFACE "${SOURCE_DIR}"),避免用 -w 静默自研代码的告警。
  • 统一补丁命令并收敛 CMP0135 策略: 多个三方库(abseil-cpp、grpc、json、mockcpp、protobuf、rdma-core、re2、symengine、zlib 等)的 PATCH_COMMAND 统一改为 patch --forward --batch --quiet -r - -p1 形式,避免重复打补丁时报错;同时移除各三方库文件中重复的 cmake_policy(SET CMP0135 NEW) 设置(保留在 init_cann_project() 中统一处理)。
  • 修正变量名拼写并统一 ccache 配置: 修复 CARES_INTALL_PATH → CARES_INSTALL_PATH、RE2_INTALL_PATH → RE2_INSTALL_PATH 等拼写错误(grpc 等引用方同步更新);gtest_shared、jpeg、openssl 等由自行 find_program(CCACHE_PROGRAM) 改为引用 init_cann_project() 设置的 CMAKE_C_COMPILER_LAUNCHER/CMAKE_CXX_COMPILER_LAUNCHER(openssl 因非 CMake 构建需前缀拼接)。
  • protobuf 与 zlib 构建配置重构: third_party/protobuf.cmake 将原先 DEV/HOST 两套 PROTOBUF_SHARED/STATIC_CXXFLAGS 合并为基于 CANN_CXX11_ABI 的一套,并提前 include(protobuf_sym_rename.cmake);third_party/zlib.cmake 增加 tar.xz/tar.gz 两种包格式的 URL_HASH 校验及分支选择逻辑。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 19 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 19 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Aug 19 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 19 Comments:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/cmake ✅ 宋常霞, yangbinhua (2/2) ✅ 宋常霞 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

zhaoyingdong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ZzhaoyingdongCollaborators
Aug 19 Pre merge succeeded (commit_id: 4dc5128e30ac64487d8957ec4cb041e1e9105902)
18 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Aug 21 Added label: cann-cla/yes
zhaoyingdongCollaborators
Aug 21 Comments:

/compile

likedislike
ZzhaoyingdongCollaborators
Aug 21 Pre merge succeeded (commit_id: 9f5d259de2bf19a3cb5242fc1d9ceca945667ed9)
CANN-robotCANN-robotCollaborators
Aug 21 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 21 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 21 Added label: ci-pipeline-passed
yangbinhua
yangbinhuaCollaborators
Aug 21 Comments:

/lgtm

likedislike
songchangxiaCollaborators
Aug 21 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 21 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Aug 21 Merged pull request