Skip to content
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

Fix crossgenning of framework libraries on Windows #747

Merged
merged 4 commits into from
Dec 14, 2019

Conversation

trylek
Copy link
Member

@trylek trylek commented Dec 10, 2019

I tried to slightly improve the data flow by creating explicit
environment variables for the two arguments. There were a bunch
of errors regarding % vs !, duplicate double-quoting and the like.
It seems to be working now.

Thanks

Tomas

REM don't precompile anything from CoreCLR
if /I exist %CORE_ROOT_STAGE%\%2 exit /b 0
if /I exist %CORE_ROOT_STAGE%\%AssemblyName% exit /b 0
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that we won't be crossgening System.Private.CoreLib.dll with crossgen2?

Copy link
Member Author

Choose a reason for hiding this comment

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

It probably does and I concur it's something worth discussing moving forward just like the default compilation of S.P.C with legacy Crossgen within build.cmd/sh.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is a bit different from using the new crossgen in build.cmd/sh. When we run the build-tests.cmd with the option asking for crossgen2 compilation, is it strange to get the whole framework crossgened with crossgen2 except for the S.P.C. I wonder if we could just add a check here that if we are using crossgen2, we would precompile the S.P.C. too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree it's weird. I basically left that in as a pre-existing conditional statement but thinking about this some more, what about throwing this away altogether? It doesn't make too much sense to me in the "new world".

Copy link
Member

Choose a reason for hiding this comment

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

That sounds reasonable.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@trylek trylek changed the title WIP: Fix crossgenning of framework libraries on Windows Fix crossgenning of framework libraries on Windows Dec 11, 2019
set /a __exitCode = !errorlevel!
)

echo %__CrossgenCmd%
Copy link
Member

Choose a reason for hiding this comment

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

It seems this should be replaced by the similar code from the else branch above and deleted from the else branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks for pointing that out!

) else (
"!CORE_ROOT_STAGE!\crossgen2\crossgen2 -r:"!CORE_ROOT!\*.dll" -O --inputbubble -out:"__CrossgenOutputFile" "%1" >nul 2>nul
set __CrossgenCmd=!__CrossgenExe! -r:"!CORE_ROOT!\*.dll" -O --inputbubble --out:!__CrossgenOutputFile! !AssemblyPath! >nul 2>nul
Copy link
Member

Choose a reason for hiding this comment

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

I think that to eliminate all the ugly warnings on bad image format of files that are .dll but not framework assemblies, we could replace -r:"!CORE_ROOT!\*.dll by -r:"!CORE_ROOT!\System.*.dll -r:"!CORE_ROOT!\Windows.*.dll I think this covers all the framework assemblies.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, and -r:!CORE_ROOT!\mscorlib.dll too, some tests need that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion, thanks, fixed!

) else (
"!CORE_ROOT_STAGE!\crossgen2\crossgen2 -r:"!CORE_ROOT!\*.dll" -O --inputbubble -out:"__CrossgenOutputFile" "%1" >nul 2>nul
set __CrossgenCmd=!__CrossgenExe! -r:"!CORE_ROOT!\*.dll" -O --inputbubble --out:!__CrossgenOutputFile! !AssemblyPath! >nul 2>nul
Copy link
Member

Choose a reason for hiding this comment

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

I suppose the >nul 2>nul was supposed to be part of the __CrossgenCmd, but it is applied to the set command instead. It should be placed on the !__CrossgenCmd! line if we want to suppress the crossgen output.

Copy link
Member Author

Choose a reason for hiding this comment

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

Deleted per our offline chat, there's no sense in throwing away diagnostic information (and there's not a ton of it).

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

I tried to slightly improve the data flow by creating explicit
environment variables for the two arguments. There were a bunch
of errors regarding % vs !, duplicate double-quoting and the like.
It seems to be working now.

Thanks

Tomas
1) The ordering of steps in build-test was incorrect - we need to
patch CORE_ROOT with live-live libraries build before Crossgenning
the framework therein, otherwise weird things happen (and the result
is incorrect in any case).

2) Removed misplaced >nul 2>nul - we agreed with JanV that it's
better to not throw diagnostic information away.

3) Applied JanV's suggestion for improvement - using a tighter filter
for reference assemblies - Microsoft.*.dll / System.*.dll /
mscorlib.dll instead of just *.dll that ended up picking tons of
garbage like clrjit.dll and the various Win32 API contracts, both
in the build-test script and in CLRTest.Crossgen.targets.

Thanks

Tomas
@trylek trylek merged commit ac4b5b6 into dotnet:master Dec 14, 2019
@trylek trylek deleted the CrossgenFrameworkFix branch December 14, 2019 19:39
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants