【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 6#79306
【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 6#79306gouzil wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Windows inference shared library linking by avoiding a GNU ld–style rpath linker flag (-Wl,-rpath,'$ORIGIN') that MSVC link.exe does not understand, preventing LNK4044 during paddle_inference_shared / paddle_inference.dll link.
Changes:
- Guard
-Wl,-rpath,'$ORIGIN'so it is only applied on non-Windows platforms. - Keep existing non-Windows link-flag behavior (including later
--version-scriptcomposition on supported platforms).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-06-11 18:53:00
📋 Review 摘要
PR 概述:在 Windows 下跳过 shared inference library 的 GNU rpath 链接参数,保留非 Windows 平台原有链接逻辑。
变更范围:paddle/fluid/inference/CMakeLists.txt 中 paddle_inference_shared 的链接参数设置。
影响面 Tag:[Inference] [Environment Adaptation]
问题
未发现阻塞性问题。PR 规范问题在下面章节报,不要在这里重复
📝 PR 规范检查
符合规范。标题使用 [Inference] Tag,描述包含必填 section,精度变化填写为 否。
总体评价
变更将 GNU rpath 链接参数的设置限制在非 Windows,避免 MSVC link.exe 接收 GNU ld 风格参数;Linux/macOS 的现有 rpath 逻辑和 Linux version-script 分支保持原行为。本轮按 diff 与相关 CMake 上下文审查,未发现需要行间评论的问题。
PR Category
Inference
PR Types
Bug fixes
Description
Windows MSVC
link.exe不支持 GNU ld 风格的-Wl,-rpath,'$ORIGIN'参数。此前paddle_inference_shared会无条件设置该 rpath link flag,导致 Windows 构建paddle_inference.dll时也会把这个无效参数传给 MSVC linker,并产生LNK4044警告。本 PR 将该 rpath link flag 限定为仅在非 Windows 平台使用,Windows 下不再向
link.exe传递该参数。改动范围仅限 inference shared library 的链接参数生成,不涉及算子、kernel 或运行时计算逻辑。验证:
git diff --check -- paddle/fluid/inference/CMakeLists.txtprek --files paddle/fluid/inference/CMakeLists.txt是否引起精度变化
否