-
Notifications
You must be signed in to change notification settings - Fork 5k
Use correct CoreLib configuration for shared framework linker trimming #45821
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
Conversation
Tagging subscribers to this area: @safern, @ViktorHofer Issue Details
|
Curious, why does the |
@ViktorHofer - Any thoughts on how we could flow the |
Yes, you could do something similar to what we do for the ProjectReference to CoreLib: runtime/src/libraries/Directory.Build.targets Lines 175 to 179 in dcbf6e9
|
You can pass in the "Properties" and "RemoveProperties" properties to the MSBuild task: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task?view=vs-2019 Pass in |
This is a point in time problem until we start binplacing CoreLib... |
Yup, #40172 (comment). |
Thanks, trying this out now. What problem do we avoid by removing the |
We do this for performance as msbuild caches project evaluations based on the global properties passed in. Doing this here might reduce an unnecessary project evaluation of CoreLib by using the same global properties as for the ProjectReference to CoreLib. |
<MSBuild Projects="$(CoreLibProject)" | ||
Properties="Configuration=$(RuntimeConfiguration)" |
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.
With this, the Configuration property is always passed in as a global property even if the RuntimeConfiguration already matches the current (libraries) configuration. We should keep this in sync with how we set global properties for the ProjectReference to CoreLib.
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.
add this to a new line before L38.
<Properties Condition="'$(RuntimeFlavor)' == 'CoreCLR' and
'$(Configuration)' != '$(CoreCLRConfiguration)'">Configuration=$(CoreCLRConfiguration)</Properties>
<Properties Condition="'$(RuntimeFlavor)' == 'Mono' and
'$(Configuration)' != '$(MonoConfiguration)'">Configuration=$(MonoConfiguration)</Properties>
Yes, my workaround was to build a Debug CoreLib. This is what gets passed to the linker today with |
I see, I wasn't sure if we had passed this point in time :)
Can you either close this PR and file an issue, or address @ViktorHofer's feedback and merge? |
I'll address the feedback and merge, since it's a small effort at this point. |
<UndefineProperties>$(UndefineProperties);TargetFramework;Platform</UndefineProperties> | ||
<!-- If conflicting, manually set the Configuration property of the CoreLib project so that it aligns with the specified RuntimeConfiguration in the libraries' build. --> | ||
<Properties Condition="'$(RuntimeFlavor)' == 'CoreCLR' and | ||
'$(Configuration)' != '$(CoreCLRConfiguration)'">Configuration=$(CoreCLRConfiguration)</Properties> |
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.
Just a question, mostly for @ViktorHofer. Why do we have both $(CoreCLRConfiguration)
and $(MonoConfiguration)
? Why not just have $(RuntimeConfiguration)
? Do we expect to be able to build the repo using different configurations for coreclr and mono?
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.
There is a RuntimeConfiguration
property but in this case we can't use that as we need to respect the inferred CoreCLRConfiguration
and MonoConfiguration
properties.
Do we expect to be able to build the repo using different configurations for coreclr and mono?
Yes
b05b83a
to
c59fc16
Compare
CI failures are unrelated - dup of #47374. |
From #45821 (comment):
GetTargetPath
is returning the path to CoreLib based on the libraries configuration (-lc
), rather than the runtime configuration (-rc
). This means that when we do a build such asbuild -s clr+libs -rc Release
, we are passingDebug
libraries andDebug
CoreLib, rather thanDebug
libraries andRelease
CoreLib to the linker which is not expected.