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

Can't build large webassembly project in .net8 in Release/AOT #92100

Closed
jtorjo opened this issue Sep 15, 2023 · 7 comments
Closed

Can't build large webassembly project in .net8 in Release/AOT #92100

jtorjo opened this issue Sep 15, 2023 · 7 comments
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Milestone

Comments

@jtorjo
Copy link

jtorjo commented Sep 15, 2023

Description

I have a pretty large project (roughly 100K LOC).
It successfully builds in both .net6 and .net7.
Since the third preview of .net8, I've been trying to compile it with .net8 (so basically, each month, I'd get the latest preview, and retry).

I always get this error:

 C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-rc.1.23419.4\Sdk\WasmApp.Native.targ
       ets(681,5): error : Precompiling failed for D:\john\_...\obj\Any CPU\Release\net
	   8.0\wasm\for-publish\aot-in\aot-instances.dll with exit code 1. [D:\john\....net8.csproj]

Is there a way to at least understand the underlying error, and see if you can fix it?

The project is a webassembly project.
Note: the solution compiles and runs in .net8 in debug mode no AOT, and in Release mode no AOT.

Reproduction Steps

The csproj file:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <NoXamlPreprocessor>True</NoXamlPreprocessor>
    <OpenSilverType>4</OpenSilverType>
    <PublishTrimmed>true</PublishTrimmed>
    <!-- 
    <RunAOTCompilation>true</RunAOTCompilation>
    <AotAssemblies>True</AotAssemblies>	
	-->
	<EmccInitialHeapSize>2147483648</EmccInitialHeapSize>
	<MtouchUseLlvm>False</MtouchUseLlvm>

  </PropertyGroup>
...

If I uncomment those 2 lines, I get the error:

The command line:

msbuild <proj>.net8.csproj -m -p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true;PublishProfile=.\Properties\PublishProfiles\FolderProfileAOT8.pubxml

The profile file:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <DeleteExistingFiles>true</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>bin\Release\net8.0\browser-wasm\publish-AOT\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
    <SiteUrlToLaunchAfterPublish />
    <TargetFramework>net8.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <ProjectGuid>d517a199-85d4-42f4-8248-edf1f37245cf</ProjectGuid>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
</Project>

Expected behavior

The project should build.

Actual behavior

I get the error above.

Regression?

No response

Known Workarounds

There are no workarounds I found

Configuration

Configuration:

  • .net8.rc.1 (build: 14th of Sept 2023)
  • Windows 11/x64

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 15, 2023
@vargaz
Copy link
Contributor

vargaz commented Sep 15, 2023

As a workaround, try setting the WasmDedup msbuild property to 'false', i.e. /p:WasmDedup=false.

@vargaz
Copy link
Contributor

vargaz commented Sep 15, 2023

Maybe related: #91802

@radical radical added the arch-wasm WebAssembly architecture label Sep 15, 2023
@ghost
Copy link

ghost commented Sep 15, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I have a pretty large project (roughly 100K LOC).
It successfully builds in both .net6 and .net7.
Since the third preview of .net8, I've been trying to compile it with .net8 (so basically, each month, I'd get the latest preview, and retry).

I always get this error:

 C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-rc.1.23419.4\Sdk\WasmApp.Native.targ
       ets(681,5): error : Precompiling failed for D:\john\_...\obj\Any CPU\Release\net
	   8.0\wasm\for-publish\aot-in\aot-instances.dll with exit code 1. [D:\john\....net8.csproj]

Is there a way to at least understand the underlying error, and see if you can fix it?

The project is a webassembly project.
Note: the solution compiles and runs in .net8 in debug mode no AOT, and in Release mode no AOT.

Reproduction Steps

The csproj file:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <NoXamlPreprocessor>True</NoXamlPreprocessor>
    <OpenSilverType>4</OpenSilverType>
    <PublishTrimmed>true</PublishTrimmed>
    <!-- 
    <RunAOTCompilation>true</RunAOTCompilation>
    <AotAssemblies>True</AotAssemblies>	
	-->
	<EmccInitialHeapSize>2147483648</EmccInitialHeapSize>
	<MtouchUseLlvm>False</MtouchUseLlvm>

  </PropertyGroup>
...

If I uncomment those 2 lines, I get the error:

The command line:

msbuild <proj>.net8.csproj -m -p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true;PublishProfile=.\Properties\PublishProfiles\FolderProfileAOT8.pubxml

The profile file:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <DeleteExistingFiles>true</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>bin\Release\net8.0\browser-wasm\publish-AOT\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
    <SiteUrlToLaunchAfterPublish />
    <TargetFramework>net8.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <ProjectGuid>d517a199-85d4-42f4-8248-edf1f37245cf</ProjectGuid>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
</Project>

Expected behavior

The project should build.

Actual behavior

I get the error above.

Regression?

No response

Known Workarounds

There are no workarounds I found

Configuration

Configuration:

  • .net8.rc.1 (build: 14th of Sept 2023)
  • Windows 11/x64

Other information

No response

Author: jtorjo
Assignees: -
Labels:

arch-wasm, untriaged, area-Build-mono

Milestone: -

@jtorjo
Copy link
Author

jtorjo commented Sep 18, 2023

@vargaz Thanks for the workaround!
Surprisingly, it works!
But when I start it, I get this:

image

and
image

and
image

Is there any way to know anything more about the load error?

@vargaz
Copy link
Contributor

vargaz commented Sep 18, 2023

No idea about that one.

@pavelsavara pavelsavara added this to the 8.0.0 milestone Oct 19, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Oct 19, 2023
@pavelsavara pavelsavara added the os-browser Browser variant of arch-wasm label Oct 19, 2023
@pavelsavara
Copy link
Member

That other error is some JS issue. Please try the latest RC and open another issue if the problem persists.

@jtorjo
Copy link
Author

jtorjo commented Oct 19, 2023

@pavelsavara Thanks, will do!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

4 participants