Repository navigation
[wasm][aot] build tries to cross compile unrelated dlls from the publish folder #46856
Description
In effort to run library tests with AOT compilation on CI #46633, there are a number of failures arising from #46651.
Test suite System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj fails on MonoAOTCompiler task with
/Users/mdhwang/runtime_wasm_clean/src/mono/wasm/build/WasmApp.targets(43,5): error : Can not open image /Users/mdhwang/runtime_wasm_clean/artifacts/bin/System.Diagnostics.FileVersionInfo.Tests/net6.0-Browser-Release/browser-wasm/publish/NativeLibrary.dll [/Users/mdhwang/runtime_wasm_clean/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj]
/Users/mdhwang/runtime_wasm_clean/src/mono/wasm/build/WasmApp.targets(43,5): error : Precompiling failed for /Users/mdhwang/runtime_wasm_clean/artifacts/bin/System.Diagnostics.FileVersionInfo.Tests/net6.0-Browser-Release/browser-wasm/publish/NativeLibrary.dll: Error: Can not open image /Users/mdhwang/runtime_wasm_clean/artifacts/bin/System.Diagnostics.FileVersionInfo.Tests/net6.0-Browser-Release/browser-wasm/publish/NativeLibrary.dll [/Users/mdhwang/runtime_wasm_clean/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj]
/Users/mdhwang/runtime_wasm_clean/src/mono/wasm/build/WasmApp.targets(43,5): error : [/Users/mdhwang/runtime_wasm_clean/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj]
/Users/mdhwang/runtime_wasm_clean/src/mono/wasm/build/WasmApp.targets(43,5): error : [/Users/mdhwang/runtime_wasm_clean/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj]
System_diagnostics_fileversioninfo_fail.txt
Repro
Check out changes in #46651
./build.sh -os Browser -arch wasm -c Release
Remove
runtime/eng/testing/ILLink.Descriptor.xunit.xml
Lines 15 to 20 in f7f5046
| <!-- Temporary until https://github.com/mono/linker/issues/1713 is resolved --> | |
| <assembly fullname="Microsoft.DotNet.RemoteExecutor"> | |
| <type fullname="Microsoft.DotNet.RemoteExecutor.Program"> | |
| <method signature="System.Int32 Main(System.String[])" /> | |
| </type> | |
| </assembly> |
Modify
| catch (Exception e) when (IsIoRelatedException(e) && !disposing) |
catch
{
}
./dotnet.sh build /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
Activity
radical commentedon Jan 12, 2021
This depends on a native library, which is why
MonoAOTCompilerfails with it. Are these tests supported, or should be supported on wasm? These were disabled in c72d522 .What is the expected behavior?
[-]wasm AOT library test failure - Can not open image[/-][+][wasm] AOT: Native libraries with projects don't work[/+]lambdageek commentedon May 18, 2021
The problem is that
NativeLibrary.dllis a win32 dll, not a .NET assembly. So when we pass it toMonoAOTCompiler, it can't open it and fails.We should either:
Contentline in this test file to include some metadata that will tell the build infrastructure not to pass this assembly to the AOT compiler, orlambdageek commentedon May 18, 2021
It also affects #52848. And probably ios device testing, too. basically anything that needs the AOT compiler
steveisok commentedon May 21, 2021
In #52848 I defined a
<NativeLibraries>itemgroup. That ends up being part of the items that are excluded from the aot compiler. If there's a better way, I'm all ears.runtime/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
Lines 22 to 26 in 227847c
runtime/eng/testing/tests.mobile.targets
Lines 169 to 175 in 227847c
[-][wasm] AOT: Native libraries with projects don't work[/-][+][wasm][aot] build tries to cross compile unrelated dlls from the publish folder[/+]lewing commentedon Jul 31, 2021
@radical what is your plan here?
radical commentedon Aug 1, 2021
Currently, we pick up all the files from the publish folder, where this assembly also ends up because it is in
@(Content). I expect this to be fixed once we have the wasm targets taking the relevant list of referenced assemblies from earlier targets (eg.ResolveAssemblyReferences).radical commentedon Sep 8, 2021
This needs some more work (a bit involved) to integrate with Publish at a more granular level.
ilonatommy commentedon Jun 14, 2022
@radical, any progress?
radical commentedon Jun 14, 2022
No. We should keep this for 7.0 milestone for now, but I'm not sure if we'll actually be able to get to it. This is dependent on better integration with
publish.radical commentedon Jul 28, 2022
The original issue here - that of
MonoAOTCompilertask trying to compile unmanaged dlls is fixed, as we skip those now.runtime/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Lines 603 to 607 in d7c8bc1
The broader issue of handling publish assets better, is separate from this.