Skip to content

【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 6#79306

Open
gouzil wants to merge 1 commit into
PaddlePaddle:developfrom
gouzil:codex/fix-windows-inference-rpath
Open

【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 6#79306
gouzil wants to merge 1 commit into
PaddlePaddle:developfrom
gouzil:codex/fix-windows-inference-rpath

Conversation

@gouzil

@gouzil gouzil commented Jun 11, 2026

Copy link
Copy Markdown
Member

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.txt
  • prek --files paddle/fluid/inference/CMakeLists.txt

是否引起精度变化

Copilot AI review requested due to automatic review settings June 11, 2026 10:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-script composition on supported platforms).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Paddle-CI-Agent | pr_review | 2026-06-11 18:53:00

📋 Review 摘要

PR 概述:在 Windows 下跳过 shared inference library 的 GNU rpath 链接参数,保留非 Windows 平台原有链接逻辑。
变更范围paddle/fluid/inference/CMakeLists.txtpaddle_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 上下文审查,未发现需要行间评论的问题。

@gouzil gouzil changed the title [Inference] Avoid rpath link flag on Windows 【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 5 Jun 11, 2026
@gouzil gouzil requested a review from swgu98 June 11, 2026 16:27
@gouzil gouzil changed the title 【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 5 【Hackathon 10th Spring No.52】[Inference] Avoid rpath link flag on Windows - part 6 Jun 11, 2026
@gouzil gouzil closed this Jun 11, 2026
@gouzil gouzil reopened this Jun 11, 2026
@paddle-bot paddle-bot Bot added the contributor External developers label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants