Add default value when FeatureDynamicCodeCompiled is undefined#124476
Add default value when FeatureDynamicCodeCompiled is undefined#124476BrzVlad merged 1 commit intodotnet:mainfrom
Conversation
This property is normally passed to msbuild when building runtime.proj, with a true or false value. An exception happens when building from vs, with `./build.cmd -vs coreclr.slnx`. Feature defines need to have a default value for this scenario. Rather than adding a default in clrfeatures.cmake, which would require duplicating target os logic from the build scripts, this commit handles the default at a higher level in runtime.proj.
|
Issue hit by @jakobbotsch in #124168 (comment) |
|
Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure |
There was a problem hiding this comment.
Pull request overview
This PR fixes a build issue when opening CoreCLR in Visual Studio using ./build.cmd -vs coreclr.slnx. When building through this path, the FeatureDynamicCodeCompiled MSBuild property is undefined, causing CMake configuration to fail. The fix adds a default value by treating an empty string as true, which aligns with the default behavior in build scripts for Windows platforms.
Changes:
- Modified the conditional check for
FeatureDynamicCodeCompiledin runtime.proj to default to enabled when the property is undefined
|
This seems like the wrong fix to me. The flag should probably be initialized in msbuild rather than the build.sh/cmd scripts so the logic is handled there. E.g. ILCompiler.ReadyToRun.csproj and clr.featuredefines.props are also using it. |
|
@akoeplinger Hmm, if I'm understanding correctly, then it is not necessarily this fix that is wrong, but the original implementation. So you would recommend the arch handling to be removed from here: https://github.com/dotnet/runtime/blob/main/eng/build.ps1#L357 and here: https://github.com/dotnet/runtime/blob/main/eng/build.sh#L597, pass the edit: I'm not sure if runtime.proj would see properties from |
|
Yeah though it looks like clr.featuredefines.props is not imported in runtime.proj. I think this might be the first "enabled-by-default" feature. e.g. if you look at FeatureXplatEventSource we set it to true based on some conditions in runtime/src/coreclr/clr.featuredefines.props Lines 30 to 31 in 9268ae6 runtime/src/coreclr/runtime.proj Line 55 in 9268ae6 |
|
A problem with dynamic code compiled option is that, even if you don't pass it explicitly to the build it needs to have a platform dependent value, both for runtime/crossgen2 and SPC. So it seems I believe we have 2 options:
|
|
I see the top-level build option as a non-production quality testing hook. I think the current implementation is good enough for that. A production quality option would be much more complicated. For example, we would not want to have the ifdef in ILCompiler.ReadyToRun.csproj at all. Instead, we would want it to be a crossgen2 switch, or have crossgen2 auto-detect the setting from the CoreLib. |
This property is normally passed to msbuild when building runtime.proj, with a true or false value. An exception happens when building from vs, with
./build.cmd -vs coreclr.slnx. Feature defines need to have a default value for this scenario. Rather than adding a default in clrfeatures.cmake, which would require duplicating target os logic from the build scripts, this commit handles the default at a higher level in runtime.proj.