-
Notifications
You must be signed in to change notification settings - Fork 5k
Remove always searching executable directory for native libraries in single-file applications #115236
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
Remove always searching executable directory for native libraries in single-file applications #115236
Conversation
0288785
to
c9d23b7
Compare
c9d23b7
to
7e8a56c
Compare
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
You should validate the use of |
<LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" Condition="'$(IlcRPath)' != '' and '$(StaticExecutable)' != 'true' and !$([MSBuild]::IsOSPlatform('Windows'))" /> | ||
<LinkerArg Include="-Wl,-rpath,"$(IlcRPath)"" Condition="'$(IlcRPath)' != '' and '$(StaticExecutable)' != 'true' and $([MSBuild]::IsOSPlatform('Windows'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just delete this line; it's unlikely users will remember the correct -rpath value per platform (e.g., macOS vs. Linux). It's more simpler for them to specify <LinkerArg Include="-Wl,-rpath,...">
directly in their own projects (if they really need it for some reason), as they already do for other platform-specific linker options we don't cover.
<LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" Condition="'$(IlcRPath)' != '' and '$(StaticExecutable)' != 'true' and !$([MSBuild]::IsOSPlatform('Windows'))" /> | |
<LinkerArg Include="-Wl,-rpath,"$(IlcRPath)"" Condition="'$(IlcRPath)' != '' and '$(StaticExecutable)' != 'true' and $([MSBuild]::IsOSPlatform('Windows'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we can just delete IlcRpath. It was never documented and I can't see any uses of this property outside the dotnet/runtime repo. The only remaining use is in our test tree, but we can replace that one with a direct use of LinkerArg ItemGroup.
Should just template apps with NativeAOT enabled for macOS or Mac Catalyst be enough to see them fail (presumably) without rpath set? I don't have a Mac to try on right now, but will try those when I do. |
Yes, anything that calls into System.Native should be enough, so probably even |
It might not be necessary to test this - I don't see how this could affect things. Xamarin targets don't seem to use IlcRpath or the LinkerArg ItemGroup and I don't see anything else affected by this. |
It doesn't seem to use it (anymore?). There were some issues referencing it in the past. Most likely it's going to be fine but I think a simple smoke test would be worth it since the macOS/iOS bundles are easy to break with changes like this one. |
I validated that the template macOS and Mac Catalyst apps with |
…single-file applications (#115236) Avoid always searching the application directory for native libraries in single-file applications. The assembly directory, which is searched by default and when `DllImportSearchPath.AssemblyDirectory` is specified, is treated as the application directory. - Single-file - Stop adding the app directory and extraction directory to `NATIVE_DLL_SEARCH_DIRECTORIES` (paths which are always searched) - When looking for native libraries, treat assembly directory for bundled assemblies as the bundle directory - If the bundle has extracted assets, also look in the extraction path (if not found in the bundle directory) - NativeAOT - Update p/invoke default to search assembly directory - Don't set RPATH by default - Remove `IlcRPath` property
Avoid always searching the application directory for native libraries in single-file applications. The assembly directory, which is searched by default and when
DllImportSearchPath.AssemblyDirectory
is specified, is treated as the application directory.NATIVE_DLL_SEARCH_DIRECTORIES
(paths which are always searched)IlcRPath
propertyResolves #114717
cc @dotnet/appmodel @dotnet/interop-contrib @MichalStrehovsky @jkotas