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

[BUG] NET8 Preview5 Wasm + SkiaSharp 2.88.4 build errors #2494

Closed
KirillKornienko opened this issue Jun 16, 2023 · 9 comments · Fixed by #2495
Closed

[BUG] NET8 Preview5 Wasm + SkiaSharp 2.88.4 build errors #2494

KirillKornienko opened this issue Jun 16, 2023 · 9 comments · Fixed by #2495

Comments

@KirillKornienko
Copy link

KirillKornienko commented Jun 16, 2023

Description

Empty .NET 8 Blazor Wasm application throws build errors when including the latest SkiaSharp NativeAssets. See Build output.

Code

My .csproj:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0-preview.5.23302.2" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0-preview.5.23302.2" PrivateAssets="all" />
    
    <PackageReference Include="SkiaSharp" Version="2.88.4-preview.70" />
    <PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.4-preview.70" />
    <PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.4-preview.70" />
    <PackageReference Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="2.8.2.4-preview.70" />
  </ItemGroup>

  <ItemGroup>
    <NativeFileReference Include="$(HarfBuzzSharpStaticLibraryPath)\3.1.34\st\*.a" />
    <NativeFileReference Include="$(SkiaSharpStaticLibraryPath)\3.1.34\st\*.a" />
  </ItemGroup>
</Project>
Build output:
1>Compiling native assets with emcc with -O0. This may take a while ...
1>Linking for initial memory $(EmccInitialHeapSize)=26279936 bytes. Set this msbuild property to change the value.
1>Linking with emcc with -O0. This may take a while ...
1> "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.0-preview.5.23275.2\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.0-preview.5.23275.2\tools\emscripten\src\compiler.js" C:\Users\kirea\AppData\Local\Temp\tmpl5kycuxs.json --symbols-only
1> "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.0-preview.5.23275.2\tools\bin\wasm-ld.exe" -o C:\Users\kirea\source\repos\fastreport_net2\Tools\DebugApps\BlazorAppWasm8\obj\Debug\net8.0\wasm\for-build\dotnet.native.wasm C:\Users\kirea\.nuget\packages\harfbuzzsharp.nativeassets.webassembly\2.8.2.4-preview.70\buildTransitive\netstandard1.0\..\..\build\netstandard1.0\libHarfBuzzSharp.a\3.1.34\st\libHarfBuzzSharp.a C:\Users\kirea\.nuget\packages\skiasharp.nativeassets.webassembly\2.88.4-preview.70\buildTransitive\netstandard1.0\..\..\build\netstandard1.0\libSkiaSharp.a\3.1.34\st\libSkiaSharp.a C:\Users\kirea\source\repos\fastreport_net2\Tools\DebugApps\BlazorAppWasm8\obj\Debug\net8.0\wasm\for-build\pinvoke.o C:\Users\kirea\source\repos\fastreport_net2\Tools\DebugApps\BlazorAppWasm8\obj\Debug\net8.0\wasm\for-build\driver.o C:\Users\kirea\source\repos\fastreport_net2\Tools\DebugApps\BlazorAppWasm8\obj\Debug\net8.0\wasm\for-build\corebindings.o "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libicudata.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libicui18n.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libicuuc.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-component-debugger-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-component-diagnostics_tracing-stub-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-component-hot_reload-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-component-marshal-ilgen-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-ee-interp.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-icall-table.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-profiler-aot.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-profiler-browser.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmono-wasm-eh-wasm.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libmonosgen-2.0.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libSystem.Globalization.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libSystem.IO.Compression.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\libSystem.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\wasm-bundled-timezones.a" "-LC:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Cache.win-x64\8.0.0-preview.5.23275.2\tools\emscripten\cache\sysroot\lib\wasm32-emscripten" -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt-wasm-sjlj -lc++-except -lc++abi-debug-except -lunwind-except -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -mllvm -wasm-enable-eh -mllvm -exception-model=wasm --allow-undefined-file=C:\Users\kirea\AppData\Local\Temp\tmp945iee1j.undefined --export-if-defined=malloc --export-if-defined=memalign --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=fmod --export-if-defined=atan2 --export-if-defined=fma --export-if-defined=pow --export-if-defined=fmodf --export-if-defined=atan2f --export-if-defined=fmaf --export-if-defined=powf --export-if-defined=asin --export-if-defined=asinh --export-if-defined=acos --export-if-defined=acosh --export-if-defined=atan --export-if-defined=atanh --export-if-defined=cbrt --export-if-defined=cos --export-if-defined=cosh --export-if-defined=exp --export-if-defined=log --export-if-defined=log2 --export-if-defined=log10 --export-if-defined=sin --export-if-defined=sinh --export-if-defined=tan --export-if-defined=tanh --export-if-defined=asinf --export-if-defined=asinhf --export-if-defined=acosf --export-if-defined=acoshf --export-if-defined=atanf --export-if-defined=atanhf --export-if-defined=cbrtf --export-if-defined=cosf --export-if-defined=coshf --export-if-defined=expf --export-if-defined=logf --export-if-defined=log2f --export-if-defined=log10f --export-if-defined=sinf --export-if-defined=sinhf --export-if-defined=tanf --export-if-defined=tanhf --export-if-defined=memset --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=free --export-if-defined=__get_exception_message --export-if-defined=__cpp_exception --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=__thrown_object_from_unwind_exception --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=malloc --export=free --export=__trap --export=__wasm_call_ctors --export=emscripten_builtin_memalign --export=__dl_seterr --export=saveSetjmp --export=setThrew --export=htonl --export=htons --export=ntohs --export-table --growable-table -z stack-size=5242880 --initial-memory=26279936 --no-entry --max-memory=2147483648 --stack-first
1> "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.0-preview.5.23275.2\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.0-preview.5.23275.2\tools\emscripten\src\compiler.js" C:\Users\kirea\AppData\Local\Temp\tmp412qil12.json
1>EXEC : error : undefined symbol: emscripten_longjmp (referenced by top-level compiled C/C++ code)
1>EXEC : warning : To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0`
1>EXEC : warning : _emscripten_longjmp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
1>EXEC : error : Aborting compilation due to previous errors
1>emcc : error : '"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.0-preview.5.23275.2\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.0-preview.5.23275.2\tools\emscripten\src\compiler.js" C:\Users\kirea\AppData\Local\Temp\tmp412qil12.json' failed (returned 1)
1>C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-preview.5.23280.8\Sdk\WasmApp.Native.targets(476,5): error MSB3073: The command "emcc "@C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\src\emcc-default.rsp" "@C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-preview.5.23280.8\runtimes\browser-wasm\native\src\emcc-link.rsp" "@C:\Users\kirea\source\repos\fastreport_net2\Tools\DebugApps\BlazorAppWasm8\obj\Debug\net8.0\wasm\for-build\emcc-link.rsp"" exited with code 1.
1>Done building project "BlazorAppWasm8.csproj" -- FAILED.

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue: 2.88.4-preview.70
  • IDE: Visual Studio 17.7 Preview 2
  • Platform Target Frameworks: Wasm

Reproduction Link

@mattleibow
Copy link
Contributor

mattleibow commented Jun 16, 2023

One thing I notice is that you have in your csproj:

<NativeFileReference Include="$(SkiaSharpStaticLibraryPath)\3.1.34\st\*.a" />

Note the st, but in the logs you have mt:

C:\Users\kirea.nuget\packages\skiasharp.nativeassets.webassembly\2.88.4-preview.70\buildTransitive\netstandard1.0....\build\netstandard1.0\libSkiaSharp.a\3.1.34\mt\libSkiaSharp.a

Not saying this is the issue, but it is something I noticed.

@mattleibow
Copy link
Contributor

That type seems to be a part of .NET itself... https://github.com/search?q=org%3Adotnet%20emscripten_longjmp&type=code

@mattleibow
Copy link
Contributor

https://github.com/emscripten-core/emscripten/blob/51b99e19f63896f681cdc714c62a3bbcbbef2690/ChangeLog.md#3132---021723

SUPPORT_LONGJMP's default value now depends on the exception mode. If Wasm EH (-fwasm-exception) is used, it defaults to wasm, and if Emscripten EH (-sDISABLE_EXCEPTION_CATCHING=0) is used or no exception support is used, it defaults to emscripten. Previously it always defaulted to emscripten, so when a user specified -fwasm-exceptions, it resulted in Wasm EH + Emscripten SjLj, the combination we do not intend to support for the long term.

@mattleibow
Copy link
Contributor

And also emscripten-core/emscripten#19004

@mattleibow
Copy link
Contributor

Can you also attach a binlog so we can investigate?

@KirillKornienko
Copy link
Author

One thing I notice is that you have in your csproj:

<NativeFileReference Include="$(SkiaSharpStaticLibraryPath)\3.1.34\st\*.a" />

Note the st, but in the logs you have mt:

C:\Users\kirea.nuget\packages\skiasharp.nativeassets.webassembly\2.88.4-preview.70\buildTransitive\netstandard1.0....\build\netstandard1.0\libSkiaSharp.a\3.1.34\mt\libSkiaSharp.a

Not saying this is the issue, but it is something I noticed.

Yes, I accidentally attached the build output with mt when I tried this. With st the situation is the same. I corrected the build output in Issue.

@mattleibow
Copy link
Contributor

The PR from @jeromelaban may fix this issue. It is still in the queue, but when it is done you can try using the PR artifacts.

@mattleibow
Copy link
Contributor

Thanks for finding this!

@KirillKornienko
Copy link
Author

The PR from @jeromelaban may fix this issue. It is still in the queue, but when it is done you can try using the PR artifacts.

Sure, I will try this, when the artifacts will be ready.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants