Closed adamsitnik closed 2 years ago
I would recommend to generate a rsp file manually and pass it directly to ilc.
The easiest way to use the locally built compiler is do a full build including packaging, add nuget.config path that points to ...\artifacts\packages\Release\Shipping
and use regular project structure.
We have IlcXXXPath
variables that allow you to override path for each component. This is what the tests are doing: https://github.com/dotnet/runtime/blob/4881a639e7c3f27b5a8d2d160e234d8055333cda/src/tests/Directory.Build.targets#L517-L523
My typical dev workflow is to build the regular package and point nuget.config to it, and then override IlcXXXPath
s for the part that I am iterating on. The added benefit is that it allows me to mix and match release and debug builds of the compiler and libraries (e.g. use Debug compiler and Release libraries).
With CoreRT, it was possible to build an app using ILCompiler that was built locally: https://github.com/dotnet/corert/blob/7f902d4d8b1c3280e60f5e06c71951a60da173fb/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md#compiling-source-to-native-code-using-the-ilcompiler-you-built
BenchmarkDotNet supported that, but I've not used it for a long time. Today I wanted to give it a try to test #68249 and I've failed.
Sample project file:
The first error I got was:
Native compilation can run on x64 and arm64 hosts only
. I was able to work around it by passing/p:IlcHostArch=x64
.The next error I got was:
The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative
.This property is computed in following way:
https://github.com/dotnet/runtime/blob/784545d7757b9e8be8978daa71ed2132f7258863/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets#L110 https://github.com/dotnet/runtime/blob/784545d7757b9e8be8978daa71ed2132f7258863/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets#L142
I can see that there is no "sdk" folder in
\artifacts\bin\coreclr\windows.x64.Release\
(after running.\build.cmd -c Release -subset Clr
), but there is an "aotsdk" folder. Also, the test project seems to just get the right path from MSBuild:https://github.com/dotnet/runtime/blob/784545d7757b9e8be8978daa71ed2132f7258863/src/tests/Directory.Build.targets#L521
I've workarounded this problem by just passing the right flag but got stuck few errors later. I gave up assuming that I am trying to open doors that somebody else have already opened.
@MichalStrehovsky @jkotas is there an easy (even hacky) way to get it working?