Skip to content

Don't try to set RPATH on Windows #116063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged

Conversation

MichalStrehovsky
Copy link
Member

Should avoid

LINK : warning LNK4044: unrecognized option '/Wl,-rpath,'$ORIGIN/..''; ignored [d:\git\runtime2\src\tests\nativeaot\SmokeTests\UnitTests\UnitTests.csproj]

Should avoid

```
LINK : warning LNK4044: unrecognized option '/Wl,-rpath,'$ORIGIN/..''; ignored [d:\git\runtime2\src\tests\nativeaot\Smo
keTests\UnitTests\UnitTests.csproj]
```
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 28, 2025
@MichalStrehovsky MichalStrehovsky added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 28, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Avoid setting RPATH on Windows to suppress LNK4044 warnings during native AOT test builds.

  • Tighten conditions so macOS and Apple mobile targets get their specific rpath flag.
  • Apply $ORIGIN rpath only when TargetOS is neither Windows nor Apple platforms.
  • Rename the Windows identifier literal from 'win' to 'windows'.
Comments suppressed due to low confidence (2)

src/tests/Directory.Build.targets:578

  • Consider adding a CI test or build verification to assert that no -rpath flags are emitted when TargetOS is Windows to prevent regression of the LNK4044 warning.
<LinkerArg Include="-Wl,-rpath,'$ORIGIN/..'" Condition="'$(SetIlcRPath)' != 'false' and '$(TargetOS)' != 'windows' and '$(TargetOS)' != 'osx' and '$(TargetsAppleMobile)' != 'true'" />

src/tests/Directory.Build.targets:578

  • The condition uses 'windows' but the actual TargetOS value may be 'Windows' (capitalized) or different; this mismatch could still apply the rpath flag on Windows. Ensure the literal and casing match the real TargetOS values.
<LinkerArg Include="-Wl,-rpath,'$ORIGIN/..'" Condition="'$(SetIlcRPath)' != 'false' and '$(TargetOS)' != 'windows' and '$(TargetOS)' != 'osx' and '$(TargetsAppleMobile)' != 'true'" />

@MichalStrehovsky MichalStrehovsky merged commit 6005119 into main May 28, 2025
73 of 76 checks passed
@MichalStrehovsky MichalStrehovsky deleted the MichalStrehovsky-patch-1 branch May 28, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants