grpc / grpc-dotnet

gRPC for .NET
Apache License 2.0
4.22k stars 776 forks source link

Blazor WASM app fails to build on .NET 9 #2575

Closed Hona closed 1 week ago

Hona commented 1 week ago

What version of gRPC and what language are you using?

.NET 9, Blazor WASM Standalone

    <PackageVersion Include="protobuf-net.Grpc.ClientFactory" Version="1.2.2" />
    <PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.2.2" />
    <PackageVersion Include="protobuf-net.Grpc" Version="1.2.2" />
    <PackageVersion Include="Grpc.AspNetCore.Server" Version="2.66.0" />
    <PackageVersion Include="Grpc.Net.ClientFactory" Version="2.66.0" />
    <PackageVersion Include="Grpc.Net.Client.Web" Version="2.66.0" />
    <PackageVersion Include="Grpc.AspNetCore.Web" Version="2.66.0" />
    <PackageVersion Include="protobuf-net" Version="3.2.45" />

What operating system (Linux, Windows,...) and version?

Windows 11

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

dotnet --info results

PS C:\Repos\Revive> dotnet --info .NET SDK: Version: 9.0.100 Commit: 59db016f11 Workload version: 9.0.100-manifests.c6f19616 MSBuild version: 17.12.7+5b8665660 Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100\ .NET workloads installed: [aspire] Installation Source: SDK 9.0.100, VS 17.10.35027.167 Manifest Version: 8.2.2/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json Install Type: Msi [wasm-tools] Installation Source: SDK 9.0.100 Manifest Version: 9.0.0/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.0\WorkloadManifest.json Install Type: Msi [wasm-tools-net8] Installation Source: SDK 9.0.100 Manifest Version: 9.0.0/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.0\WorkloadManifest.json Install Type: Msi Configured to use loose manifests when installing new manifests. Host: Version: 9.0.0 Architecture: x64 Commit: 9d5a6a9aa4 .NET SDKs installed: 8.0.303 [C:\Program Files\dotnet\sdk] 8.0.306 [C:\Program Files\dotnet\sdk] 8.0.403 [C:\Program Files\dotnet\sdk] 9.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: C:\Repos\Revive\global.json Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download

What did you do?

If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.

What did you expect to see?

Build success

What did you see instead?

Build failure

dotnet build output

Debtware.Client.Portal failed with 24 error(s) (3.2s) wasm-ld : error : lto.tmp: undefined symbol: gprsharp_convert_clock_type wasm-ld : error : lto.tmp: undefined symbol: gprsharp_free wasm-ld : error : lto.tmp: undefined symbol: gprsharp_inf_future wasm-ld : error : lto.tmp: undefined symbol: gprsharp_inf_past wasm-ld : error : lto.tmp: undefined symbol: gprsharp_now wasm-ld : error : lto.tmp: undefined symbol: gprsharp_sizeof_timespec wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_auth_context_peer_identity_property_name wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_auth_context_property_iterator wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_auth_context_release wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_auth_property_iterator_next wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_create wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_destroy wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_close_on_server_cancelled wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_initial_metadata wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_message_length wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_message_next_slice_peek wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_status_on_client_details wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_status_on_client_error_string wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_status_on_client_status wasm-ld : error : lto.tmp: undefined symbol: grpcsharp_batch_context_recv_status_on_client_trailing_metadata wasm-ld : error : too many errors emitted, stopping now (use -error-limit=0 to see all errors) emcc : error : '"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.56.Sdk.win-x64\9.0.0\tools\bin\wasm-ld.exe" -o C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\dotnet.native.wasm C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\pinvoke.o C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\driver.o C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\corebindings.o C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\runtime.o "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libicudata.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libicui18n.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libicuuc.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-component-debugger-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-component-diagnostics_tracing-stub-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-component-hot_reload-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-component-marshal-ilgen-static.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-ee-interp.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-icall-table.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-profiler-aot.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-profiler-browser.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-profiler-log.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-wasm-eh-wasm.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmono-wasm-nosimd.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libmonosgen-2.0.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libSystem.Globalization.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libSystem.IO.Compression.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libSystem.Native.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\libz.a" "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\wasm-bundled-timezones.a" "-LC:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.56.Cache.win-x64\9.0.0\tools\emscripten\cache\sysroot\lib\wasm32-emscripten" -lGL-getprocaddr -lal -lhtml5 -lbulkmemory -lstubs-debug -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 C:\Users\LUKEPA~1\AppData\Local\Temp\tmpqkaqlk9ulibemscripten_js_symbols.so --export=free --export=htons --export=malloc --export=sbrk --export=memalign --export=memset --export=ntohs --export=stackAlloc --export=stackRestore --export=stackSave --export=fmod --export=atan2 --export=fma --export=pow --export=fmodf --export=atan2f --export=fmaf --export=powf --export=asin --export=asinh --export=acos --export=acosh --export=atan --export=atanh --export=cbrt --export=cos --export=cosh --export=exp --export=log --export=log2 --export=log10 --export=sin --export=sinh --export=tan --export=tanh --export=asinf --export=asinhf --export=acosf --export=acoshf --export=atanf --export=atanhf --export=cbrtf --export=cosf --export=coshf --export=expf --export=logf --export=log2f --export=log10f --export=sinf --export=sinhf --export=tanf --export=tanhf --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=stackAlloc --export=__funcs_on_exit --export=__trap --export=__cpp_exception --export=__wasm_call_ctors --export=__get_exception_message --export=free --export=stackSave --export=stackRestore --export=__thrown_object_from_unwind_exception --export=__cxa_increment_exception_refcount --export=__cxa_decrement_exception_refcount --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=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table --growable-table -z stack-size=5242880 --max-memory=2147483648 --initial-memory=56688640 --no-entry --stack-first --table-base=1' failed (returned 1) C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0\Sdk\BrowserWasmApp.targets(494,5): error MSB3073: The command "emcc "@C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\src\emcc-default.rsp" -fwasm-exceptions "@C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0\runtimes\browser-wasm\native\src\emcc-link.rsp" "@C:\Repos\Revive\src\WebUI\Debtware.Client.Portal\obj\Debug\net9.0\wasm\for-build\emcc-link.rsp"" exited with code 1. C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0\Sdk\BrowserWasmApp.targets(511,5): error : Use '-p:WasmAllowUndefinedSymbols=true' to allow undefined symbols Build failed with 24 error(s) in 6.5s

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

See TROUBLESHOOTING.md for how to diagnose problems better.

Anything else we should know about your project / environment?

JamesNK commented 1 week ago

The error isn't coming from code in gRPC for .NET. Ask for help in protobuf-net repository.

Hona commented 1 week ago

Thanks! I wasn't too sure from the log output